From 9be6c5ab092beaccb644bd6774c1cd7527f46638 Mon Sep 17 00:00:00 2001 From: Michail Kargakis Date: Mon, 4 Jul 2016 19:10:04 +0200 Subject: [PATCH] deploy: move cli-related packages in cmd --- pkg/cmd/infra/deployer/deployer_test.go | 6 +++--- pkg/cmd/util/clientcmd/factory.go | 6 ++---- pkg/deploy/{reaper => cmd}/reaper.go | 3 +-- pkg/deploy/{reaper => cmd}/reaper_test.go | 2 +- pkg/deploy/{scaler => cmd}/scale.go | 3 +-- pkg/deploy/{scaler => cmd}/scale_test.go | 2 +- pkg/deploy/{scaler => cmd}/test/support.go | 0 pkg/deploy/reaper/doc.go | 2 -- pkg/deploy/scaler/doc.go | 2 -- pkg/deploy/strategy/recreate/recreate_test.go | 20 +++++++++---------- 10 files changed, 19 insertions(+), 27 deletions(-) rename pkg/deploy/{reaper => cmd}/reaper.go (98%) rename pkg/deploy/{reaper => cmd}/reaper_test.go (99%) rename pkg/deploy/{scaler => cmd}/scale.go (98%) rename pkg/deploy/{scaler => cmd}/scale_test.go (99%) rename pkg/deploy/{scaler => cmd}/test/support.go (100%) delete mode 100644 pkg/deploy/reaper/doc.go delete mode 100644 pkg/deploy/scaler/doc.go diff --git a/pkg/cmd/infra/deployer/deployer_test.go b/pkg/cmd/infra/deployer/deployer_test.go index 92a060e08e1d..5ec22976763a 100644 --- a/pkg/cmd/infra/deployer/deployer_test.go +++ b/pkg/cmd/infra/deployer/deployer_test.go @@ -11,7 +11,7 @@ import ( deployapi "github.com/openshift/origin/pkg/deploy/api" deploytest "github.com/openshift/origin/pkg/deploy/api/test" deployv1 "github.com/openshift/origin/pkg/deploy/api/v1" - scalertest "github.com/openshift/origin/pkg/deploy/scaler/test" + cmdtest "github.com/openshift/origin/pkg/deploy/cmd/test" "github.com/openshift/origin/pkg/deploy/strategy" deployutil "github.com/openshift/origin/pkg/deploy/util" @@ -33,7 +33,7 @@ func TestDeployer_getDeploymentFail(t *testing.T) { t.Fatal("unexpected call") return nil, nil }, - scaler: &scalertest.FakeScaler{}, + scaler: &cmdtest.FakeScaler{}, } err := deployer.Deploy("namespace", "name") @@ -134,7 +134,7 @@ func TestDeployer_deployScenarios(t *testing.T) { var actualFrom, actualTo *kapi.ReplicationController var actualDesired int32 to := findDeployment(s.toVersion) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} deployer := &Deployer{ out: &bytes.Buffer{}, diff --git a/pkg/cmd/util/clientcmd/factory.go b/pkg/cmd/util/clientcmd/factory.go index 04c7e182aa95..edcb37a3cb7c 100644 --- a/pkg/cmd/util/clientcmd/factory.go +++ b/pkg/cmd/util/clientcmd/factory.go @@ -50,8 +50,6 @@ import ( deployapi "github.com/openshift/origin/pkg/deploy/api" deploycmd "github.com/openshift/origin/pkg/deploy/cmd" deploygen "github.com/openshift/origin/pkg/deploy/generator" - deployreaper "github.com/openshift/origin/pkg/deploy/reaper" - deployscaler "github.com/openshift/origin/pkg/deploy/scaler" deployutil "github.com/openshift/origin/pkg/deploy/util" imageapi "github.com/openshift/origin/pkg/image/api" routegen "github.com/openshift/origin/pkg/route/generator" @@ -258,7 +256,7 @@ func NewFactory(clientConfig kclientcmd.ClientConfig) *Factory { } if mapping.GroupVersionKind.GroupKind() == deployapi.Kind("DeploymentConfig") { - return deployscaler.NewDeploymentConfigScaler(oc, kc), nil + return deploycmd.NewDeploymentConfigScaler(oc, kc), nil } return kScalerFunc(mapping) } @@ -271,7 +269,7 @@ func NewFactory(clientConfig kclientcmd.ClientConfig) *Factory { switch mapping.GroupVersionKind.GroupKind() { case deployapi.Kind("DeploymentConfig"): - return deployreaper.NewDeploymentConfigReaper(oc, kc), nil + return deploycmd.NewDeploymentConfigReaper(oc, kc), nil case authorizationapi.Kind("Role"): return authorizationreaper.NewRoleReaper(oc, oc), nil case authorizationapi.Kind("ClusterRole"): diff --git a/pkg/deploy/reaper/reaper.go b/pkg/deploy/cmd/reaper.go similarity index 98% rename from pkg/deploy/reaper/reaper.go rename to pkg/deploy/cmd/reaper.go index 676e6e0e442b..eb6c23cb9421 100644 --- a/pkg/deploy/reaper/reaper.go +++ b/pkg/deploy/cmd/reaper.go @@ -1,5 +1,4 @@ -// TODO: Move to pkg/deploy/cmd -package reaper +package cmd import ( "time" diff --git a/pkg/deploy/reaper/reaper_test.go b/pkg/deploy/cmd/reaper_test.go similarity index 99% rename from pkg/deploy/reaper/reaper_test.go rename to pkg/deploy/cmd/reaper_test.go index 59c6621f378b..d146764b4d1f 100644 --- a/pkg/deploy/reaper/reaper_test.go +++ b/pkg/deploy/cmd/reaper_test.go @@ -1,4 +1,4 @@ -package reaper +package cmd import ( "reflect" diff --git a/pkg/deploy/scaler/scale.go b/pkg/deploy/cmd/scale.go similarity index 98% rename from pkg/deploy/scaler/scale.go rename to pkg/deploy/cmd/scale.go index f1ca8bd51ae9..12ad4b05ab47 100644 --- a/pkg/deploy/scaler/scale.go +++ b/pkg/deploy/cmd/scale.go @@ -1,5 +1,4 @@ -// TODO: Move to pkg/deploy/cmd -package scaler +package cmd import ( "fmt" diff --git a/pkg/deploy/scaler/scale_test.go b/pkg/deploy/cmd/scale_test.go similarity index 99% rename from pkg/deploy/scaler/scale_test.go rename to pkg/deploy/cmd/scale_test.go index 70b2e6603351..a3e3ed2e4772 100644 --- a/pkg/deploy/scaler/scale_test.go +++ b/pkg/deploy/cmd/scale_test.go @@ -1,4 +1,4 @@ -package scaler +package cmd import ( "testing" diff --git a/pkg/deploy/scaler/test/support.go b/pkg/deploy/cmd/test/support.go similarity index 100% rename from pkg/deploy/scaler/test/support.go rename to pkg/deploy/cmd/test/support.go diff --git a/pkg/deploy/reaper/doc.go b/pkg/deploy/reaper/doc.go deleted file mode 100644 index 7c935ca8476a..000000000000 --- a/pkg/deploy/reaper/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package reaper implements the Reaper interface for deploymentConfigs -package reaper diff --git a/pkg/deploy/scaler/doc.go b/pkg/deploy/scaler/doc.go deleted file mode 100644 index e3dadba3bc70..000000000000 --- a/pkg/deploy/scaler/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package scaler implements the kubectl.Scaler interface for deploymentConfigs -package scaler diff --git a/pkg/deploy/strategy/recreate/recreate_test.go b/pkg/deploy/strategy/recreate/recreate_test.go index c1cc5ed05511..991776ddbbc2 100644 --- a/pkg/deploy/strategy/recreate/recreate_test.go +++ b/pkg/deploy/strategy/recreate/recreate_test.go @@ -12,7 +12,7 @@ import ( deployapi "github.com/openshift/origin/pkg/deploy/api" deploytest "github.com/openshift/origin/pkg/deploy/api/test" deployv1 "github.com/openshift/origin/pkg/deploy/api/v1" - scalertest "github.com/openshift/origin/pkg/deploy/scaler/test" + cmdtest "github.com/openshift/origin/pkg/deploy/cmd/test" "github.com/openshift/origin/pkg/deploy/strategy" deployutil "github.com/openshift/origin/pkg/deploy/util" @@ -21,7 +21,7 @@ import ( func TestRecreate_initialDeployment(t *testing.T) { var deployment *kapi.ReplicationController - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{}, errOut: &bytes.Buffer{}, @@ -55,7 +55,7 @@ func TestRecreate_deploymentPreHookSuccess(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, deployapi.LifecycleHookFailurePolicyAbort, "", "") deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(registered.GroupOrDie(kapi.GroupName).GroupVersions[0])) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} hookExecuted := false strategy := &RecreateDeploymentStrategy{ @@ -90,7 +90,7 @@ func TestRecreate_deploymentPreHookFail(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, deployapi.LifecycleHookFailurePolicyAbort, "", "") deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(registered.GroupOrDie(kapi.GroupName).GroupVersions[0])) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{}, @@ -123,7 +123,7 @@ func TestRecreate_deploymentMidHookSuccess(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, "", deployapi.LifecycleHookFailurePolicyAbort, "") deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(deployv1.SchemeGroupVersion)) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} hookExecuted := false strategy := &RecreateDeploymentStrategy{ @@ -158,7 +158,7 @@ func TestRecreate_deploymentMidHookFail(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, "", deployapi.LifecycleHookFailurePolicyAbort, "") deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(deployv1.SchemeGroupVersion)) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{}, @@ -190,7 +190,7 @@ func TestRecreate_deploymentPostHookSuccess(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, "", "", deployapi.LifecycleHookFailurePolicyAbort) deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(registered.GroupOrDie(kapi.GroupName).GroupVersions[0])) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} hookExecuted := false strategy := &RecreateDeploymentStrategy{ @@ -225,7 +225,7 @@ func TestRecreate_deploymentPostHookFail(t *testing.T) { config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, "", "", deployapi.LifecycleHookFailurePolicyAbort) deployment, _ := deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(registered.GroupOrDie(kapi.GroupName).GroupVersions[0])) - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} hookExecuted := false strategy := &RecreateDeploymentStrategy{ @@ -258,7 +258,7 @@ func TestRecreate_deploymentPostHookFail(t *testing.T) { func TestRecreate_acceptorSuccess(t *testing.T) { var deployment *kapi.ReplicationController - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{}, @@ -304,7 +304,7 @@ func TestRecreate_acceptorSuccess(t *testing.T) { func TestRecreate_acceptorFail(t *testing.T) { var deployment *kapi.ReplicationController - scaler := &scalertest.FakeScaler{} + scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{},