diff --git a/.github/workflows/e2e-test-fleet-in-rancher.yml b/.github/workflows/e2e-test-fleet-in-rancher.yml index 4c87c46508..0d165e058e 100644 --- a/.github/workflows/e2e-test-fleet-in-rancher.yml +++ b/.github/workflows/e2e-test-fleet-in-rancher.yml @@ -219,6 +219,9 @@ jobs: run: | kubectl config use-context k3d-upstream ginkgo --github-output e2e/acceptance/single-cluster-examples + + export CI_REGISTERED_CLUSTER=$(kc get clusters.fleet.cattle.io -n $FLEET_E2E_NS_DOWNSTREAM -o jsonpath='{..name}') + ginkgo --github-output e2e/multi-cluster - diff --git a/e2e/multi-cluster/not_matching_targets_delete_bd_test.go b/e2e/multi-cluster/not_matching_targets_delete_bd_test.go index c53f4416b8..8647193ecc 100644 --- a/e2e/multi-cluster/not_matching_targets_delete_bd_test.go +++ b/e2e/multi-cluster/not_matching_targets_delete_bd_test.go @@ -50,7 +50,7 @@ var _ = Describe("Target clusters by label", func() { asset = "multi-cluster/bundle-deployment-labels.yaml" data = TemplateData{env.ClusterRegistrationNamespace, namespace} // set the expected label - out, err := k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", "second", "envlabels=test") + out, err := k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", dsCluster, "envlabels=test") Expect(err).ToNot(HaveOccurred(), out) }) @@ -65,7 +65,7 @@ var _ = Describe("Target clusters by label", func() { }).Should(ContainSubstring("simple-config")) // delete the label (bundledeployment should be deleted and resources in cluster deleted) - out, err := k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", "second", "envlabels-") + out, err := k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", dsCluster, "envlabels-") Expect(err).ToNot(HaveOccurred(), out) Eventually(func() string { @@ -78,7 +78,7 @@ var _ = Describe("Target clusters by label", func() { }).ShouldNot(ContainSubstring("simple-config")) // re-apply the label (bundledeployment should be created and applied again) - out, err = k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", "second", "envlabels=test") + out, err = k.Namespace(env.ClusterRegistrationNamespace).Label("clusters", dsCluster, "envlabels=test") Expect(err).ToNot(HaveOccurred(), out) Eventually(func() string { diff --git a/e2e/multi-cluster/suite_test.go b/e2e/multi-cluster/suite_test.go index 927356ae76..e02ab0f1d0 100644 --- a/e2e/multi-cluster/suite_test.go +++ b/e2e/multi-cluster/suite_test.go @@ -2,6 +2,7 @@ package multicluster_test import ( + "os" "testing" "github.com/rancher/fleet/e2e/testenv" @@ -16,7 +17,8 @@ func TestE2E(t *testing.T) { } var ( - env *testenv.Env + env *testenv.Env + dsCluster = "second" ) var _ = BeforeSuite(func() { @@ -24,4 +26,8 @@ var _ = BeforeSuite(func() { testenv.SetRoot("../..") env = testenv.New() + + if dsClusterEnvVar := os.Getenv("CI_REGISTERED_CLUSTER"); dsClusterEnvVar != "" { + dsClusterEnvVar = dsClusterEnvVar + } })