Explorar o código

A mutex in a test struct ...

Philipp Heckel %!s(int64=4) %!d(string=hai) anos
pai
achega
6b46eb46e2
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      server/server_test.go

+ 4 - 0
server/server_test.go

@@ -11,6 +11,7 @@ import (
 	"os"
 	"path/filepath"
 	"strings"
+	"sync"
 	"testing"
 	"time"
 )
@@ -510,9 +511,12 @@ func TestServer_Curl_Publish_Poll(t *testing.T) {
 
 type testMailer struct {
 	count int
+	mu sync.Mutex
 }
 
 func (t *testMailer) Send(to string, m *message) error {
+	t.mu.Lock()
+	defer t.mu.Unlock()
 	t.count++
 	return nil
 }