|
4 | 4 | package annotations |
5 | 5 |
|
6 | 6 | import ( |
7 | | - "reflect" |
8 | 7 | "testing" |
9 | 8 | "time" |
10 | 9 |
|
| 10 | + "github.com/stretchr/testify/assert" |
11 | 11 | networkingv1 "k8s.io/api/networking/v1" |
12 | 12 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
13 | 13 | "k8s.io/utils/ptr" |
@@ -130,9 +130,7 @@ func TestGetAnnotationServiceExternalTrafficPolicy(t *testing.T) { |
130 | 130 | t.Errorf("GetAnnotationServiceExternalTrafficPolicy() error = %v, wantErr %v", err, tt.wantErr) |
131 | 131 | return |
132 | 132 | } |
133 | | - if !reflect.DeepEqual(got, tt.want) { |
134 | | - t.Errorf("GetAnnotationServiceExternalTrafficPolicy() got = %v, want %v", got, tt.want) |
135 | | - } |
| 133 | + assert.Equal(t, tt.want, got) |
136 | 134 | }) |
137 | 135 | } |
138 | 136 | } |
@@ -192,9 +190,7 @@ func TestGetAnnotationRequestTimeout(t *testing.T) { |
192 | 190 | return |
193 | 191 | } |
194 | 192 |
|
195 | | - if !reflect.DeepEqual(got, tt.want) { |
196 | | - t.Errorf("GetAnnotationRequestTimeout() got = %v, want %v", got, tt.want) |
197 | | - } |
| 193 | + assert.Equal(t, tt.want, got) |
198 | 194 | }) |
199 | 195 | } |
200 | 196 | } |
@@ -252,9 +248,7 @@ func TestGetAnnotationSecureNodePort(t *testing.T) { |
252 | 248 | t.Errorf("GetAnnotationSecureNodePort() error = %v, wantErr %v", err, tt.wantErr) |
253 | 249 | return |
254 | 250 | } |
255 | | - if !reflect.DeepEqual(got, tt.want) { |
256 | | - t.Errorf("GetAnnotationSecureNodePort() got = %v, want %v", got, tt.want) |
257 | | - } |
| 251 | + assert.Equal(t, tt.want, got) |
258 | 252 | }) |
259 | 253 | } |
260 | 254 | } |
@@ -311,9 +305,7 @@ func TestGetAnnotationInsecureNodePort(t *testing.T) { |
311 | 305 | t.Errorf("GetAnnotationSecureNodePort() error = %v, wantErr %v", err, tt.wantErr) |
312 | 306 | return |
313 | 307 | } |
314 | | - if !reflect.DeepEqual(got, tt.want) { |
315 | | - t.Errorf("GetAnnotationSecureNodePort() got = %v, want %v", got, tt.want) |
316 | | - } |
| 308 | + assert.Equal(t, tt.want, got) |
317 | 309 | }) |
318 | 310 | } |
319 | 311 | } |
@@ -371,9 +363,7 @@ func TestGetAnnotationHostListenerPort(t *testing.T) { |
371 | 363 | t.Errorf("GetAnnotationHostListenerPort() error = %v, wantErr %v", err, tt.wantErr) |
372 | 364 | return |
373 | 365 | } |
374 | | - if !reflect.DeepEqual(got, tt.want) { |
375 | | - t.Errorf("GetAnnotationHostListenerPort() got = %v, want %v", got, tt.want) |
376 | | - } |
| 366 | + assert.Equal(t, tt.want, got) |
377 | 367 | }) |
378 | 368 | } |
379 | 369 | } |
@@ -464,9 +454,7 @@ func TestGetAnnotationSSLPassthrough(t *testing.T) { |
464 | 454 | t.Run(tt.name, func(t *testing.T) { |
465 | 455 | got := GetAnnotationTLSPassthroughEnabled(tt.args.ingress) |
466 | 456 |
|
467 | | - if !reflect.DeepEqual(got, tt.want) { |
468 | | - t.Errorf("GetAnnotationSecureNodePort() got = %v, want %v", got, tt.want) |
469 | | - } |
| 457 | + assert.Equal(t, tt.want, got) |
470 | 458 | }) |
471 | 459 | } |
472 | 460 | } |
@@ -557,9 +545,7 @@ func TestGetAnnotationEnforceHTTPSEnabled(t *testing.T) { |
557 | 545 | for _, tt := range tests { |
558 | 546 | t.Run(tt.name, func(t *testing.T) { |
559 | 547 | got := GetAnnotationForceHTTPSEnabled(tt.args.ingress) |
560 | | - if !reflect.DeepEqual(got, tt.want) { |
561 | | - t.Errorf("GetAnnotationForceHTTPSEnabled() got = %v, want %v", got, tt.want) |
562 | | - } |
| 548 | + assert.Equal(t, tt.want, got) |
563 | 549 | }) |
564 | 550 | } |
565 | 551 | } |
|
0 commit comments