Merge pull request #12146 from deads2k/tweak-testclient
make testclient more precise
This commit is contained in:
@@ -37,8 +37,8 @@ func TestAdmissionDeny(t *testing.T) {
|
||||
|
||||
func testAdmission(t *testing.T, pod *api.Pod, shouldAccept bool) {
|
||||
mockClient := &testclient.Fake{
|
||||
ReactFn: func(action testclient.FakeAction) (runtime.Object, error) {
|
||||
if action.Action == "get-pod" && action.Value.(string) == pod.Name {
|
||||
ReactFn: func(action testclient.Action) (runtime.Object, error) {
|
||||
if action.Matches("get", "pods") && action.(testclient.GetAction).GetName() == pod.Name {
|
||||
return pod, nil
|
||||
}
|
||||
t.Errorf("Unexpected API call: %#v", action)
|
||||
|
@@ -49,7 +49,7 @@ func TestAdmission(t *testing.T) {
|
||||
if len(actions) != 1 {
|
||||
t.Errorf("Expected a create-namespace request")
|
||||
}
|
||||
if actions[0].Action != "create-namespace" {
|
||||
if !actions[0].Matches("create", "namespaces") {
|
||||
t.Errorf("Expected a create-namespace request to be made via the client")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user