mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Svc REST: Add proof funcs in feature test logic
Allows for more control of tests to assert specific things.
This commit is contained in:
parent
8bcba526b6
commit
ced629e657
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user