From d459e82f6b080b4ca4b3f74dab4e6526dff8c145 Mon Sep 17 00:00:00 2001 From: haoqing0110 Date: Wed, 13 Mar 2024 09:46:43 +0000 Subject: [PATCH] remove install strategy and annotation in testing case Signed-off-by: haoqing0110 --- .../managementaddon/controller_test.go | 14 ++++++------- pkg/addon/templateagent/template_agent.go | 4 ++-- test/integration/addon/addon_configs_test.go | 6 +++--- .../addon/addon_manager_install_test.go | 6 +++--- .../addon/addon_manager_upgrade_test.go | 6 +++--- test/integration/addon/agent_deploy_test.go | 10 +++++----- test/integration/addon/assertion_test.go | 6 +++--- test/integration/addon/suite_test.go | 20 +++++++++---------- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/pkg/addon/controllers/managementaddon/controller_test.go b/pkg/addon/controllers/managementaddon/controller_test.go index f99b9fdb9..d556ad092 100644 --- a/pkg/addon/controllers/managementaddon/controller_test.go +++ b/pkg/addon/controllers/managementaddon/controller_test.go @@ -18,8 +18,8 @@ import ( ) type testAgent struct { - name string - strategy *agent.InstallStrategy + name string + // strategy *agent.InstallStrategy } func (t *testAgent) Manifests(cluster *clusterv1.ManagedCluster, addon *addonv1alpha1.ManagedClusterAddOn) ([]runtime.Object, error) { @@ -28,8 +28,8 @@ func (t *testAgent) Manifests(cluster *clusterv1.ManagedCluster, addon *addonv1a func (t *testAgent) GetAgentAddonOptions() agent.AgentAddonOptions { return agent.AgentAddonOptions{ - AddonName: t.name, - InstallStrategy: t.strategy, + AddonName: t.name, + //InstallStrategy: t.strategy, } } @@ -65,7 +65,7 @@ func TestReconcile(t *testing.T) { } }, testaddons: map[string]agent.AgentAddon{ - "test": &testAgent{name: "test", strategy: agent.InstallAllStrategy("test")}, + "test": &testAgent{name: "test"}, }, }, { @@ -89,7 +89,7 @@ func TestReconcile(t *testing.T) { } }, testaddons: map[string]agent.AgentAddon{ - "test": &testAgent{name: "test", strategy: agent.InstallAllStrategy("test")}, + "test": &testAgent{name: "test"}, }, }, { @@ -101,7 +101,7 @@ func TestReconcile(t *testing.T) { })}, validateAddonActions: addontesting.AssertNoActions, testaddons: map[string]agent.AgentAddon{ - "test": &testAgent{name: "test", strategy: agent.InstallAllStrategy("test")}, + "test": &testAgent{name: "test"}, }, }, { diff --git a/pkg/addon/templateagent/template_agent.go b/pkg/addon/templateagent/template_agent.go index 1bbefcd30..f0d151eb9 100644 --- a/pkg/addon/templateagent/template_agent.go +++ b/pkg/addon/templateagent/template_agent.go @@ -112,8 +112,8 @@ func (a *CRDTemplateAgentAddon) GetAgentAddonOptions() agent.AgentAddonOptions { } agentAddonOptions := agent.AgentAddonOptions{ - AddonName: a.addonName, - InstallStrategy: nil, + AddonName: a.addonName, + // InstallStrategy: nil, HealthProber: &agent.HealthProber{ Type: agent.HealthProberTypeDeploymentAvailability, }, diff --git a/test/integration/addon/addon_configs_test.go b/test/integration/addon/addon_configs_test.go index 2713ef279..c81bab77a 100644 --- a/test/integration/addon/addon_configs_test.go +++ b/test/integration/addon/addon_configs_test.go @@ -132,9 +132,9 @@ var _ = ginkgo.Describe("AddConfigs", func() { cma, err := hubAddonClient.AddonV1alpha1().ClusterManagementAddOns().Get(context.Background(), testAddOnConfigsImpl.name, metav1.GetOptions{}) gomega.Expect(err).ToNot(gomega.HaveOccurred()) - cma.Annotations = map[string]string{ - addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, - } + // cma.Annotations = map[string]string{ + // addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, + // } cma.Spec.InstallStrategy = addonapiv1alpha1.InstallStrategy{ Type: addonapiv1alpha1.AddonInstallStrategyPlacements, Placements: []addonapiv1alpha1.PlacementStrategy{ diff --git a/test/integration/addon/addon_manager_install_test.go b/test/integration/addon/addon_manager_install_test.go index 9e00b34d3..235e8f81e 100644 --- a/test/integration/addon/addon_manager_install_test.go +++ b/test/integration/addon/addon_manager_install_test.go @@ -28,9 +28,9 @@ var _ = ginkgo.Describe("Agent deploy", func() { cma = &addonapiv1alpha1.ClusterManagementAddOn{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-%s", suffix), - Annotations: map[string]string{ - addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, - }, + // Annotations: map[string]string{ + // addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, + // }, }, Spec: addonapiv1alpha1.ClusterManagementAddOnSpec{ InstallStrategy: addonapiv1alpha1.InstallStrategy{ diff --git a/test/integration/addon/addon_manager_upgrade_test.go b/test/integration/addon/addon_manager_upgrade_test.go index a3685d87c..13c735a7c 100644 --- a/test/integration/addon/addon_manager_upgrade_test.go +++ b/test/integration/addon/addon_manager_upgrade_test.go @@ -86,9 +86,9 @@ var _ = ginkgo.Describe("Addon upgrade", func() { cma = &addonapiv1alpha1.ClusterManagementAddOn{ ObjectMeta: metav1.ObjectMeta{ Name: testAddOnConfigsImpl.name, - Annotations: map[string]string{ - addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, - }, + // Annotations: map[string]string{ + // addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, + // }, }, Spec: addonapiv1alpha1.ClusterManagementAddOnSpec{ InstallStrategy: addonapiv1alpha1.InstallStrategy{ diff --git a/test/integration/addon/agent_deploy_test.go b/test/integration/addon/agent_deploy_test.go index 7780f07ef..092b7cbe9 100644 --- a/test/integration/addon/agent_deploy_test.go +++ b/test/integration/addon/agent_deploy_test.go @@ -114,11 +114,11 @@ var _ = ginkgo.Describe("Agent deploy", func() { } // Update clustermanagement addon annotattion - cma, err := hubAddonClient.AddonV1alpha1().ClusterManagementAddOns().Get(context.Background(), testAddonImpl.name, metav1.GetOptions{}) - gomega.Expect(err).ToNot(gomega.HaveOccurred()) - cma.SetAnnotations(map[string]string{addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue}) - _, err = hubAddonClient.AddonV1alpha1().ClusterManagementAddOns().Update(context.Background(), cma, metav1.UpdateOptions{}) - gomega.Expect(err).ToNot(gomega.HaveOccurred()) + // cma, err := hubAddonClient.AddonV1alpha1().ClusterManagementAddOns().Get(context.Background(), testAddonImpl.name, metav1.GetOptions{}) + // gomega.Expect(err).ToNot(gomega.HaveOccurred()) + // cma.SetAnnotations(map[string]string{addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue}) + // _, err = hubAddonClient.AddonV1alpha1().ClusterManagementAddOns().Update(context.Background(), cma, metav1.UpdateOptions{}) + // gomega.Expect(err).ToNot(gomega.HaveOccurred()) // Create ManagedClusterAddOn addon := &addonapiv1alpha1.ManagedClusterAddOn{ diff --git a/test/integration/addon/assertion_test.go b/test/integration/addon/assertion_test.go index 16b9b3db0..900fe674d 100644 --- a/test/integration/addon/assertion_test.go +++ b/test/integration/addon/assertion_test.go @@ -72,9 +72,9 @@ func createClusterManagementAddOn(name, defaultConfigNamespace, defaultConfigNam &addonapiv1alpha1.ClusterManagementAddOn{ ObjectMeta: metav1.ObjectMeta{ Name: name, - Annotations: map[string]string{ - addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, - }, + // Annotations: map[string]string{ + // addonapiv1alpha1.AddonLifecycleAnnotationKey: addonapiv1alpha1.AddonLifecycleAddonManagerAnnotationValue, + // }, }, Spec: addonapiv1alpha1.ClusterManagementAddOnSpec{ SupportedConfigs: []addonapiv1alpha1.ConfigMeta{ diff --git a/test/integration/addon/suite_test.go b/test/integration/addon/suite_test.go index 170ed6dba..0560916fe 100644 --- a/test/integration/addon/suite_test.go +++ b/test/integration/addon/suite_test.go @@ -127,13 +127,13 @@ var _ = ginkgo.AfterSuite(func() { }) type testAddon struct { - name string - manifests map[string][]runtime.Object - registrations map[string][]addonapiv1alpha1.RegistrationConfig - approveCSR bool - cert []byte - prober *agent.HealthProber - installStrategy *agent.InstallStrategy + name string + manifests map[string][]runtime.Object + registrations map[string][]addonapiv1alpha1.RegistrationConfig + approveCSR bool + cert []byte + prober *agent.HealthProber + // installStrategy *agent.InstallStrategy hostedModeEnabled bool supportedConfigGVRs []schema.GroupVersionResource } @@ -144,9 +144,9 @@ func (t *testAddon) Manifests(cluster *clusterv1.ManagedCluster, addon *addonapi func (t *testAddon) GetAgentAddonOptions() agent.AgentAddonOptions { option := agent.AgentAddonOptions{ - AddonName: t.name, - HealthProber: t.prober, - InstallStrategy: t.installStrategy, + AddonName: t.name, + HealthProber: t.prober, + // InstallStrategy: t.installStrategy, HostedModeEnabled: t.hostedModeEnabled, SupportedConfigGVRs: t.supportedConfigGVRs, }