Skip to content

Commit

Permalink
remove install strategy and annotation in testing case
Browse files Browse the repository at this point in the history
Signed-off-by: haoqing0110 <qhao@redhat.com>
  • Loading branch information
haoqing0110 committed Mar 13, 2024
1 parent ab035c1 commit d459e82
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
14 changes: 7 additions & 7 deletions pkg/addon/controllers/managementaddon/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
}
}

Expand Down Expand Up @@ -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"},
},
},
{
Expand All @@ -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"},
},
},
{
Expand All @@ -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"},
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions pkg/addon/templateagent/template_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
6 changes: 3 additions & 3 deletions test/integration/addon/addon_configs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions test/integration/addon/addon_manager_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions test/integration/addon/addon_manager_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
10 changes: 5 additions & 5 deletions test/integration/addon/agent_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions test/integration/addon/assertion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
20 changes: 10 additions & 10 deletions test/integration/addon/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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,
}
Expand Down

0 comments on commit d459e82

Please sign in to comment.