Svc REST: add a beforeUpdate hook in feature tests

This commit is contained in:
Tim Hockin 2021-08-14 10:54:23 -07:00
parent ced629e657
commit aea90a2324

View File

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