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

@@ -19,6 +19,7 @@ package admission
import (
"errors"
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
@@ -30,7 +31,7 @@ type stubAdmissionController struct {
func (ac *stubAdmissionController) AdmissionControl(operation, kind, namespace string, object runtime.Object) (err error) {
if !ac.admit {
err = errors.New("No changes allowed")
err = apierrors.NewConflict(kind, "name", errors.New("No changes allowed"))
}
return err
}