Add tests to ensure resthandler invokes admission control

This commit is contained in:
derekwaynecarr
2015-01-06 15:16:13 -05:00
parent 74d2ee69eb
commit 5ceffe2625
3 changed files with 94 additions and 3 deletions

View File

@@ -18,8 +18,10 @@ package deny
import (
"errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/admission"
"io"
"github.com/GoogleCloudPlatform/kubernetes/pkg/admission"
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
)
func init() {
@@ -31,7 +33,7 @@ func init() {
type alwaysDeny struct{}
func (alwaysDeny) Admit(a admission.Attributes) (err error) {
return errors.New("You shall not pass!")
return apierrors.NewConflict(a.GetKind(), "", errors.New("No changes allowed"))
}
func NewAlwaysDeny() admission.Interface {