From 89ff0aefdc672f995aa2180dcdd5e5aeb2e07c34 Mon Sep 17 00:00:00 2001 From: Tanya Garg Date: Tue, 8 Aug 2023 08:24:14 -0700 Subject: [PATCH] Added multisite --- .../c3/manager_appframework_test.go | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index 5efcdd81c..45d87cdf9 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -331,8 +331,22 @@ var _ = Describe("c3appfw test", func() { oldImage := "splunk/splunk:9.0.3-a2" newImage := "splunk/splunk:9.0.5" + defaults := `splunk: + multisite_master: localhost + all_sites: site1,site2,site3 + site: site1 + multisite_replication_factor_origin: 1 + multisite_replication_factor_total: 2 + multisite_search_factor_origin: 1 + multisite_search_factor_total: 2 + idxc: + search_factor: 2 + replication_factor: 2 + ` + idxl := enterpriseApi.IndexerClusterList{} + lm, err := deployment.DeployLicenseManager(ctx, deployment.GetName()) - cm, err := deployment.DeployClusterManager(ctx, deployment.GetName(), lm.GetName(), "", "") + cm, err := deployment.DeployClusterManager(ctx, deployment.GetName(), lm.GetName(), defaults, "") mcSpec := enterpriseApi.MonitoringConsoleSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ @@ -349,10 +363,24 @@ var _ = Describe("c3appfw test", func() { mc, err := deployment.DeployMonitoringConsoleWithGivenSpec(ctx, testcaseEnvInst.GetName(), mcName, mcSpec) Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + siteDefaults := fmt.Sprintf(`splunk: + multisite_master: splunk-%s-%s-service + site: site0 + `, deployment.GetName(), "cluster-manager") shcName := fmt.Sprintf("%s-shc", deployment.GetName()) - idxName := fmt.Sprintf("%s-idxc", deployment.GetName()) - shc, err := deployment.DeploySearchHeadCluster(ctx, shcName, cm.GetName(), lm.GetName(), "", mcName) - idxc, err := deployment.DeployIndexerCluster(ctx, idxName, lm.GetName(), 3, cm.GetName(), "") + // ame := fmt.Sprintf("%s-idxc", deployment.GetName()) + shc, err := deployment.DeploySearchHeadCluster(ctx, shcName, cm.GetName(), lm.GetName(), siteDefaults, mcName) + siteCount := 3 + for site := 1; site <= siteCount; site++ { + siteName := fmt.Sprintf("site%d", site) + siteDefaults := fmt.Sprintf(`splunk: + multisite_master: splunk-%s-%s-service + site: %s + `, mcName, "cluster-manager", siteName) + idx, _ := deployment.DeployIndexerCluster(ctx, mcName+"-"+siteName, lm.GetName(), 2, mcName, siteDefaults) + idxl.Items = append(idxl.Items, *idx) + + } // Wait for License Manager to be in READY phase testenv.LicenseManagerReady(ctx, deployment, testcaseEnvInst) @@ -367,7 +395,7 @@ var _ = Describe("c3appfw test", func() { testenv.SearchHeadClusterReady(ctx, deployment, testcaseEnvInst) // Ensure Indexers go to Ready phase - testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst) + testenv.IndexersReady(ctx, deployment, testcaseEnvInst, siteCount) // // Verify Monitoring Console is ready and stays in ready state testenv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc, testcaseEnvInst) @@ -422,10 +450,13 @@ var _ = Describe("c3appfw test", func() { // // Update IDXC image - testcaseEnvInst.Log.Info("Upgrading the Indexer Cluster Image", "Current Image", oldImage, "New Image", newImage) - idxc.Spec.Image = newImage - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Failed upgrade Indexer Cluster image") + for site := 1; site <= siteCount; site++ { + testcaseEnvInst.Log.Info("Upgrading the Indexer Cluster Image", "Current Image", oldImage, "New Image", newImage) + idxl.Items[site-1].Spec.Image = newImage + err = deployment.UpdateCR(ctx, &idxl.Items[site-1]) + Expect(err).To(Succeed(), "Failed upgrade Indexer Cluster image") + + } // Ensure Cluster Manager goes to Ready phase testenv.ClusterManagerReady(ctx, deployment, testcaseEnvInst) @@ -440,7 +471,7 @@ var _ = Describe("c3appfw test", func() { testenv.SearchHeadClusterReady(ctx, deployment, testcaseEnvInst) // // Ensure Indexers go to Ready phase - testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst) + testenv.IndexersReady(ctx, deployment, testcaseEnvInst, siteCount) }) })