Skip to content

Commit 510c35a

Browse files
authored
Fix failing unit test (#2685)
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.
1 parent 3748661 commit 510c35a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/mode/static/config_updater_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func TestUpdateControlPlane(t *testing.T) {
3434
}
3535

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

4039
tests := []struct {
@@ -82,6 +81,8 @@ func TestUpdateControlPlane(t *testing.T) {
8281
},
8382
}
8483

84+
fakeEventRecorder := record.NewFakeRecorder(1)
85+
8586
err := updateControlPlane(test.nginxGateway, logger, fakeEventRecorder, nsname, fakeLogSetter)
8687

8788
if test.expErrString != "" {

0 commit comments

Comments
 (0)