Svc REST: Add proof funcs in feature test logic

Allows for more control of tests to assert specific things.
This commit is contained in:
Tim Hockin 2021-08-14 10:49:17 -07:00
parent 8bcba526b6
commit ced629e657

View File

@ -5826,8 +5826,13 @@ type svcTestCase struct {
expectHeadless bool expectHeadless bool
expectNodePorts bool expectNodePorts bool
expectHealthCheckNodePort bool expectHealthCheckNodePort bool
// Additional proofs, provided by the tests which use this.
prove []svcTestProof
} }
type svcTestProof func(t *testing.T, storage *GenericREST, before, after *api.Service)
func callName(before, after *api.Service) string { func callName(before, after *api.Service) string {
if before == nil && after != nil { if before == nil && after != nil {
return "create" return "create"
@ -6287,6 +6292,10 @@ func verifyExpectations(t *testing.T, storage *GenericREST, tc svcTestCase, befo
} else { } else {
proveHealthCheckNodePortDeallocated(t, storage, before, after) proveHealthCheckNodePortDeallocated(t, storage, before, after)
} }
for _, p := range tc.prove {
p(t, storage, before, after)
}
} }
func TestFeatureExternalName(t *testing.T) { func TestFeatureExternalName(t *testing.T) {