Skip to content

Commit

Permalink
Added multisite
Browse files Browse the repository at this point in the history
  • Loading branch information
tgarg-splunk committed Aug 8, 2023
1 parent b37eb45 commit 89ff0ae
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions test/appframework_aws/c3/manager_appframework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)

})
})
Expand Down

0 comments on commit 89ff0ae

Please sign in to comment.