diff --git a/internal/dataplane/kong_client_test.go b/internal/dataplane/kong_client_test.go index ce23e71641..78da91f61f 100644 --- a/internal/dataplane/kong_client_test.go +++ b/internal/dataplane/kong_client_test.go @@ -240,8 +240,6 @@ func (m mockConfigurationChangeDetector) HasConfigurationChanged( } func TestKongClientUpdate_AllExpectedClientsAreCalledAndErrorIsPropagated(t *testing.T) { - t.Parallel() - var ( ctx = context.Background() testKonnectClient = mustSampleKonnectClient(t) @@ -409,8 +407,6 @@ func (p *mockKongConfigBuilder) returnTranslationFailures(enabled bool) { } func TestKongClientUpdate_ConfigStatusIsAlwaysNotified(t *testing.T) { - t.Parallel() - var ( ctx = context.Background() testKonnectClient = mustSampleKonnectClient(t) @@ -525,7 +521,8 @@ func newFakeEventsRecorder() *record.FakeRecorder { // Ingest events to unblock writing side. go func() { - for range eventRecorder.Events { + for { + <-eventRecorder.Events } }() diff --git a/internal/konnect/node_agent_test.go b/internal/konnect/node_agent_test.go index 64b7fece86..ba0de07441 100644 --- a/internal/konnect/node_agent_test.go +++ b/internal/konnect/node_agent_test.go @@ -273,10 +273,9 @@ func TestNodeAgentUpdateNodes(t *testing.T) { ) ctx, cancel := context.WithCancel(context.Background()) - agentReturned := make(chan struct{}) + defer cancel() go func() { - require.NoError(t, nodeAgent.Start(ctx)) - close(agentReturned) + _ = nodeAgent.Start(ctx) }() if tc.configStatus != nil { @@ -323,21 +322,11 @@ func TestNodeAgentUpdateNodes(t *testing.T) { return true }, timeout, tick) - - // Cancel the context and wait for the nodeAgent.Start() to return. - cancel() - select { - case <-time.After(timeout): - t.Fatal("expected the agent to return after the context was cancelled") - case <-agentReturned: - } }) } } func TestNodeAgent_StartDoesntReturnUntilContextGetsCancelled(t *testing.T) { - t.Parallel() - nodeClient := newMockNodeClient(nil) // Always return errors from ListNodes to ensure that the agent doesn't propagate it to the Start() caller. // ListNodes is the first call made by the agent in Start(), so we care only about this one. @@ -402,10 +391,8 @@ func TestNodeAgent_ControllerNodeStatusGetsUpdatedOnStatusNotification(t *testin ctx, cancel := context.WithCancel(context.Background()) defer cancel() - agentReturned := make(chan struct{}) go func() { - require.NoError(t, nodeAgent.Start(ctx)) - close(agentReturned) + _ = nodeAgent.Start(ctx) }() testCases := []struct { @@ -457,7 +444,7 @@ func TestNodeAgent_ControllerNodeStatusGetsUpdatedOnStatusNotification(t *testin } return true - }, time.Second, time.Millisecond*10) + }, time.Second, time.Millisecond) }) } }