mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-01-19 00:27:25 +01:00
Fix race in test
This commit is contained in:
@@ -714,6 +714,12 @@ func (t *testMailer) Send(from, to string, m *message) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *testMailer) Count() int {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
return t.count
|
||||
}
|
||||
|
||||
func TestServer_PublishTooRequests_Defaults(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
for i := 0; i < 60; i++ {
|
||||
@@ -902,7 +908,7 @@ func TestServer_PublishAsJSON_WithEmail(t *testing.T) {
|
||||
m := toMessage(t, response.Body.String())
|
||||
require.Equal(t, "mytopic", m.Topic)
|
||||
require.Equal(t, "A message", m.Message)
|
||||
require.Equal(t, 1, mailer.count)
|
||||
require.Equal(t, 1, mailer.Count())
|
||||
}
|
||||
|
||||
func TestServer_PublishAsJSON_Invalid(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user