Skip to content

Commit

Permalink
Fix failing unit test (#2685)
Browse files Browse the repository at this point in the history
Problem: Intermittently one of our unit tests was failing.

Solution: My hunch as to why it was failing is because of the parallel nature would occasionally cause an object to be in the wrong state for a specific test. So that object is now being defined for every test instead of globally.
  • Loading branch information
sjberman authored Oct 14, 2024
1 parent 3748661 commit 510c35a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/mode/static/config_updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestUpdateControlPlane(t *testing.T) {
}

logger := zap.New()
fakeEventRecorder := record.NewFakeRecorder(1)
nsname := types.NamespacedName{Namespace: "test", Name: "test"}

tests := []struct {
Expand Down Expand Up @@ -82,6 +81,8 @@ func TestUpdateControlPlane(t *testing.T) {
},
}

fakeEventRecorder := record.NewFakeRecorder(1)

err := updateControlPlane(test.nginxGateway, logger, fakeEventRecorder, nsname, fakeLogSetter)

if test.expErrString != "" {
Expand Down

0 comments on commit 510c35a

Please sign in to comment.