Skip to content

Commit 082e85d

Browse files
committed
fix race condition
1 parent 5783936 commit 082e85d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/command/command_plugin_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,12 @@ func TestCommandPlugin_FeatureDisabled(t *testing.T) {
339339

340340
func TestMonitorSubscribeChannel(t *testing.T) {
341341
ctx, cncl := context.WithCancel(context.Background())
342-
defer cncl()
343342

344343
logBuf := &bytes.Buffer{}
345344
stub.StubLoggerWith(logBuf)
346345

347346
cp := NewCommandPlugin(types.AgentConfig(), &grpcfakes.FakeGrpcConnectionInterface{})
347+
cp.subscribeCancel = cncl
348348

349349
message := protos.CreateManagementPlaneRequest()
350350

@@ -359,7 +359,7 @@ func TestMonitorSubscribeChannel(t *testing.T) {
359359
// Give some time to process the message
360360
time.Sleep(100 * time.Millisecond)
361361

362-
cncl()
362+
cp.Close(ctx)
363363

364364
time.Sleep(100 * time.Millisecond)
365365

0 commit comments

Comments
 (0)