mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
endpoints: fix admission test types
This commit is contained in:
parent
533daf6624
commit
420f010f87
@ -38,6 +38,7 @@ import (
|
||||
"time"
|
||||
|
||||
restful "github.com/emicklei/go-restful"
|
||||
|
||||
fuzzer "k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
@ -85,6 +86,8 @@ func (alwaysMutatingDeny) Handles(operation admission.Operation) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var _ admission.MutationInterface = &alwaysMutatingDeny{}
|
||||
|
||||
type alwaysValidatingDeny struct{}
|
||||
|
||||
func (alwaysValidatingDeny) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) (err error) {
|
||||
@ -95,6 +98,8 @@ func (alwaysValidatingDeny) Handles(operation admission.Operation) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
var _ admission.ValidationInterface = &alwaysValidatingDeny{}
|
||||
|
||||
// This creates fake API versions, similar to api/latest.go.
|
||||
var testAPIGroup = "test.group"
|
||||
var testAPIGroup2 = "test.group2"
|
||||
@ -3752,7 +3757,7 @@ type namePopulatorAdmissionControl struct {
|
||||
populateName string
|
||||
}
|
||||
|
||||
func (npac *namePopulatorAdmissionControl) Validate(a admission.Attributes, o admission.ObjectInterfaces) (err error) {
|
||||
func (npac *namePopulatorAdmissionControl) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) (err error) {
|
||||
if a.GetName() != npac.populateName {
|
||||
npac.t.Errorf("Unexpected name: got %q, expected %q", a.GetName(), npac.populateName)
|
||||
}
|
||||
@ -3763,6 +3768,8 @@ func (npac *namePopulatorAdmissionControl) Handles(operation admission.Operation
|
||||
return true
|
||||
}
|
||||
|
||||
var _ admission.ValidationInterface = &namePopulatorAdmissionControl{}
|
||||
|
||||
func TestNamedCreaterWithGenerateName(t *testing.T) {
|
||||
populateName := "bar"
|
||||
storage := &SimpleRESTStorage{
|
||||
|
Loading…
Reference in New Issue
Block a user