From 2eb3f4c48dcde869214440f7a15e2d9ffd22286b Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Thu, 11 Apr 2019 12:38:49 +0200 Subject: [PATCH] Remove TODO --- cluster/kubernetes/policies_test.go | 3 +-- release/releaser_test.go | 5 ++--- resourcestore/checkoutmanager.go | 1 - resourcestore/configfilemanager_test.go | 3 +-- test/common.go | 12 ------------ 5 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 test/common.go diff --git a/cluster/kubernetes/policies_test.go b/cluster/kubernetes/policies_test.go index cf8c7ad578..66ea56629d 100644 --- a/cluster/kubernetes/policies_test.go +++ b/cluster/kubernetes/policies_test.go @@ -9,7 +9,6 @@ import ( "github.com/weaveworks/flux" "github.com/weaveworks/flux/policy" - "github.com/weaveworks/flux/test" ) func TestUpdatePolicies(t *testing.T) { @@ -180,7 +179,7 @@ func TestUpdatePolicies(t *testing.T) { caseIn := templToString(t, annotationsTemplate, c.in) caseOut := templToString(t, annotationsTemplate, c.out) resourceID := flux.MustParseResourceID("default:deployment/nginx") - out, err := (&Manifests{test.ConstNamespacer("default")}).UpdateWorkloadPolicies([]byte(caseIn), resourceID, c.update) + out, err := (&Manifests{ConstNamespacer("default")}).UpdateWorkloadPolicies([]byte(caseIn), resourceID, c.update) assert.Equal(t, c.wantErr, err != nil, "unexpected error value: %s", err) if !c.wantErr { assert.Equal(t, string(out), caseOut) diff --git a/release/releaser_test.go b/release/releaser_test.go index a85666dd18..a85741fb07 100644 --- a/release/releaser_test.go +++ b/release/releaser_test.go @@ -21,7 +21,6 @@ import ( registryMock "github.com/weaveworks/flux/registry/mock" "github.com/weaveworks/flux/resource" "github.com/weaveworks/flux/resourcestore" - "github.com/weaveworks/flux/test" "github.com/weaveworks/flux/update" ) @@ -139,7 +138,7 @@ var ( }, }, } - mockManifests = &kubernetes.Manifests{Namespacer: test.ConstNamespacer("default")} + mockManifests = &kubernetes.Manifests{Namespacer: kubernetes.ConstNamespacer("default")} ) func mockCluster(running ...cluster.Workload) *cluster.Mock { @@ -1085,7 +1084,7 @@ func Test_BadRelease(t *testing.T) { checkout2, cleanup2 := setup(t) defer cleanup2() - manifests := &badManifests{Manifests: kubernetes.Manifests{test.ConstNamespacer("default")}} + manifests := &badManifests{Manifests: kubernetes.Manifests{kubernetes.ConstNamespacer("default")}} ctx = &ReleaseContext{ cluster: mCluster, resourceStore: NewCheckoutManagerOrFail(t, manifests, checkout2), diff --git a/resourcestore/checkoutmanager.go b/resourcestore/checkoutmanager.go index b463ed927d..d3b48c8d84 100644 --- a/resourcestore/checkoutmanager.go +++ b/resourcestore/checkoutmanager.go @@ -26,7 +26,6 @@ type checkoutManager struct { policyTranslator cluster.PolicyTranslator resourceStores []updatableResourceStore cache *resourceMaps - // TODO(fons): Do we really need locking? Can the checkout be shared across threads? sync.RWMutex } diff --git a/resourcestore/configfilemanager_test.go b/resourcestore/configfilemanager_test.go index 91b981eee8..4a567a62a4 100644 --- a/resourcestore/configfilemanager_test.go +++ b/resourcestore/configfilemanager_test.go @@ -12,7 +12,6 @@ import ( "github.com/weaveworks/flux/cluster/kubernetes" "github.com/weaveworks/flux/image" "github.com/weaveworks/flux/policy" - "github.com/weaveworks/flux/test" ) const deploymentConfigFile = `--- @@ -40,7 +39,7 @@ updaters: ` func TestConfigFileManager(t *testing.T) { - mockManifests := &kubernetes.Manifests{test.ConstNamespacer("default")} + mockManifests := &kubernetes.Manifests{kubernetes.ConstNamespacer("default")} var cf ConfigFile err := yaml.Unmarshal([]byte(deploymentConfigFile), &cf) cf.RootDirectory = os.TempDir() diff --git a/test/common.go b/test/common.go deleted file mode 100644 index 649feea5b0..0000000000 --- a/test/common.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -import ( - "github.com/weaveworks/flux/cluster/kubernetes" - kresource "github.com/weaveworks/flux/cluster/kubernetes/resource" -) - -type ConstNamespacer string - -func (ns ConstNamespacer) EffectiveNamespace(manifest kresource.KubeManifest, _ kubernetes.ResourceScopes) (string, error) { - return string(ns), nil -}