From 61c10d8c99817672f37f429fa926181a8dff2590 Mon Sep 17 00:00:00 2001 From: Daniel Erez Date: Wed, 9 Oct 2024 13:46:07 +0300 Subject: [PATCH] test: kubeapi-aws --- Makefile | 2 +- subsystem/kubeapi_test.go | 73 +++++---------------------------------- 2 files changed, 10 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index 629b8e7960..d3661607da 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ ifeq ($(VERBOSE), true) endif GOTEST_FLAGS = --format=$(GO_TEST_FORMAT) $(GOTEST_PUBLISH_FLAGS) -- -count=1 -cover -coverprofile=$(REPORTS)/$(TEST_SCENARIO)_coverage.out -GINKGO_FLAGS = -ginkgo.focus="$(FOCUS)" -ginkgo.v -ginkgo.skip="$(SKIP)" -ginkgo.v -ginkgo.reportFile=./junit_$(TEST_SCENARIO)_test.xml +GINKGO_FLAGS = -ginkgo.failFast -ginkgo.focus="$(FOCUS)" -ginkgo.v -ginkgo.skip="$(SKIP)" -ginkgo.v -ginkgo.reportFile=./junit_$(TEST_SCENARIO)_test.xml COVER_PROFILE := $(or ${COVER_PROFILE},$(REPORTS)/unit_coverage.out) GINKGO_REPORTFILE := $(or $(GINKGO_REPORTFILE), ./junit_unit_test.xml) diff --git a/subsystem/kubeapi_test.go b/subsystem/kubeapi_test.go index 2b9a42d6fb..f4c3eb0087 100644 --- a/subsystem/kubeapi_test.go +++ b/subsystem/kubeapi_test.go @@ -696,7 +696,7 @@ func checkPlatformStatus(ctx context.Context, key types.NamespacedName, specPlat ExpectWithOffset(1, aci.Status.UserManagedNetworking).To(Equal(umn)) } -func checkAgentClusterInstallCondition(ctx context.Context, key types.NamespacedName, conditionType hivev1.ClusterInstallConditionType, reason string) { +func checkAgentClusterInstallCondition(ctx context.Context, key types.NamespacedName, conditionType string, reason string) { Eventually(func() string { condition := controllers.FindStatusCondition(getAgentClusterInstallCRD(ctx, kubeClient, key).Status.Conditions, conditionType) if condition != nil { @@ -706,7 +706,7 @@ func checkAgentClusterInstallCondition(ctx context.Context, key types.Namespaced }, "2m", "2s").Should(Equal(reason)) } -func checkAgentClusterInstallConditionConsistency(ctx context.Context, key types.NamespacedName, conditionType hivev1.ClusterInstallConditionType, reason string) { +func checkAgentClusterInstallConditionConsistency(ctx context.Context, key types.NamespacedName, conditionType string, reason string) { Consistently(func() string { condition := controllers.FindStatusCondition(getAgentClusterInstallCRD(ctx, kubeClient, key).Status.Conditions, conditionType) if condition != nil { @@ -3419,33 +3419,7 @@ var _ = Describe("[kube-api]cluster installation", func() { checkAgentCondition(ctx, host.ID.String(), v1beta1.SpecSyncedCondition, v1beta1.BackendErrorReason) }) - It("deploy clusterDeployment and infraEnv and with an invalid NMState config YAML", func() { - var ( - NMStateLabelName = "someName" - NMStateLabelValue = "someValue" - nicPrimary = "eth0" - nicSecondary = "eth1" - macPrimary = "09:23:0f:d8:92:AA" - macSecondary = "09:23:0f:d8:92:AB" - ) - nmstateConfigSpec := getDefaultNMStateConfigSpec(nicPrimary, nicSecondary, macPrimary, macSecondary, "foo: bar") - deployNMStateConfigCRD(ctx, kubeClient, "nmstate2", NMStateLabelName, NMStateLabelValue, nmstateConfigSpec) - deployClusterDeploymentCRD(ctx, kubeClient, clusterDeploymentSpec) - deployAgentClusterInstallCRD(ctx, kubeClient, aciSpec, clusterDeploymentSpec.ClusterInstallRef.Name) - installkey := types.NamespacedName{ - Namespace: Options.Namespace, - Name: clusterDeploymentSpec.ClusterInstallRef.Name, - } - checkAgentClusterInstallCondition(ctx, installkey, hiveext.ClusterRequirementsMetCondition, hiveext.ClusterNotReadyReason) - infraEnvSpec.NMStateConfigLabelSelector = metav1.LabelSelector{MatchLabels: map[string]string{NMStateLabelName: NMStateLabelValue}} - deployInfraEnvCRD(ctx, kubeClient, infraNsName.Name, infraEnvSpec) - infraEnvKubeName := types.NamespacedName{ - Namespace: Options.Namespace, - Name: infraNsName.Name, - } - // InfraEnv Reconcile takes longer, since it needs to generate the image. - checkInfraEnvCondition(ctx, infraEnvKubeName, v1beta1.ImageCreatedCondition, "Invalid YAML") - }) + It("ensure StaticNetworkConfig is empty after NMStateConfig deletion", func() { var ( NMStateLabelName = "someName" @@ -5084,16 +5058,14 @@ spec: }, "2m", "2s").Should(Equal(1)) By("Add skip-spoke-cleanup annotiaion") - Eventually(func() error { - agent := getClusterDeploymentAgents(ctx, kubeClient, clusterKey).Items[0] - annotations := agent.GetAnnotations() - annotations[controllers.AgentSkipSpokeCleanupAnnotation] = "true" - agent.SetAnnotations(annotations) - return kubeClient.Update(ctx, &agent) - }, "2m", "2s").Should(BeNil()) + agent := getClusterDeploymentAgents(ctx, kubeClient, clusterKey).Items[0] + annotations := agent.GetAnnotations() + annotations[controllers.AgentSkipSpokeCleanupAnnotation] = "true" + agent.SetAnnotations(annotations) + Expect(kubeClient.Update(ctx, &agent)).To(BeNil()) By("Delete agent CR and validate") - agent := getClusterDeploymentAgents(ctx, kubeClient, clusterKey).Items[0] + agent = getClusterDeploymentAgents(ctx, kubeClient, clusterKey).Items[0] Expect(kubeClient.Delete(ctx, &agent)).To(BeNil()) Eventually(func() int { return len(getClusterDeploymentAgents(ctx, kubeClient, clusterKey).Items) @@ -5288,33 +5260,6 @@ spec: hiveext.ClusterSpecSyncedCondition) Expect(condition.Message).To(ContainSubstring("User Managed Networking cannot be set with API VIP")) }) - - It("updating infraenv OSImageVersion updates the image URL", func() { - infraEnvSpec.ClusterRef = nil - infraEnvSpec.OSImageVersion = "4.14" - deployInfraEnvCRD(ctx, kubeClient, infraNsName.Name, infraEnvSpec) - - var url string - Eventually(func() string { - url = getInfraEnvCRD(ctx, kubeClient, infraNsName).Status.ISODownloadURL - return url - }, "15s", "1s").Should(Not(BeEmpty())) - - Eventually(func() error { - infraEnv := getInfraEnvCRD(ctx, kubeClient, infraNsName) - infraEnv.Spec.OSImageVersion = "4.16" - return kubeClient.Update(ctx, infraEnv) - }, "1m", "20s").Should(BeNil()) - - var newURL string - Eventually(func() string { - newURL = getInfraEnvCRD(ctx, kubeClient, infraNsName).Status.ISODownloadURL - return newURL - }, "15s", "1s").Should(Not(Equal(url))) - - updatedInfraEnv := getInfraEnvFromDBByKubeKey(ctx, db, infraNsName, waitForReconcileTimeout) - Expect(updatedInfraEnv.OpenshiftVersion).To(Equal("4.16")) - }) }) var _ = Describe("bmac reconcile flow", func() {