endpoints: fix admission test types
Kubernetes-commit: 420f010f8798a8938ff4332ca53bbac8a8e09c01
This commit is contained in:
parent
afb204836b
commit
fc05a0cd5b
|
|
@ -38,6 +38,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
restful "github.com/emicklei/go-restful"
|
restful "github.com/emicklei/go-restful"
|
||||||
|
|
||||||
fuzzer "k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
|
fuzzer "k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
|
@ -85,6 +86,8 @@ func (alwaysMutatingDeny) Handles(operation admission.Operation) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ admission.MutationInterface = &alwaysMutatingDeny{}
|
||||||
|
|
||||||
type alwaysValidatingDeny struct{}
|
type alwaysValidatingDeny struct{}
|
||||||
|
|
||||||
func (alwaysValidatingDeny) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) (err error) {
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ admission.ValidationInterface = &alwaysValidatingDeny{}
|
||||||
|
|
||||||
// This creates fake API versions, similar to api/latest.go.
|
// This creates fake API versions, similar to api/latest.go.
|
||||||
var testAPIGroup = "test.group"
|
var testAPIGroup = "test.group"
|
||||||
var testAPIGroup2 = "test.group2"
|
var testAPIGroup2 = "test.group2"
|
||||||
|
|
@ -3752,7 +3757,7 @@ type namePopulatorAdmissionControl struct {
|
||||||
populateName string
|
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 {
|
if a.GetName() != npac.populateName {
|
||||||
npac.t.Errorf("Unexpected name: got %q, expected %q", 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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ admission.ValidationInterface = &namePopulatorAdmissionControl{}
|
||||||
|
|
||||||
func TestNamedCreaterWithGenerateName(t *testing.T) {
|
func TestNamedCreaterWithGenerateName(t *testing.T) {
|
||||||
populateName := "bar"
|
populateName := "bar"
|
||||||
storage := &SimpleRESTStorage{
|
storage := &SimpleRESTStorage{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue