From aea90a2324c2bf7ffe2c06f3c5426f94f09977f5 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sat, 14 Aug 2021 10:54:23 -0700 Subject: [PATCH] Svc REST: add a beforeUpdate hook in feature tests --- pkg/registry/core/service/storage/storage_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/registry/core/service/storage/storage_test.go b/pkg/registry/core/service/storage/storage_test.go index 79dfeab5cfb..9a4a858e74a 100644 --- a/pkg/registry/core/service/storage/storage_test.go +++ b/pkg/registry/core/service/storage/storage_test.go @@ -5991,9 +5991,10 @@ func proveHealthCheckNodePortDeallocated(t *testing.T, storage *GenericREST, bef } type cudTestCase struct { - name string - create svcTestCase - update svcTestCase + name string + create svcTestCase + beforeUpdate func(t *testing.T, storage *GenericREST) + update svcTestCase } func helpTestCreateUpdateDelete(t *testing.T, testCases []cudTestCase) { @@ -6029,6 +6030,11 @@ func helpTestCreateUpdateDelete(t *testing.T, testCases []cudTestCase) { } verifyExpectations(t, storage, tc.create, tc.create.svc, createdSvc) + // Allow callers to do something between create and update. + if tc.beforeUpdate != nil { + tc.beforeUpdate(t, storage) + } + // Update the object to the new state and check the results. obj, created, err := storage.Update(ctx, tc.update.svc.Name, rest.DefaultUpdatedObjectInfo(tc.update.svc), rest.ValidateAllObjectFunc,