Skip to content

Commit bdb99c8

Browse files
authored
Merge pull request kubernetes#93906 from aojea/flakeSvc
Deflake TestServiceRegistryUpdateDryRun test
2 parents a690a36 + b276b47 commit bdb99c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/registry/core/service/storage/rest_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,10 +1182,10 @@ func TestServiceRegistryUpdateDryRun(t *testing.T) {
11821182
}},
11831183
},
11841184
}, rest.ValidateAllObjectFunc, &metav1.CreateOptions{})
1185-
svc := obj.(*api.Service)
11861185
if err != nil {
11871186
t.Fatalf("Expected no error: %v", err)
11881187
}
1188+
svc := obj.(*api.Service)
11891189

11901190
// Test dry run update request external name to node port
11911191
updatedSvc, created, err := storage.Update(ctx, svc.Name, rest.DefaultUpdatedObjectInfo(&api.Service{
@@ -1251,6 +1251,7 @@ func TestServiceRegistryUpdateDryRun(t *testing.T) {
12511251
Selector: map[string]string{"bar": "baz"},
12521252
SessionAffinity: api.ServiceAffinityNone,
12531253
Type: api.ServiceTypeNodePort,
1254+
ClusterIP: "1.2.3.5",
12541255
Ports: []api.ServicePort{{
12551256
NodePort: 30020,
12561257
Port: 6502,
@@ -1259,10 +1260,11 @@ func TestServiceRegistryUpdateDryRun(t *testing.T) {
12591260
}},
12601261
},
12611262
}, rest.ValidateAllObjectFunc, &metav1.CreateOptions{})
1262-
svc = obj.(*api.Service)
12631263
if err != nil {
12641264
t.Fatalf("Expected no error: %v", err)
12651265
}
1266+
svc = obj.(*api.Service)
1267+
12661268
_, _, err = storage.Update(ctx, svc.Name, rest.DefaultUpdatedObjectInfo(&api.Service{
12671269
ObjectMeta: metav1.ObjectMeta{
12681270
Name: svc.Name,
@@ -1301,10 +1303,10 @@ func TestServiceRegistryUpdateDryRun(t *testing.T) {
13011303
}},
13021304
},
13031305
}, rest.ValidateAllObjectFunc, &metav1.CreateOptions{})
1304-
svc = obj.(*api.Service)
13051306
if err != nil {
13061307
t.Fatalf("Expected no error: %v", err)
13071308
}
1309+
svc = obj.(*api.Service)
13081310
_, _, err = storage.Update(ctx, svc.Name, rest.DefaultUpdatedObjectInfo(&api.Service{
13091311
ObjectMeta: metav1.ObjectMeta{
13101312
Name: svc.Name,

0 commit comments

Comments
 (0)