mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 08:52:27 +02:00
Enable goroutine leak checks for more tests.
This commit is contained in:
parent
9adb762ccf
commit
b77525603c
|
@ -47,6 +47,7 @@ func TestFileWatcher_NotExist(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileWatcher_File(t *testing.T) {
|
func TestFileWatcher_File(t *testing.T) {
|
||||||
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
tmpdir := t.TempDir()
|
tmpdir := t.TempDir()
|
||||||
filename := path.Join(tmpdir, "test.txt")
|
filename := path.Join(tmpdir, "test.txt")
|
||||||
if err := os.WriteFile(filename, []byte("Hello world!"), 0644); err != nil {
|
if err := os.WriteFile(filename, []byte("Hello world!"), 0644); err != nil {
|
||||||
|
@ -89,6 +90,7 @@ func TestFileWatcher_File(t *testing.T) {
|
||||||
t.Error("should not have received another event")
|
t.Error("should not have received another event")
|
||||||
case <-ctxTimeout.Done():
|
case <-ctxTimeout.Done():
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileWatcher_Rename(t *testing.T) {
|
func TestFileWatcher_Rename(t *testing.T) {
|
||||||
|
|
|
@ -112,6 +112,7 @@ func waitForEvent(ctx context.Context, t *testing.T, ch <-chan struct{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_EtcdInitial(t *testing.T) {
|
func Test_GrpcClients_EtcdInitial(t *testing.T) {
|
||||||
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
_, addr1 := NewGrpcServerForTest(t)
|
_, addr1 := NewGrpcServerForTest(t)
|
||||||
_, addr2 := NewGrpcServerForTest(t)
|
_, addr2 := NewGrpcServerForTest(t)
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ func Test_GrpcClients_EtcdInitial(t *testing.T) {
|
||||||
if clients := client.GetClients(); len(clients) != 2 {
|
if clients := client.GetClients(); len(clients) != 2 {
|
||||||
t.Errorf("Expected two clients, got %+v", clients)
|
t.Errorf("Expected two clients, got %+v", clients)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_EtcdUpdate(t *testing.T) {
|
func Test_GrpcClients_EtcdUpdate(t *testing.T) {
|
||||||
|
@ -231,6 +233,7 @@ func Test_GrpcClients_EtcdIgnoreSelf(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
||||||
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
lookup := newMockDnsLookupForTest(t)
|
lookup := newMockDnsLookupForTest(t)
|
||||||
target := "testgrpc:12345"
|
target := "testgrpc:12345"
|
||||||
ip1 := net.ParseIP("192.168.0.1")
|
ip1 := net.ParseIP("192.168.0.1")
|
||||||
|
@ -282,6 +285,7 @@ func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
||||||
} else if !clients[0].ip.Equal(ip2) {
|
} else if !clients[0].ip.Equal(ip2) {
|
||||||
t.Errorf("Expected IP %s, got %s", ip2, clients[0].ip)
|
t.Errorf("Expected IP %s, got %s", ip2, clients[0].ip)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
||||||
|
@ -320,6 +324,7 @@ func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_Encryption(t *testing.T) {
|
func Test_GrpcClients_Encryption(t *testing.T) {
|
||||||
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -371,4 +376,5 @@ func Test_GrpcClients_Encryption(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue