Skip to content

Commit 5ed676f

Browse files
committed
Feedback
1 parent 9ba897a commit 5ed676f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

pkg/multicluster/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ type fakeCluster struct {
7878
cluster.Cluster
7979
fakeClient client.Client
8080
fakeCache *fakeCache
81-
fakeRecorder *fakeEventRecorder
81+
fakeRecorder events.EventRecorder
8282
}
8383

8484
func (f *fakeCluster) GetClient() client.Client {

pkg/multicluster/recorder_test.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,16 @@ func TestMultiClusterRecorder_MultipleRemotes(t *testing.T) {
171171
}
172172
recorder.Eventf(res, nil, corev1.EventTypeWarning, "SchedulingFailed", "FailedScheduling", "no host found")
173173

174-
if len(remoteARecorder.getCalls()) != 0 {
175-
t.Errorf("expected 0 calls to remote-a, got %d", len(remoteARecorder.getCalls()))
174+
remoteCallsA := remoteARecorder.getCalls()
175+
if len(remoteCallsA) != 0 {
176+
t.Errorf("expected 0 calls to remote-a, got %d", len(remoteCallsA))
176177
}
177-
if len(remoteBRecorder.getCalls()) != 1 {
178-
t.Fatalf("expected 1 call to remote-b, got %d", len(remoteBRecorder.getCalls()))
178+
remoteCallsB := remoteBRecorder.getCalls()
179+
if len(remoteCallsB) != 1 {
180+
t.Fatalf("expected 1 call to remote-b, got %d", len(remoteCallsB))
179181
}
180-
if remoteBRecorder.getCalls()[0].reason != "SchedulingFailed" {
181-
t.Errorf("expected reason %q, got %q", "SchedulingFailed", remoteBRecorder.getCalls()[0].reason)
182+
if remoteCallsB[0].reason != "SchedulingFailed" {
183+
t.Errorf("expected reason %q, got %q", "SchedulingFailed", remoteCallsB[0].reason)
182184
}
183185
}
184186

@@ -250,7 +252,8 @@ func TestMultiClusterRecorder_ConcurrentEventf(t *testing.T) {
250252
}
251253
wg.Wait()
252254

253-
if len(homeRecorder.getCalls()) != goroutines {
254-
t.Errorf("expected %d calls, got %d", goroutines, len(homeRecorder.getCalls()))
255+
homeCalls := homeRecorder.getCalls()
256+
if len(homeCalls) != goroutines {
257+
t.Errorf("expected %d calls, got %d", goroutines, len(homeCalls))
255258
}
256259
}

0 commit comments

Comments
 (0)