@@ -20,11 +20,11 @@ import (
20
20
"context"
21
21
"fmt"
22
22
"path/filepath"
23
- "reflect"
24
23
"sync"
25
24
"testing"
26
25
"time"
27
26
27
+ "github.com/google/go-cmp/cmp"
28
28
"github.com/onsi/gomega"
29
29
appsv1 "k8s.io/api/apps/v1"
30
30
batchv1 "k8s.io/api/batch/v1"
@@ -541,8 +541,10 @@ func TestGetMetricsCollectorArgs(t *testing.T) {
541
541
t .Errorf ("Case: %v failed. Expected nil, got %v" , tc .Name , err )
542
542
} else if tc .Err && err == nil {
543
543
t .Errorf ("Case: %v failed. Expected err, got nil" , tc .Name )
544
- } else if ! tc .Err && ! reflect .DeepEqual (tc .ExpectedArgs , args ) {
545
- t .Errorf ("Case %v failed. ExpectedArgs: %v, got %v" , tc .Name , tc .ExpectedArgs , args )
544
+ } else if ! tc .Err {
545
+ if diff := cmp .Diff (tc .ExpectedArgs , args ); diff != "" {
546
+ t .Errorf ("Case %v failed. Diff (-expected, +got): %v" , tc .Name , diff )
547
+ }
546
548
}
547
549
}
548
550
}
@@ -1061,8 +1063,8 @@ func TestMutatePodMetadata(t *testing.T) {
1061
1063
1062
1064
for _ , tc := range testCases {
1063
1065
mutatePodMetadata (tc .pod , tc .trial )
1064
- if ! reflect . DeepEqual (tc .mutatedPod , tc .pod ) {
1065
- t .Errorf ("Case %v. Expected Pod %v, got %v" , tc .testDescription , tc . mutatedPod , tc . pod )
1066
+ if diff := cmp . Diff (tc .mutatedPod , tc .pod ); diff != "" {
1067
+ t .Errorf ("Case %v failed. Diff (-expected, + got): %v" , tc .testDescription , diff )
1066
1068
}
1067
1069
}
1068
1070
}
0 commit comments