run cancel in defer

This commit is contained in:
Pascal Fischer
2025-01-17 01:11:09 +01:00
parent eeb688cb5e
commit aa34dda05a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -259,6 +259,7 @@ func TestClient_Sync(t *testing.T) {
ch := make(chan *mgmtProto.SyncResponse, 5)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go func() {
err = client.Sync(ctx, info, func(msg *mgmtProto.SyncResponse) error {
ch <- msg
@@ -291,7 +292,6 @@ func TestClient_Sync(t *testing.T) {
t.Error("timeout waiting for test to finish")
}
cancel()
}
func Test_SystemMetaDataFromClient(t *testing.T) {