From 1f48cd27e7b3e2fdc63f90789e0700227ae3a832 Mon Sep 17 00:00:00 2001 From: Oleg Shaldybin Date: Wed, 1 Jun 2016 18:49:39 -0700 Subject: [PATCH] Expect namespace deletion in NamespaceController Using new fake clientset registry exposes the actual flow on pending namespace finalization: get namespace, create finalizer, list pods and delete namespace if there are no pods. --- pkg/client/testing/core/fixture.go | 2 +- pkg/controller/namespace/namespace_controller_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/testing/core/fixture.go b/pkg/client/testing/core/fixture.go index 609def7970b..96472bcbbe3 100644 --- a/pkg/client/testing/core/fixture.go +++ b/pkg/client/testing/core/fixture.go @@ -82,7 +82,7 @@ func ObjectReaction(tracker ObjectTracker, mapper meta.RESTMapper) ReactionFunc } // Here and below we need to switch on implementation types, - // no on interfaces, as some interfaces are identical + // not on interfaces, as some interfaces are identical // (e.g. UpdateAction and CreateAction), so if we use them, // updates and creates end up matching the same case branch. switch action := action.(type) { diff --git a/pkg/controller/namespace/namespace_controller_test.go b/pkg/controller/namespace/namespace_controller_test.go index f03a59d7130..9c5b77d8efe 100644 --- a/pkg/controller/namespace/namespace_controller_test.go +++ b/pkg/controller/namespace/namespace_controller_test.go @@ -133,8 +133,9 @@ func testSyncNamespaceThatIsTerminating(t *testing.T, versions *unversioned.APIV testNamespace: testNamespacePendingFinalize, kubeClientActionSet: sets.NewString( strings.Join([]string{"get", "namespaces", ""}, "-"), - strings.Join([]string{"list", "pods", ""}, "-"), strings.Join([]string{"create", "namespaces", "finalize"}, "-"), + strings.Join([]string{"list", "pods", ""}, "-"), + strings.Join([]string{"delete", "namespaces", ""}, "-"), ), dynamicClientActionSet: dynamicClientActionSet, },