@@ -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