Merge pull request #12146 from deads2k/tweak-testclient

make testclient more precise
This commit is contained in:
Alex Mohr
2015-08-04 14:49:11 -07:00
33 changed files with 1004 additions and 401 deletions

View File

@@ -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)

View File

@@ -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")
}
}