From 5fe13d89cb61c7e7345e668b467d899a63b2f1b5 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Thu, 19 Mar 2026 11:04:40 +0100 Subject: [PATCH 01/20] CSPL-3775 Extract setup/teardown functions --- .../custom_resource_crud_c3_test.go | 19 +---- .../custom_resource_crud_m4_test.go | 19 +---- .../custom_resource_crud_s1_test.go | 19 +---- .../manager_custom_resource_crud_c3_test.go | 19 +---- .../manager_custom_resource_crud_m4_test.go | 19 +---- test/delete_cr/deletecr_test.go | 20 +---- .../index_and_ingestion_separation_test.go | 21 +---- test/ingest_search/ingest_search_test.go | 19 +---- test/licensemanager/lm_s1_test.go | 43 +--------- test/licensemanager/manager_lm_c3_test.go | 67 ++-------------- test/licensemanager/manager_lm_m4_test.go | 43 +--------- test/licensemaster/lm_c3_test.go | 67 ++-------------- test/licensemaster/lm_m4_test.go | 43 +--------- test/licensemaster/lm_s1_test.go | 43 +--------- .../manager_monitoring_console_test.go | 20 +---- .../monitoring_console_test.go | 20 +---- test/secret/manager_secret_c3_test.go | 43 +--------- test/secret/manager_secret_m4_test.go | 45 +---------- test/secret/manager_secret_s1_test.go | 67 ++-------------- test/secret/secret_c3_test.go | 43 +--------- test/secret/secret_m4_test.go | 46 +---------- test/secret/secret_s1_test.go | 67 ++-------------- test/smartstore/manager_smartstore_test.go | 19 +---- test/smartstore/smartstore_test.go | 19 +---- test/smoke/smoke_test.go | 19 +---- test/testenv/test_setup_helpers.go | 78 +++++++++++++++++++ 26 files changed, 160 insertions(+), 787 deletions(-) create mode 100644 test/testenv/test_setup_helpers.go diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go index 5d377d8dc..831e19193 100644 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/custom_resource_crud_c3_test.go @@ -19,7 +19,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -40,28 +39,14 @@ var _ = Describe("Crcrud test for SVA C3", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") defaultCPULimits = "4" newCPULimits = "2" verificationTimeout = 150 * time.Second }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index 887530f94..a60e6dce4 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" @@ -36,28 +35,14 @@ var _ = Describe("Crcrud test for SVA M4", func() { var ctx context.Context BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") defaultCPULimits = "4" newCPULimits = "2" ctx = context.TODO() }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go index 2b7f1e1e6..7b784ff4a 100644 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ b/test/custom_resource_crud/custom_resource_crud_s1_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" @@ -36,28 +35,14 @@ var _ = Describe("Crcrud test for SVA S1", func() { var ctx context.Context BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") defaultCPULimits = "4" newCPULimits = "2" ctx = context.TODO() }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1)", func() { diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index 861b20643..f0507f2bd 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -21,7 +21,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" //splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -41,28 +40,14 @@ var _ = Describe("Crcrud test for SVA C3", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") defaultCPULimits = "4" newCPULimits = "2" verificationTimeout = 150 * time.Second + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index 52ef3a3ed..4cffb8701 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" @@ -35,28 +34,14 @@ var _ = Describe("Crcrud test for SVA M4", func() { var ctx context.Context BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") defaultCPULimits = "4" newCPULimits = "2" ctx = context.TODO() }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index e93269d10..dbb783d18 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -17,10 +17,8 @@ package deletecr import ( "context" - "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -35,25 +33,11 @@ var _ = Describe("DeleteCR test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1 - Standalone Pod)", func() { diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index d88a05211..13628f0c4 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -21,7 +21,6 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/onsi/ginkgo/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -41,14 +40,6 @@ var _ = Describe("indingsep test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") cmSpec = enterpriseApi.ClusterManagerSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ @@ -58,19 +49,11 @@ var _ = Describe("indingsep test", func() { }, }, } + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Ingestor and Indexer deployment", func() { diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index dfa686ad3..1fd395aae 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -26,7 +26,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -40,25 +39,11 @@ var _ = Describe("Ingest and Search Test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1)", func() { diff --git a/test/licensemanager/lm_s1_test.go b/test/licensemanager/lm_s1_test.go index 7c9b605fa..cff91584f 100644 --- a/test/licensemanager/lm_s1_test.go +++ b/test/licensemanager/lm_s1_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/pkg/splunk/enterprise" @@ -32,52 +31,18 @@ var _ = Describe("Licensemanager test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1) with LM", func() { It("licensemanager, smoke, s1: Splunk Operator can configure License Manager with Standalone in S1 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Manager mcRef := deployment.GetName() diff --git a/test/licensemanager/manager_lm_c3_test.go b/test/licensemanager/manager_lm_c3_test.go index a977967ce..f79fdb526 100644 --- a/test/licensemanager/manager_lm_c3_test.go +++ b/test/licensemanager/manager_lm_c3_test.go @@ -23,7 +23,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" @@ -37,52 +36,18 @@ var _ = Describe("Licensemanager test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("licensemanager, integration, c3: Splunk Operator can configure License Manager with Indexers and Search Heads in C3 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) @@ -188,28 +153,8 @@ var _ = Describe("Licensemanager test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) } - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create App framework Spec volumeName := "lm-test-volume-" + testenv.RandomDNSName(3) diff --git a/test/licensemanager/manager_lm_m4_test.go b/test/licensemanager/manager_lm_m4_test.go index 6390be94c..939d3fefe 100644 --- a/test/licensemanager/manager_lm_m4_test.go +++ b/test/licensemanager/manager_lm_m4_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -31,52 +30,18 @@ var _ = Describe("Licensemanager test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("licensemanager, integration, m4: Splunk Operator can configure license manager with indexers and search head in M4 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) siteCount := 3 mcRef := deployment.GetName() diff --git a/test/licensemaster/lm_c3_test.go b/test/licensemaster/lm_c3_test.go index 1952ebe29..74979566e 100644 --- a/test/licensemaster/lm_c3_test.go +++ b/test/licensemaster/lm_c3_test.go @@ -23,7 +23,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" "github.com/splunk/splunk-operator/test/testenv" @@ -38,52 +37,18 @@ var _ = Describe("licensemaster test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("licensemaster, integration, c3: Splunk Operator can configure License Master with Indexers and Search Heads in C3 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) @@ -186,28 +151,8 @@ var _ = Describe("licensemaster test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) } - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create App framework Spec volumeName := "lm-test-volume-" + testenv.RandomDNSName(3) diff --git a/test/licensemaster/lm_m4_test.go b/test/licensemaster/lm_m4_test.go index b5d7f9555..d644acb5d 100644 --- a/test/licensemaster/lm_m4_test.go +++ b/test/licensemaster/lm_m4_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -31,52 +30,18 @@ var _ = Describe("Licensemaster test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("licensemaster, integration, m4: Splunk Operator can configure license master with indexers and search head in M4 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) siteCount := 3 mcRef := deployment.GetName() diff --git a/test/licensemaster/lm_s1_test.go b/test/licensemaster/lm_s1_test.go index da225278f..39c71d87d 100644 --- a/test/licensemaster/lm_s1_test.go +++ b/test/licensemaster/lm_s1_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/pkg/splunk/enterprise" @@ -32,52 +31,18 @@ var _ = Describe("Licensemanager test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1) with LM", func() { It("licensemaster, smoke, s1: Splunk Operator can configure License Manager with Standalone in S1 SVA", func() { - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Master mcRef := deployment.GetName() diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index 7e50c58a6..deea5997d 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -22,7 +22,6 @@ import ( splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -37,26 +36,11 @@ var _ = Describe("Monitoring Console test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Deploy Monitoring Console", func() { diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index 4189e9ff1..2c8f57f0e 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -19,7 +19,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" @@ -35,26 +34,11 @@ var _ = Describe("Monitoring Console test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { diff --git a/test/secret/manager_secret_c3_test.go b/test/secret/manager_secret_c3_test.go index 5fbb875b4..e51a82dd3 100644 --- a/test/secret/manager_secret_c3_test.go +++ b/test/secret/manager_secret_c3_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -33,25 +32,11 @@ var _ = Describe("Secret Test for SVA C3", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { @@ -64,28 +49,8 @@ var _ = Describe("Secret Test for SVA C3", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) diff --git a/test/secret/manager_secret_m4_test.go b/test/secret/manager_secret_m4_test.go index fdf2d2a31..47e9305ee 100644 --- a/test/secret/manager_secret_m4_test.go +++ b/test/secret/manager_secret_m4_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -32,28 +31,12 @@ var _ = Describe("Secret Test for M4 SVA", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - // SpecifiedTestTimeout override default timeout for m4 test cases as we have seen - // it takes more than 3000 seconds for one of the test case - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") testenv.SpecifiedTestTimeout = 40000 - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { @@ -66,28 +49,8 @@ var _ = Describe("Secret Test for M4 SVA", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) siteCount := 3 mcName := deployment.GetName() diff --git a/test/secret/manager_secret_s1_test.go b/test/secret/manager_secret_s1_test.go index 123538317..c0e015d10 100644 --- a/test/secret/manager_secret_s1_test.go +++ b/test/secret/manager_secret_s1_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -35,25 +34,11 @@ var _ = Describe("Secret Test for SVA S1", func() { var deployment *testenv.Deployment BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1) with LM and MC", func() { @@ -66,28 +51,8 @@ var _ = Describe("Secret Test for SVA S1", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Manager mcName := deployment.GetName() @@ -173,28 +138,8 @@ var _ = Describe("Secret Test for SVA S1", func() { //4. Verify New Secrets are present in server.conf (Pass4SymmKey) //5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Manager mcName := deployment.GetName() diff --git a/test/secret/secret_c3_test.go b/test/secret/secret_c3_test.go index 698c84786..8d8631b08 100644 --- a/test/secret/secret_c3_test.go +++ b/test/secret/secret_c3_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -33,25 +32,11 @@ var _ = Describe("Secret Test for SVA C3", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { @@ -64,28 +49,8 @@ var _ = Describe("Secret Test for SVA C3", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) diff --git a/test/secret/secret_m4_test.go b/test/secret/secret_m4_test.go index e40d94cfd..c344d1ef1 100644 --- a/test/secret/secret_m4_test.go +++ b/test/secret/secret_m4_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -33,28 +32,11 @@ var _ = Describe("Secret Test for M4 SVA", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - // SpecifiedTestTimeout override default timeout for m4 test cases as we have seen - // it takes more than 3000 seconds for one of the test case - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - testenv.SpecifiedTestTimeout = 40000 - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { @@ -67,28 +49,8 @@ var _ = Describe("Secret Test for M4 SVA", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) siteCount := 3 mcName := deployment.GetName() diff --git a/test/secret/secret_s1_test.go b/test/secret/secret_s1_test.go index fc7a0e47d..a55a9f754 100644 --- a/test/secret/secret_s1_test.go +++ b/test/secret/secret_s1_test.go @@ -20,7 +20,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -35,25 +34,11 @@ var _ = Describe("Secret Test for SVA S1", func() { var deployment *testenv.Deployment BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1) with LM and MC", func() { @@ -66,28 +51,8 @@ var _ = Describe("Secret Test for SVA S1", func() { // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) // 5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Master mcName := deployment.GetName() @@ -173,28 +138,8 @@ var _ = Describe("Secret Test for SVA S1", func() { //4. Verify New Secrets are present in server.conf (Pass4SymmKey) //5. Verify New Secrets via api access (password) - // Download License File - downloadDir := "licenseFolder" - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err := testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "azure": - licenseFilePath, err := testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - case "gcp": - licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - // Create License Config Map - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Master mcName := deployment.GetName() diff --git a/test/smartstore/manager_smartstore_test.go b/test/smartstore/manager_smartstore_test.go index b90a68337..2dcc210da 100644 --- a/test/smartstore/manager_smartstore_test.go +++ b/test/smartstore/manager_smartstore_test.go @@ -8,7 +8,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -21,25 +20,11 @@ var _ = Describe("Smartstore test", func() { var deployment *testenv.Deployment BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone Deployment (S1)", func() { diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index c2d550411..c9c3542ef 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -6,7 +6,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" @@ -22,25 +21,11 @@ var _ = Describe("Smartstore test", func() { var deployment *testenv.Deployment BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone Deployment (S1)", func() { diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index de4d26e88..70de901a9 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -18,7 +18,6 @@ import ( "fmt" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" @@ -34,25 +33,11 @@ var _ = Describe("Smoke test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) Context("Standalone deployment (S1)", func() { diff --git a/test/testenv/test_setup_helpers.go b/test/testenv/test_setup_helpers.go new file mode 100644 index 000000000..47f46cef3 --- /dev/null +++ b/test/testenv/test_setup_helpers.go @@ -0,0 +1,78 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testenv + +import ( + "context" + "fmt" + + "github.com/onsi/ginkgo/v2" + "github.com/onsi/ginkgo/v2/types" + . "github.com/onsi/gomega" +) + +// SetupTestCaseEnv creates a new test case environment and deployment for use in BeforeEach blocks. +func SetupTestCaseEnv(testenvInstance *TestEnv, namePrefix string) (*TestCaseEnv, *Deployment) { + name := fmt.Sprintf("%s-%s", namePrefix+testenvInstance.GetName(), RandomDNSName(3)) + testcaseEnvInst, err := NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) + Expect(err).To(Succeed(), "Unable to create testcaseenv") + + deployment, err := testcaseEnvInst.NewDeployment(RandomDNSName(3)) + Expect(err).To(Succeed(), "Unable to create deployment") + + return testcaseEnvInst, deployment +} + +// TeardownTestCaseEnv handles the common teardown logic for test case environments. +func TeardownTestCaseEnv(testcaseEnvInst *TestCaseEnv, deployment *Deployment) { + if types.SpecState(ginkgo.CurrentSpecReport().State) == types.SpecStateFailed { + if testcaseEnvInst != nil { + testcaseEnvInst.SkipTeardown = true + } + } + + if deployment != nil { + deployment.Teardown() + } + + if testcaseEnvInst != nil { + Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) + } +} + +// SetupLicenseConfigMap downloads the license file from the appropriate cloud provider +// and creates a license config map. +func SetupLicenseConfigMap(ctx context.Context, testcaseEnvInst *TestCaseEnv) { + downloadDir := "licenseFolder" + var licenseFilePath string + var err error + + switch ClusterProvider { + case "eks": + licenseFilePath, err = DownloadLicenseFromS3Bucket() + Expect(err).To(Succeed(), "Unable to download license file from S3") + case "azure": + licenseFilePath, err = DownloadLicenseFromAzure(ctx, downloadDir) + Expect(err).To(Succeed(), "Unable to download license file from Azure") + case "gcp": + licenseFilePath, err = DownloadLicenseFromGCPBucket() + Expect(err).To(Succeed(), "Unable to download license file from GCP") + default: + testcaseEnvInst.Log.Info("Skipping license download", "ClusterProvider", ClusterProvider) + return + } + + testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) +} From 3fd048a14468219c33b0991effe7645f1bb73d80 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Thu, 19 Mar 2026 12:37:20 +0100 Subject: [PATCH 02/20] CSPL-3775 Extract common code for secret tests --- .../index_and_ingestion_separation_test.go | 2 +- test/secret/manager_secret_c3_test.go | 105 +--- test/secret/manager_secret_m4_test.go | 115 +--- test/secret/manager_secret_s1_test.go | 250 +-------- test/secret/secret_c3_test.go | 120 +--- test/secret/secret_m4_test.go | 116 +--- test/secret/secret_s1_test.go | 250 +-------- test/secret/secret_test_shared.go | 520 ++++++++++++++++++ test/testenv/deployment_scenarios.go | 306 +++++++++++ 9 files changed, 847 insertions(+), 937 deletions(-) create mode 100644 test/secret/secret_test_shared.go create mode 100644 test/testenv/deployment_scenarios.go diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 8aed902e5..94fd8c5bc 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -42,7 +42,7 @@ var _ = Describe("indingsep test", func() { BeforeEach(func() { // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") cmSpec = enterpriseApi.ClusterManagerSpec{ diff --git a/test/secret/manager_secret_c3_test.go b/test/secret/manager_secret_c3_test.go index 6436f289c..9b963aa4c 100644 --- a/test/secret/manager_secret_c3_test.go +++ b/test/secret/manager_secret_c3_test.go @@ -15,9 +15,6 @@ package secret import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -45,106 +42,8 @@ var _ = Describe("Secret Test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managersecret, smoke, c3: secret update on indexers and search head cluster", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure that Cluster Manager goes to update phase - testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + config := NewSecretTestConfigV4() + RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/manager_secret_m4_test.go b/test/secret/manager_secret_m4_test.go index 2a368135a..1f579ee22 100644 --- a/test/secret/manager_secret_m4_test.go +++ b/test/secret/manager_secret_m4_test.go @@ -15,12 +15,10 @@ package secret import ( "context" - "fmt" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" ) @@ -45,117 +43,8 @@ var _ = Describe("Secret Test for M4 SVA", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("managersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - siteCount := 3 - mcName := deployment.GetName() - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Test 1 - // Update Secrets Data and - // Verify New versioned secret are created with correct value. - // Verify new secrets are mounted on pods. - // Verify New Secrets are present in server.conf (Pass4SymmKey) - // Verify New Secrets via api access (password) - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure that Cluster Manager goes to update phase - testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each versioned secret for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + config := NewSecretTestConfigV4() + RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/manager_secret_s1_test.go b/test/secret/manager_secret_s1_test.go index 699b17e72..23f44ee12 100644 --- a/test/secret/manager_secret_s1_test.go +++ b/test/secret/manager_secret_s1_test.go @@ -15,15 +15,10 @@ package secret import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - "github.com/splunk/splunk-operator/test/testenv" ) @@ -47,255 +42,22 @@ var _ = Describe("Secret Test for SVA S1", func() { Context("Standalone deployment (S1) with LM and MC", func() { It("managersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - // Create standalone Deployment with License Manager - mcName := deployment.GetName() - standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcName) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) - + config := NewSecretTestConfigV4() + RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1) with LM amd MC", func() { It("managersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - - // Test Scenario - //1. Delete Secret Object - //2. Verify New versioned secret are created with new values. - //3. Verify New secrets are mounted on pods. - //4. Verify New Secrets are present in server.conf (Pass4SymmKey) - //5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - // Create standalone Deployment with License Manager - mcName := deployment.GetName() - standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcName) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Delete secret Object - err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to delete secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for License Manager to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + config := NewSecretTestConfigV4() + RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1)", func() { It("managersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - - // Test Scenario - // 1. Delete Secret Passing Empty Data Map to secret Object - // 2. Verify New versioned secret are created with new values. - // 3. Verify New secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Create standalone Deployment with MonitoringConsoleRef - mcName := deployment.GetName() - standaloneSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with MonitoringConsoleRef") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Delete secret by passing empty Data Map - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, map[string][]byte{}) - Expect(err).To(Succeed(), "Unable to delete secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + config := NewSecretTestConfigV4() + RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/secret_c3_test.go b/test/secret/secret_c3_test.go index d62932031..af9df45b4 100644 --- a/test/secret/secret_c3_test.go +++ b/test/secret/secret_c3_test.go @@ -15,10 +15,6 @@ package secret import ( "context" - "fmt" - "time" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -46,120 +42,8 @@ var _ = Describe("Secret Test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastersecret, smoke, c3: secret update on indexers and search head cluster", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseMasterReady(ctx, deployment) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Wait for ClusterInitialized event to confirm cluster is fully initialized - idxcName := deployment.GetName() + "-idxc" - err = testcaseEnvInst.WaitForClusterInitialized(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure that Cluster Master goes to update phase - testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseMasterReady(ctx, deployment) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Wait for PasswordSyncCompleted event on SearchHeadCluster - shcName := deployment.GetName() + "-shc" - err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), shcName, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on SearchHeadCluster") - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Wait for PasswordSyncCompleted event on IndexerCluster - err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on IndexerCluster") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + config := NewSecretTestConfigV3() + RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/secret_m4_test.go b/test/secret/secret_m4_test.go index d12ec1b79..648569554 100644 --- a/test/secret/secret_m4_test.go +++ b/test/secret/secret_m4_test.go @@ -15,9 +15,6 @@ package secret import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -47,117 +44,8 @@ var _ = Describe("Secret Test for M4 SVA", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("mastersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - siteCount := 3 - mcName := deployment.GetName() - err := deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseMasterReady(ctx, deployment) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Test 1 - // Update Secrets Data and - // Verify New versioned secret are created with correct value. - // Verify new secrets are mounted on pods. - // Verify New Secrets are present in server.conf (Pass4SymmKey) - // Verify New Secrets via api access (password) - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure that Cluster Master goes to update phase - testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseMasterReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each versioned secret for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + config := NewSecretTestConfigV3() + RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/secret_s1_test.go b/test/secret/secret_s1_test.go index 4e332032b..c64ea8e57 100644 --- a/test/secret/secret_s1_test.go +++ b/test/secret/secret_s1_test.go @@ -15,15 +15,10 @@ package secret import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - "github.com/splunk/splunk-operator/test/testenv" ) @@ -47,255 +42,22 @@ var _ = Describe("Secret Test for SVA S1", func() { Context("Standalone deployment (S1) with LM and MC", func() { It("mastersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - - // Test Scenario - // 1. Update Secrets Data - // 2. Verify New versioned secret are created with correct value. - // 3. Verify new secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - // Create standalone Deployment with License Master - mcName := deployment.GetName() - standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcName) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Update Secret Value on Secret Object - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - modifiedHecToken := testenv.GetRandomeHECToken() - modifedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifedValue, modifedValue, modifedValue, modifedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) - + config := NewSecretTestConfigV4() + RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1) with LM amd MC", func() { It("mastersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - - // Test Scenario - //1. Delete Secret Object - //2. Verify New versioned secret are created with new values. - //3. Verify New secrets are mounted on pods. - //4. Verify New Secrets are present in server.conf (Pass4SymmKey) - //5. Verify New Secrets via api access (password) - - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - // Create standalone Deployment with License Master - mcName := deployment.GetName() - standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcName) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Delete secret Object - err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to delete secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for License Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + config := NewSecretTestConfigV4() + RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1)", func() { It("mastersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - - // Test Scenario - // 1. Delete Secret Passing Empty Data Map to secret Object - // 2. Verify New versioned secret are created with new values. - // 3. Verify New secrets are mounted on pods. - // 4. Verify New Secrets are present in server.conf (Pass4SymmKey) - // 5. Verify New Secrets via api access (password) - - // Create standalone Deployment with MonitoringConsoleRef - mcName := deployment.GetName() - standaloneSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with MonitoringConsoleRef") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) - Expect(err).To(Succeed(), "Unable to get secret struct") - - // Delete secret by passing empty Data Map - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, map[string][]byte{}) - Expect(err).To(Succeed(), "Unable to delete secret Object") - - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + config := NewSecretTestConfigV4() + RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go new file mode 100644 index 000000000..a59467e38 --- /dev/null +++ b/test/secret/secret_test_shared.go @@ -0,0 +1,520 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package secret + +import ( + "context" + "fmt" + "time" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" + + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" +) + +// SecretTestConfig holds configuration for secret tests to support both v3 and v4 API versions +type SecretTestConfig struct { + LicenseManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) + ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) + APIVersion string +} + +// NewSecretTestConfigV3 creates configuration for v3 API (LicenseMaster/ClusterMaster) +func NewSecretTestConfigV3() *SecretTestConfig { + return &SecretTestConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterMasterReady(ctx, deployment) + }, + APIVersion: "v3", + } +} + +// NewSecretTestConfigV4 creates configuration for v4 API (LicenseManager/ClusterManager) +func NewSecretTestConfigV4() *SecretTestConfig { + return &SecretTestConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + }, + APIVersion: "v4", + } +} + +// RunS1SecretUpdateTest runs the standard S1 secret update test workflow +func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) + + // Create standalone Deployment with License Manager + mcRef := deployment.GetName() + var standalone *enterpriseApi.Standalone + var err error + + if config.APIVersion == "v3" { + standalone, err = deployment.DeployStandaloneWithLMaster(ctx, deployment.GetName(), mcRef) + } else { + standalone, err = deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) + } + Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Get Current Secrets Struct + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + + // Update Secret Value on Secret Object + modifiedHecToken := testenv.GetRandomeHECToken() + modifiedValue := testenv.RandomDNSName(10) + updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) + err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) + Expect(err).To(Succeed(), "Unable to update secret Object") + + // Ensure standalone is updating + testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) + + // Once Pods are READY check each pod for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Secrets on ServerConf on Pod + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) +} + +// RunS1SecretDeleteTest runs the standard S1 secret delete test workflow +func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) + + // Create standalone Deployment with License Manager + mcRef := deployment.GetName() + var standalone *enterpriseApi.Standalone + var err error + + if config.APIVersion == "v3" { + standalone, err = deployment.DeployStandaloneWithLMaster(ctx, deployment.GetName(), mcRef) + } else { + standalone, err = deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) + } + Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Get Current Secrets Struct + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + + // Delete Secret Object + err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to delete secret Object") + + // Ensure standalone is updating + testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) + + // Once Pods are READY check each pod for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) + + // Verify Secrets on ServerConf on Pod + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) +} + +// RunS1SecretDeleteWithMCRefTest runs the S1 secret delete test with MC reference workflow +func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + // Create standalone Deployment with MonitoringConsoleRef + var standalone *enterpriseApi.Standalone + var err error + + mcName := deployment.GetName() + standaloneSpec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: testcaseEnvInst.GetSplunkImage(), + }, + Volumes: []corev1.Volume{}, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } + standalone, err = deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance with MonitoringConsoleRef") + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Get Current Secrets Struct + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + + // Delete Secret Object + err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to delete secret Object") + + // Ensure standalone is updating + testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) + + // Wait for Standalone to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) + + // Once Pods are READY check each pod for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) + + // Verify Secrets on ServerConf on Pod + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) +} + +// RunC3SecretUpdateTest runs the standard C3 secret update test workflow +func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) + + mcRef := deployment.GetName() + err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure Search Head Cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Ensure Indexers go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Wait for ClusterInitialized event to confirm cluster is fully initialized + idxcName := deployment.GetName() + "-idxc" + err = testcaseEnvInst.WaitForClusterInitialized(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) + Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Verify RF SF is met + testcaseEnvInst.Log.Info("Checkin RF SF before secret change") + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Get Current Secrets Struct + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + + // Update Secret Value on Secret Object + modifiedHecToken := testenv.GetRandomeHECToken() + modifiedValue := testenv.RandomDNSName(10) + updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) + + err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) + Expect(err).To(Succeed(), "Unable to update secret Object") + + // Ensure that Cluster Manager goes to update phase + if config.APIVersion == "v3" { + testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } else { + testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure Search Head Cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Wait for PasswordSyncCompleted event on SearchHeadCluster + shcName := deployment.GetName() + "-shc" + err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), shcName, 2*time.Minute) + Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on SearchHeadCluster") + + // Ensure Indexers go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Wait for PasswordSyncCompleted event on IndexerCluster + err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) + Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on IndexerCluster") + + // Wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.Log.Info("Checkin RF SF after secret change") + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) + + // Once Pods are READY check each pod for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) +} + +// RunM4SecretUpdateTest runs the standard M4 secret update test workflow +func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + // Download License File and create config map + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) + + siteCount := 3 + mcName := deployment.GetName() + var err error + + if config.APIVersion == "v3" { + err = deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) + } else { + err = deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) + } + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Ensure cluster configured as multisite + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Verify RF SF is met + testcaseEnvInst.Log.Info("Checkin RF SF before secret change") + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Get Current Secrets Struct + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + + // Update Secret Value on Secret Object + modifiedHecToken := testenv.GetRandomeHECToken() + modifiedValue := testenv.RandomDNSName(10) + updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) + + err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) + Expect(err).To(Succeed(), "Unable to update secret Object") + + // Ensure that Cluster Manager goes to update phase + if config.APIVersion == "v3" { + testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } else { + testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Wait for License Manager to be in READY status + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.Log.Info("Checkin RF SF after secret change") + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) + + // Once Pods are READY check each versioned secret for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) +} diff --git a/test/testenv/deployment_scenarios.go b/test/testenv/deployment_scenarios.go new file mode 100644 index 000000000..8a96af203 --- /dev/null +++ b/test/testenv/deployment_scenarios.go @@ -0,0 +1,306 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package testenv + +import ( + "context" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + . "github.com/onsi/gomega" +) + +// DeploymentScenarioResult holds the result of a deployment scenario +type DeploymentScenarioResult struct { + Standalone *enterpriseApi.Standalone + ClusterManager *enterpriseApi.ClusterManager + IndexerCluster *enterpriseApi.IndexerCluster + SearchHeadCluster *enterpriseApi.SearchHeadCluster + MonitoringConsole *enterpriseApi.MonitoringConsole + LicenseManager *enterpriseApi.LicenseManager +} + +// DeployStandardS1 deploys a standard S1 (Standalone) configuration +func (testcaseEnv *TestCaseEnv) DeployStandardS1(ctx context.Context, deployment *Deployment) *enterpriseApi.Standalone { + standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + // Verify standalone goes to ready state + testcaseEnv.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + return standalone +} + +// DeployStandardS1WithLM deploys S1 with License Manager +func (testcaseEnv *TestCaseEnv) DeployStandardS1WithLM(ctx context.Context, deployment *Deployment) (*enterpriseApi.Standalone, *enterpriseApi.LicenseManager) { + // Download License File and create config map + SetupLicenseConfigMap(ctx, testcaseEnv) + + // Create standalone Deployment with License Manager + mcRef := deployment.GetName() + standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) + Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") + + // Wait for License Manager to be in READY status + testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) + + // Wait for Standalone to be in READY status + testcaseEnv.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Get License Manager instance + lm := &enterpriseApi.LicenseManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), lm) + Expect(err).To(Succeed(), "Unable to get License Manager instance") + + return standalone, lm +} + +// DeployStandardS1WithMC deploys S1 with Monitoring Console +func (testcaseEnv *TestCaseEnv) DeployStandardS1WithMC(ctx context.Context, deployment *Deployment) (*enterpriseApi.Standalone, *enterpriseApi.MonitoringConsole) { + // Deploy Standalone + standalone := testcaseEnv.DeployStandardS1(ctx, deployment) + + // Deploy Monitoring Console + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + return standalone, mc +} + +// DeployStandardC3 deploys a standard C3 (Clustered indexer, search head cluster) configuration +func (testcaseEnv *TestCaseEnv) DeployStandardC3(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { + err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), indexerReplicas, true /*shc*/, "") + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + + // Ensure Search Head Cluster go to Ready phase + testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) + + // Ensure Indexers go to Ready phase + testcaseEnv.VerifySingleSiteIndexersReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnv.VerifyRFSFMet(ctx, deployment) + + // Get deployed instances + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + err = deployment.GetInstance(ctx, shcName, shc) + Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + + idxc := &enterpriseApi.IndexerCluster{} + idxcName := deployment.GetName() + "-idxc" + err = deployment.GetInstance(ctx, idxcName, idxc) + Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") + + return &DeploymentScenarioResult{ + ClusterManager: cm, + SearchHeadCluster: shc, + IndexerCluster: idxc, + } +} + +// DeployStandardC3WithLM deploys C3 with License Manager +func (testcaseEnv *TestCaseEnv) DeployStandardC3WithLM(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { + // Download License File and create config map + SetupLicenseConfigMap(ctx, testcaseEnv) + + mcRef := deployment.GetName() + err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), indexerReplicas, true /*shc*/, mcRef) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + + // Ensure Search Head Cluster go to Ready phase + testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) + + // Ensure Indexers go to Ready phase + testcaseEnv.VerifySingleSiteIndexersReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnv.VerifyRFSFMet(ctx, deployment) + + // Get deployed instances + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + err = deployment.GetInstance(ctx, shcName, shc) + Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + + idxc := &enterpriseApi.IndexerCluster{} + idxcName := deployment.GetName() + "-idxc" + err = deployment.GetInstance(ctx, idxcName, idxc) + Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") + + lm := &enterpriseApi.LicenseManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), lm) + Expect(err).To(Succeed(), "Unable to get License Manager instance") + + return &DeploymentScenarioResult{ + ClusterManager: cm, + SearchHeadCluster: shc, + IndexerCluster: idxc, + LicenseManager: lm, + } +} + +// DeployStandardC3WithMC deploys C3 with Monitoring Console +func (testcaseEnv *TestCaseEnv) DeployStandardC3WithMC(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { + result := testcaseEnv.DeployStandardC3(ctx, deployment, indexerReplicas) + + // Deploy Monitoring Console + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + result.MonitoringConsole = mc + return result +} + +// DeployStandardM4 deploys a standard M4 (Multisite indexer cluster, Search head cluster) configuration +func (testcaseEnv *TestCaseEnv) DeployStandardM4(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { + err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), indexerReplicas, siteCount, "") + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure cluster configured as multisite + testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnv.VerifyRFSFMet(ctx, deployment) + + // Get deployed instances + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + err = deployment.GetInstance(ctx, shcName, shc) + Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + + return &DeploymentScenarioResult{ + ClusterManager: cm, + SearchHeadCluster: shc, + } +} + +// DeployStandardM4WithLM deploys M4 with License Manager +func (testcaseEnv *TestCaseEnv) DeployStandardM4WithLM(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { + // Download License File and create config map + SetupLicenseConfigMap(ctx, testcaseEnv) + + mcRef := deployment.GetName() + err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), indexerReplicas, siteCount, mcRef) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure cluster configured as multisite + testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnv.VerifyRFSFMet(ctx, deployment) + + // Get deployed instances + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + err = deployment.GetInstance(ctx, shcName, shc) + Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + + lm := &enterpriseApi.LicenseManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), lm) + Expect(err).To(Succeed(), "Unable to get License Manager instance") + + return &DeploymentScenarioResult{ + ClusterManager: cm, + SearchHeadCluster: shc, + LicenseManager: lm, + } +} + +// DeployStandardM4WithMC deploys M4 with Monitoring Console +func (testcaseEnv *TestCaseEnv) DeployStandardM4WithMC(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { + result := testcaseEnv.DeployStandardM4(ctx, deployment, indexerReplicas, siteCount) + + // Deploy Monitoring Console + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + result.MonitoringConsole = mc + return result +} + +// DeployStandardM1 deploys a standard M1 (Multisite indexer cluster only) configuration +func (testcaseEnv *TestCaseEnv) DeployStandardM1(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { + err := deployment.DeployMultisiteCluster(ctx, deployment.GetName(), indexerReplicas, siteCount, "") + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure cluster configured as multisite + testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Verify RF SF is met + testcaseEnv.VerifyRFSFMet(ctx, deployment) + + // Get deployed instances + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + return &DeploymentScenarioResult{ + ClusterManager: cm, + } +} From 49d74bc8ca91950b15c0df2df4b4337633357b17 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Thu, 19 Mar 2026 13:04:10 +0100 Subject: [PATCH 03/20] CSPL-3775 Extract CRUD common code --- test/custom_resource_crud/crud_test_shared.go | 378 ++++++++++++++++++ .../custom_resource_crud_c3_test.go | 182 +-------- .../custom_resource_crud_m4_test.go | 79 +--- .../custom_resource_crud_s1_test.go | 49 +-- .../manager_custom_resource_crud_c3_test.go | 99 +---- .../manager_custom_resource_crud_m4_test.go | 73 +--- 6 files changed, 392 insertions(+), 468 deletions(-) create mode 100644 test/custom_resource_crud/crud_test_shared.go diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go new file mode 100644 index 000000000..460a1a559 --- /dev/null +++ b/test/custom_resource_crud/crud_test_shared.go @@ -0,0 +1,378 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package crcrud + +import ( + "context" + "fmt" + "time" + + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" + + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) + +// CRUDTestConfig holds configuration for CRUD tests to support both v3 and v4 API versions +type CRUDTestConfig struct { + LicenseManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) + ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) + APIVersion string +} + +// NewCRUDTestConfigV3 creates configuration for v3 API (LicenseMaster/ClusterMaster) +func NewCRUDTestConfigV3() *CRUDTestConfig { + return &CRUDTestConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterMasterReady(ctx, deployment) + }, + APIVersion: "v3", + } +} + +// NewCRUDTestConfigV4 creates configuration for v4 API (LicenseManager/ClusterManager) +func NewCRUDTestConfigV4() *CRUDTestConfig { + return &CRUDTestConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + }, + APIVersion: "v4", + } +} + +// RunS1CPUUpdateTest runs the standard S1 CPU limit update test workflow +func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, defaultCPULimits string, newCPULimits string) { + // Deploy Standalone + mcRef := deployment.GetName() + prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) + standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), mcRef, "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + // Verify Standalone goes to ready state + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Verify telemetry + testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) + testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify CPU limits before updating the CR + standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) + testcaseEnvInst.VerifyCPULimits(deployment, standalonePodName, defaultCPULimits) + + // Change CPU limits to trigger CR update + standalone.Spec.Resources.Limits = corev1.ResourceList{ + "cpu": resource.MustParse(newCPULimits), + } + err = deployment.UpdateCR(ctx, standalone) + Expect(err).To(Succeed(), "Unable to deploy standalone instance with updated CR ") + + // Verify Standalone is updating + testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) + + // Verify Standalone goes to ready state + testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseReady) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify CPU limits after updating the CR + testcaseEnvInst.VerifyCPULimits(deployment, standalonePodName, newCPULimits) +} + +// RunC3CPUUpdateTest runs the standard C3 CPU limit update test workflow +func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, defaultCPULimits string, newCPULimits string) { + // Deploy Single site Cluster and Search Head Clusters + mcRef := deployment.GetName() + prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) + err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the Cluster Manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure Search Head Cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Ensure Indexers go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Verify telemetry + testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) + testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Verify CPU limits on Indexers before updating the CR + indexerCount := 3 + for i := 0; i < indexerCount; i++ { + indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) + testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, defaultCPULimits) + } + + // Change CPU limits to trigger CR update + idxc := &enterpriseApi.IndexerCluster{} + instanceName := fmt.Sprintf("%s-idxc", deployment.GetName()) + err = deployment.GetInstance(ctx, instanceName, idxc) + Expect(err).To(Succeed(), "Unable to get instance of indexer cluster") + idxc.Spec.Resources.Limits = corev1.ResourceList{ + "cpu": resource.MustParse(newCPULimits), + } + err = deployment.UpdateCR(ctx, idxc) + Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") + + // Verify Indexer Cluster is updating + idxcName := deployment.GetName() + "-idxc" + testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) + + // Verify Indexers go to ready state + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Verify CPU limits on Indexers after updating the CR + for i := 0; i < indexerCount; i++ { + indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) + testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, newCPULimits) + } + + // Verify CPU limits on Search Heads before updating the CR + searchHeadCount := 3 + for i := 0; i < searchHeadCount; i++ { + SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) + testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) + } + + // Change CPU limits to trigger CR update + shc := &enterpriseApi.SearchHeadCluster{} + instanceName = fmt.Sprintf("%s-shc", deployment.GetName()) + err = deployment.GetInstance(ctx, instanceName, shc) + Expect(err).To(Succeed(), "Unable to fetch Search Head Cluster deployment") + + shc.Spec.Resources.Limits = corev1.ResourceList{ + "cpu": resource.MustParse(newCPULimits), + } + err = deployment.UpdateCR(ctx, shc) + Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster with updated CR") + + // Verify Search Head Cluster is updating + testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + + // Verify Search Head go to ready state + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify CPU limits on Search Heads after updating the CR + for i := 0; i < searchHeadCount; i++ { + SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) + testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, newCPULimits) + } +} + +// RunC3PVCDeletionTest runs the standard C3 PVC deletion test workflow +func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, verificationTimeout time.Duration) { + // Deploy Single site Cluster and Search Head Clusters + mcRef := deployment.GetName() + err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the Cluster Manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure Indexers go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Verify Search Head go to ready state + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Verify Search Heads PVCs (etc and var) exists + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, true, verificationTimeout) + + // Verify Deployer PVCs (etc and var) exists + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, true, verificationTimeout) + + // Verify Indexers PVCs (etc and var) exists + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, true, verificationTimeout) + + // Verify Cluster Manager PVCs (etc and var) exists + clusterManagerType := "cluster-master" + if config.APIVersion == "v4" { + clusterManagerType = "cluster-manager" + } + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, true, verificationTimeout) + + // Delete the Search Head Cluster + shc := &enterpriseApi.SearchHeadCluster{} + err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) + Expect(err).To(Succeed(), "Unable to GET SHC instance", "SHC Name", shc) + err = deployment.DeleteCR(ctx, shc) + Expect(err).To(Succeed(), "Unable to delete SHC instance", "SHC Name", shc) + + // Delete the Indexer Cluster + idxc := &enterpriseApi.IndexerCluster{} + err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) + Expect(err).To(Succeed(), "Unable to GET IDXC instance", "IDXC Name", idxc) + err = deployment.DeleteCR(ctx, idxc) + Expect(err).To(Succeed(), "Unable to delete IDXC instance", "IDXC Name", idxc) + + // Delete the Cluster Manager (v3 or v4) + if config.APIVersion == "v3" { + cm := &enterpriseApiV3.ClusterMaster{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to GET Cluster Master instance", "Cluster Master Name", cm) + err = deployment.DeleteCR(ctx, cm) + Expect(err).To(Succeed(), "Unable to delete Cluster Master instance", "Cluster Master Name", cm) + } else { + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Unable to GET Cluster Manager instance", "Cluster Manager Name", cm) + err = deployment.DeleteCR(ctx, cm) + Expect(err).To(Succeed(), "Unable to delete Cluster Manager instance", "Cluster Manager Name", cm) + } + + // Delete Monitoring Console + err = deployment.GetInstance(ctx, mcRef, mc) + Expect(err).To(Succeed(), "Unable to GET Monitoring Console instance", "Monitoring Console Name", mcRef) + err = deployment.DeleteCR(ctx, mc) + Expect(err).To(Succeed(), "Unable to delete Monitoring Console instance", "Monitoring Console Name", mcRef) + + // Verify Search Heads PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, false, verificationTimeout) + + // Verify Deployer PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, false, verificationTimeout) + + // Verify Indexers PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, false, verificationTimeout) + + // Verify Cluster Manager PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, false, verificationTimeout) + + // Verify Monitoring Console PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) +} + +// RunM4CPUUpdateTest runs the standard M4 CPU limit update test workflow +func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, defaultCPULimits string, newCPULimits string) { + // Deploy Multisite Cluster and Search Head Clusters + mcRef := deployment.GetName() + prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) + siteCount := 3 + var err error + + if config.APIVersion == "v3" { + err = deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) + } else { + err = deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) + } + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure cluster configured as multisite + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify telemetry + testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) + testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) + + // Deploy Monitoring Console CRD + mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Verify CPU limits on Indexers before updating the CR + for i := 1; i <= siteCount; i++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) + testcaseEnvInst.VerifyCPULimits(deployment, podName, defaultCPULimits) + } + + // Change CPU limits to trigger CR update + idxc := &enterpriseApi.IndexerCluster{} + for i := 1; i <= siteCount; i++ { + siteName := fmt.Sprintf("site%d", i) + instanceName := fmt.Sprintf("%s-%s", deployment.GetName(), siteName) + err = deployment.GetInstance(ctx, instanceName, idxc) + Expect(err).To(Succeed(), "Unable to fetch Indexer Cluster deployment") + idxc.Spec.Resources.Limits = corev1.ResourceList{ + "cpu": resource.MustParse(newCPULimits), + } + err = deployment.UpdateCR(ctx, idxc) + Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") + } + + // Verify Indexer Cluster is updating + idxcName := deployment.GetName() + "-" + "site1" + testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) + + // Verify Indexers go to ready state + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Verify CPU limits after updating the CR + for i := 1; i <= siteCount; i++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) + testcaseEnvInst.VerifyCPULimits(deployment, podName, newCPULimits) + } +} diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go index 70fcf38d5..4ae4d41a7 100644 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/custom_resource_crud_c3_test.go @@ -15,17 +15,11 @@ package crcrud import ( "context" - "fmt" "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" ) var _ = Describe("Crcrud test for SVA C3", func() { @@ -56,183 +50,15 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - - // Deploy Single site Cluster and Search Head Clusters - mcRef := deployment.GetName() - prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits on Indexers before updating the CR - indexerCount := 3 - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - idxc := &enterpriseApi.IndexerCluster{} - instanceName := fmt.Sprintf("%s-idxc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to get instance of indexer cluster") - idxc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") - - // Verify Indexer Cluster is updating - idxcName := deployment.GetName() + "-idxc" - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) - - // Verify Indexers go to ready state - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify CPU limits on Indexers after updating the CR - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, newCPULimits) - } - - // Verify CPU limits on Search Heads before updating the CR - searchHeadCount := 3 - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - shc := &enterpriseApi.SearchHeadCluster{} - instanceName = fmt.Sprintf("%s-shc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, shc) - Expect(err).To(Succeed(), "Unable to fetch Search Head Cluster deployment") - - shc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster with updated CR") - - // Verify Search Head Cluster is updating - testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify CPU limits on Search Heads after updating the CR - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, newCPULimits) - } + config := NewCRUDTestConfigV3() + RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - - // Deploy Single site Cluster and Search Head Clusters - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify Search Heads PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, true, verificationTimeout) - - // Verify Deployer PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, true, verificationTimeout) - - // Verify Indexers PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, true, verificationTimeout) - - // Verify Cluster Master PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, splcommon.ClusterManager, 1, true, verificationTimeout) - - // Delete the Search Head Cluster - shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Unable to GET SHC instance", "SHC Name", shc) - err = deployment.DeleteCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to delete SHC instance", "SHC Name", shc) - - // Delete the Indexer Cluster - idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) - Expect(err).To(Succeed(), "Unable to GET IDXC instance", "IDXC Name", idxc) - err = deployment.DeleteCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to delete IDXC instance", "IDXC Name", idxc) - - // Delete the Cluster Master - cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to GET Cluster Manager instance", "Cluster Manager Name", cm) - err = deployment.DeleteCR(ctx, cm) - Expect(err).To(Succeed(), "Unable to delete Cluster Manager instance", "Cluster Manger Name", cm) - - // Delete Monitoring Console - err = deployment.GetInstance(ctx, mcRef, mc) - Expect(err).To(Succeed(), "Unable to GET Monitoring Console instance", "Monitoring Console Name", mcRef) - err = deployment.DeleteCR(ctx, mc) - Expect(err).To(Succeed(), "Unable to delete Monitoring Console instance", "Monitoring Console Name", mcRef) - - // Verify Search Heads PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, false, verificationTimeout) - - // Verify Deployer PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, false, verificationTimeout) - - // Verify Indexers PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, false, verificationTimeout) - - // Verify Cluster Master PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, splcommon.ClusterManager, 1, false, verificationTimeout) - - // Verify Monitoring Console PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) + config := NewCRUDTestConfigV3() + RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) }) }) }) diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index 5f693b28d..48c7c5e34 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -15,15 +15,10 @@ package crcrud import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" ) var _ = Describe("Crcrud test for SVA M4", func() { @@ -51,78 +46,8 @@ var _ = Describe("Crcrud test for SVA M4", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("mastercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - - // Deploy Multisite Cluster and Search Head Clusters - mcRef := deployment.GetName() - prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) - siteCount := 3 - err := deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits on Indexers before updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - idxc := &enterpriseApi.IndexerCluster{} - for i := 1; i <= siteCount; i++ { - siteName := fmt.Sprintf("site%d", i) - instanceName := fmt.Sprintf("%s-%s", deployment.GetName(), siteName) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to fetch Indexer Cluster deployment") - idxc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") - } - - // Verify Indexer Cluster is updating - idxcName := deployment.GetName() + "-" + "site1" - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) - - // Verify Indexers go to ready state - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits after updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, newCPULimits) - } + config := NewCRUDTestConfigV3() + RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) }) diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go index 35591518e..4ee64de8a 100644 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ b/test/custom_resource_crud/custom_resource_crud_s1_test.go @@ -15,15 +15,10 @@ package crcrud import ( "context" - "fmt" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" ) var _ = Describe("Crcrud test for SVA S1", func() { @@ -51,49 +46,7 @@ var _ = Describe("Crcrud test for SVA S1", func() { Context("Standalone deployment (S1)", func() { It("managercrcrud, integration, s1: can deploy a standalone instance, change its CR, update the instance", func() { - - // Deploy Standalone - mcRef := deployment.GetName() - prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Verify Standalone goes to ready state - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify CPU limits before updating the CR - standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - testcaseEnvInst.VerifyCPULimits(deployment, standalonePodName, defaultCPULimits) - - // Change CPU limits to trigger CR update - standalone.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, standalone) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with updated CR ") - - // Verify Standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Verify Standalone goes to ready state - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseReady) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify CPU limits after updating the CR - testcaseEnvInst.VerifyCPULimits(deployment, standalonePodName, newCPULimits) + RunS1CPUUpdateTest(ctx, deployment, testcaseEnvInst, defaultCPULimits, newCPULimits) }) }) }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index 056c4efe9..35197d6f6 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -18,15 +18,13 @@ import ( "fmt" "time" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - - //splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" - "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" ) var _ = Describe("Crcrud test for SVA C3", func() { @@ -57,95 +55,8 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - - // Deploy Single site Cluster and Search Head Clusters - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits on Indexers before updating the CR - indexerCount := 3 - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - idxc := &enterpriseApi.IndexerCluster{} - instanceName := fmt.Sprintf("%s-idxc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to get instance of indexer cluster") - idxc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") - - // Verify Indexer Cluster is updating - idxcName := deployment.GetName() + "-idxc" - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) - - // Verify Indexers go to ready state - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify CPU limits on Indexers after updating the CR - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, newCPULimits) - } - - // Verify CPU limits on Search Heads before updating the CR - searchHeadCount := 3 - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - shc := &enterpriseApi.SearchHeadCluster{} - instanceName = fmt.Sprintf("%s-shc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, shc) - Expect(err).To(Succeed(), "Unable to fetch Search Head Cluster deployment") - - shc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster with updated CR") - - // Verify Search Head Cluster is updating - testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify CPU limits on Search Heads after updating the CR - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, newCPULimits) - } + config := NewCRUDTestConfigV4() + RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index 392e983aa..e00e5619f 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -15,14 +15,10 @@ package crcrud import ( "context" - "fmt" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" ) var _ = Describe("Crcrud test for SVA M4", func() { @@ -50,73 +46,8 @@ var _ = Describe("Crcrud test for SVA M4", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("managercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - - // Deploy Multisite Cluster and Search Head Clusters - mcRef := deployment.GetName() - siteCount := 3 - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits on Indexers before updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, defaultCPULimits) - } - - // Change CPU limits to trigger CR update - idxc := &enterpriseApi.IndexerCluster{} - for i := 1; i <= siteCount; i++ { - siteName := fmt.Sprintf("site%d", i) - instanceName := fmt.Sprintf("%s-%s", deployment.GetName(), siteName) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to fetch Indexer Cluster deployment") - idxc.Spec.Resources.Limits = corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") - } - - // Verify Indexer Cluster is updating - idxcName := deployment.GetName() + "-" + "site1" - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) - - // Verify Indexers go to ready state - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify CPU limits after updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, newCPULimits) - } + config := NewCRUDTestConfigV4() + RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) }) From c833d438de36322f0a46cb279616deea3f012e45 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Thu, 19 Mar 2026 13:18:30 +0100 Subject: [PATCH 04/20] CSPL-3775 Extract common code for smartstore tests --- test/smartstore/manager_smartstore_test.go | 226 +-------------- test/smartstore/smartstore_test.go | 230 +-------------- test/smartstore/smartstore_test_shared.go | 311 +++++++++++++++++++++ 3 files changed, 319 insertions(+), 448 deletions(-) create mode 100644 test/smartstore/smartstore_test_shared.go diff --git a/test/smartstore/manager_smartstore_test.go b/test/smartstore/manager_smartstore_test.go index 09883fcc2..69bb1e79a 100644 --- a/test/smartstore/manager_smartstore_test.go +++ b/test/smartstore/manager_smartstore_test.go @@ -2,11 +2,8 @@ package smartstore import ( "context" - "fmt" "time" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -33,235 +30,20 @@ var _ = Describe("Smartstore test", func() { Context("Standalone Deployment (S1)", func() { It("managersmartstore, integration: Can configure multiple indexes through app", func() { - volName := "test-volume-" + testenv.RandomDNSName(3) - indexVolumeMap := map[string]string{"test-index-" + testenv.RandomDNSName(3): volName, - "test-index-" + testenv.RandomDNSName(3): volName, - } - testcaseEnvInst.Log.Info("Index secret name ", "secret name ", testcaseEnvInst.GetIndexSecretName()) - - var indexSpec []enterpriseApi.IndexSpec - volumeSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - - // Create index volume spec from index volume map - for index, volume := range indexVolumeMap { - indexSpec = append(indexSpec, testenv.GenerateIndexSpec(index, volume)) - } - - // Generate smartstore spec - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volumeSpec, - IndexList: indexSpec, - } - - // Deploy Standalone - standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for Standalone to reach Ready phase - err = testcaseEnvInst.WaitForStandalonePhase(ctx, deployment, testcaseEnvInst.GetName(), standalone.Name, enterpriseApi.PhaseReady, 5*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for Standalone to reach Ready phase") - - // Verify standalone goes to ready state and stays ready - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Check index on pod - podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - for indexName := range indexVolumeMap { - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - } - - // Ingest data to the index - for indexName := range indexVolumeMap { - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - } - - // Roll Hot Buckets on the test index by restarting splunk and check for index on S3 - for indexName := range indexVolumeMap { - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - } + RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, 5*time.Minute) }) }) Context("Standalone Deployment (S1)", func() { It("managersmartstore, integration: Can configure indexes which use default volumes through app", func() { - volName := "test-volume-" + testenv.RandomDNSName(3) - indexName := "test-index-" + testenv.RandomDNSName(3) - - specialConfig := map[string]int{"MaxGlobalDataSizeMB": 100, "MaxGlobalRawDataSizeMB": 100} - - volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - - indexSpec := []enterpriseApi.IndexSpec{{Name: indexName, RemotePath: indexName}} - defaultSmartStoreSpec := enterpriseApi.IndexConfDefaultsSpec{IndexAndGlobalCommonSpec: enterpriseApi.IndexAndGlobalCommonSpec{VolName: volName, MaxGlobalDataSizeMB: uint(specialConfig["MaxGlobalDataSizeMB"]), MaxGlobalRawDataSizeMB: uint(specialConfig["MaxGlobalRawDataSizeMB"])}} - cacheManagerSmartStoreSpec := enterpriseApi.CacheManagerSpec{MaxCacheSizeMB: 9900000, EvictionPaddingSizeMB: 1000, MaxConcurrentDownloads: 6, MaxConcurrentUploads: 6, EvictionPolicy: "lru"} - - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volSpec, - IndexList: indexSpec, - Defaults: defaultSmartStoreSpec, - CacheManagerConf: cacheManagerSmartStoreSpec, - } - - // Deploy Standalone with given smartstore spec - standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Verify standalone goes to ready state - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Check index on pod - podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - - // Check special index configs - testcaseEnvInst.VerifyIndexConfigsMatch(ctx, deployment, podName, indexName, specialConfig["MaxGlobalDataSizeMB"], specialConfig["MaxGlobalRawDataSizeMB"]) - - // Ingest data to the index - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - - // Roll Hot Buckets on the test index by restarting splunk - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - - // Check for indexes on S3 - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - - // Verify Cachemanager Values - serverConfPath := "/opt/splunk/etc/apps/splunk-operator/local/server.conf" - - // Validate MaxCacheSizeMB - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_cache_size", fmt.Sprint(cacheManagerSmartStoreSpec.MaxCacheSizeMB)) - - // Validate EvictionPaddingSizeMB - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_padding", fmt.Sprint(cacheManagerSmartStoreSpec.EvictionPaddingSizeMB)) - - // Validate MaxConcurrentDownloads - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_downloads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentDownloads)) - - // Validate MaxConcurrentUploads - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_uploads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentUploads)) - - // Validate EvictionPolicy - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_policy", cacheManagerSmartStoreSpec.EvictionPolicy) - + RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) }) }) Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { It("managersmartstore, smoke: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - - volName := "test-volume-" + testenv.RandomDNSName(3) - indexName := "test-index-" + testenv.RandomDNSName(3) - - volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - indexSpec := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexName, volName)} - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volSpec, - IndexList: indexSpec, - } - - siteCount := 3 - err := deployment.DeployMultisiteClusterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Check index on pod - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - } - - // Ingest data to the index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - } - - testcaseEnvInst.Log.Info("Adding new index to Cluster Manager CR") - indexNameTwo := "test-index-two" + testenv.RandomDNSName(3) - indexList := []string{indexName, indexNameTwo} - newIndex := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexNameTwo, volName)} - - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") - cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster master") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Check index on pod - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - for _, index := range indexList { - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, index) - } - } - - // Ingest data to the index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenvInstance.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) - testenv.IngestFileViaMonitor(ctx, logFile, indexNameTwo, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexNameTwo) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenvInstance.Log.Info("Checking index on S3", "Index Name", indexNameTwo, "Pod Name", podName) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexNameTwo, podName) - } + config := NewSmartStoreTestConfigV4() + RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) }) }) }) diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index 5d071faaf..86a51c328 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -2,13 +2,11 @@ package smartstore import ( "context" - "fmt" "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" @@ -34,240 +32,20 @@ var _ = Describe("Smartstore test", func() { Context("Standalone Deployment (S1)", func() { It("mastersmartstore, integration: Can configure multiple indexes through app", func() { - volName := "test-volume-" + testenv.RandomDNSName(3) - indexVolumeMap := map[string]string{"test-index-" + testenv.RandomDNSName(3): volName, - "test-index-" + testenv.RandomDNSName(3): volName, - } - testcaseEnvInst.Log.Info("Index secret name ", "secret name ", testcaseEnvInst.GetIndexSecretName()) - - var indexSpec []enterpriseApi.IndexSpec - volumeSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - - // Create index volume spec from index volume map - for index, volume := range indexVolumeMap { - indexSpec = append(indexSpec, testenv.GenerateIndexSpec(index, volume)) - } - - // Generate smartstore spec - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volumeSpec, - IndexList: indexSpec, - } - - // Deploy Standalone - standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for Standalone to reach Ready phase - err = testcaseEnvInst.WaitForStandalonePhase(ctx, deployment, testcaseEnvInst.GetName(), standalone.Name, enterpriseApi.PhaseReady, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for Standalone to reach Ready phase") - - // Verify standalone goes to ready state and stays ready - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Check index on pod - podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - for indexName := range indexVolumeMap { - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - } - - // Ingest data to the index - for indexName := range indexVolumeMap { - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - } - - // Roll Hot Buckets on the test index by restarting splunk and check for index on S3 - for indexName := range indexVolumeMap { - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - } + RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, 2*time.Minute) }) }) Context("Standalone Deployment (S1)", func() { It("mastersmartstore, integration: Can configure indexes which use default volumes through app", func() { - volName := "test-volume-" + testenv.RandomDNSName(3) - indexName := "test-index-" + testenv.RandomDNSName(3) - - specialConfig := map[string]int{"MaxGlobalDataSizeMB": 100, "MaxGlobalRawDataSizeMB": 100} - - volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - - indexSpec := []enterpriseApi.IndexSpec{{Name: indexName, RemotePath: indexName}} - defaultSmartStoreSpec := enterpriseApi.IndexConfDefaultsSpec{IndexAndGlobalCommonSpec: enterpriseApi.IndexAndGlobalCommonSpec{VolName: volName, MaxGlobalDataSizeMB: uint(specialConfig["MaxGlobalDataSizeMB"]), MaxGlobalRawDataSizeMB: uint(specialConfig["MaxGlobalRawDataSizeMB"])}} - cacheManagerSmartStoreSpec := enterpriseApi.CacheManagerSpec{MaxCacheSizeMB: 9900000, EvictionPaddingSizeMB: 1000, MaxConcurrentDownloads: 6, MaxConcurrentUploads: 6, EvictionPolicy: "lru"} - - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volSpec, - IndexList: indexSpec, - Defaults: defaultSmartStoreSpec, - CacheManagerConf: cacheManagerSmartStoreSpec, - } - - // Deploy Standalone with given smartstore spec - standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Verify standalone goes to ready state - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Check index on pod - podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - - // Check special index configs - testcaseEnvInst.VerifyIndexConfigsMatch(ctx, deployment, podName, indexName, specialConfig["MaxGlobalDataSizeMB"], specialConfig["MaxGlobalRawDataSizeMB"]) - - // Ingest data to the index - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - - // Roll Hot Buckets on the test index by restarting splunk - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - - // Check for indexes on S3 - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - - // Verify Cachemanager Values - serverConfPath := "/opt/splunk/etc/apps/splunk-operator/local/server.conf" - - // Validate MaxCacheSizeMB - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_cache_size", fmt.Sprint(cacheManagerSmartStoreSpec.MaxCacheSizeMB)) - - // Validate EvictionPaddingSizeMB - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_padding", fmt.Sprint(cacheManagerSmartStoreSpec.EvictionPaddingSizeMB)) - - // Validate MaxConcurrentDownloads - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_downloads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentDownloads)) - - // Validate MaxConcurrentUploads - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_uploads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentUploads)) - - // Validate EvictionPolicy - testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_policy", cacheManagerSmartStoreSpec.EvictionPolicy) - + RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) }) }) Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { It("mastersmartstore, m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - - volName := "test-volume-" + testenv.RandomDNSName(3) - indexName := "test-index-" + testenv.RandomDNSName(3) - - volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} - indexSpec := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexName, volName)} - smartStoreSpec := enterpriseApi.SmartStoreSpec{ - VolList: volSpec, - IndexList: indexSpec, - } - - siteCount := 3 - err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Check index on pod - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - } - - // Ingest data to the index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - } - - oldBundleHash := testenv.GetClusterManagerBundleHash(ctx, deployment, "ClusterMaster") - - testcaseEnvInst.Log.Info("Adding new index to Cluster Manager CR") - indexNameTwo := "test-index-" + testenv.RandomDNSName(3) - indexList := []string{indexName, indexNameTwo} - newIndex := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexNameTwo, volName)} - - cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") - cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster master") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify new bundle is pushed - testcaseEnvInst.VerifyClusterManagerBundlePush(ctx, deployment, testcaseEnvInst.GetName(), 1, oldBundleHash) - - // Check index on pod - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - for _, index := range indexList { - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, index) - } - } - - // Ingest data to the index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenvInstance.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) - testenv.IngestFileViaMonitor(ctx, logFile, indexNameTwo, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexNameTwo) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenvInstance.Log.Info("Checking index on S3", "Index Name", indexNameTwo, "Pod Name", podName) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexNameTwo, podName) - } + config := NewSmartStoreTestConfigV3() + RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go new file mode 100644 index 000000000..69ed49120 --- /dev/null +++ b/test/smartstore/smartstore_test_shared.go @@ -0,0 +1,311 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package smartstore + +import ( + "context" + "fmt" + "time" + + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" + + . "github.com/onsi/gomega" +) + +// SmartStoreTestConfig holds configuration for SmartStore tests to support both v3 and v4 API versions +type SmartStoreTestConfig struct { + ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) + APIVersion string +} + +// NewSmartStoreTestConfigV3 creates configuration for v3 API (ClusterMaster) +func NewSmartStoreTestConfigV3() *SmartStoreTestConfig { + return &SmartStoreTestConfig{ + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterMasterReady(ctx, deployment) + }, + APIVersion: "v3", + } +} + +// NewSmartStoreTestConfigV4 creates configuration for v4 API (ClusterManager) +func NewSmartStoreTestConfigV4() *SmartStoreTestConfig { + return &SmartStoreTestConfig{ + ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + }, + APIVersion: "v4", + } +} + +// RunS1MultipleIndexesTest runs the standard S1 multiple indexes SmartStore test workflow +func RunS1MultipleIndexesTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, waitTimeout time.Duration) { + volName := "test-volume-" + testenv.RandomDNSName(3) + indexVolumeMap := map[string]string{ + "test-index-" + testenv.RandomDNSName(3): volName, + "test-index-" + testenv.RandomDNSName(3): volName, + } + testcaseEnvInst.Log.Info("Index secret name ", "secret name ", testcaseEnvInst.GetIndexSecretName()) + + var indexSpec []enterpriseApi.IndexSpec + volumeSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} + + // Create index volume spec from index volume map + for index, volume := range indexVolumeMap { + indexSpec = append(indexSpec, testenv.GenerateIndexSpec(index, volume)) + } + + // Generate smartstore spec + smartStoreSpec := enterpriseApi.SmartStoreSpec{ + VolList: volumeSpec, + IndexList: indexSpec, + } + + // Deploy Standalone + standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + + // Wait for Standalone to reach Ready phase + err = testcaseEnvInst.WaitForStandalonePhase(ctx, deployment, testcaseEnvInst.GetName(), standalone.Name, enterpriseApi.PhaseReady, waitTimeout) + Expect(err).To(Succeed(), "Timed out waiting for Standalone to reach Ready phase") + + // Verify standalone goes to ready state and stays ready + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Check index on pod + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) + for indexName := range indexVolumeMap { + testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) + } + + // Ingest data to the index + for indexName := range indexVolumeMap { + logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) + testenv.CreateMockLogfile(logFile, 2000) + testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + } + + // Roll Hot Buckets on the test index by restarting splunk and check for index on S3 + for indexName := range indexVolumeMap { + testenv.RollHotToWarm(ctx, deployment, podName, indexName) + testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) + } +} + +// RunS1DefaultVolumesTest runs the standard S1 default volumes SmartStore test workflow +func RunS1DefaultVolumesTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) { + volName := "test-volume-" + testenv.RandomDNSName(3) + indexName := "test-index-" + testenv.RandomDNSName(3) + + specialConfig := map[string]int{"MaxGlobalDataSizeMB": 100, "MaxGlobalRawDataSizeMB": 100} + + volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} + + indexSpec := []enterpriseApi.IndexSpec{{Name: indexName, RemotePath: indexName}} + defaultSmartStoreSpec := enterpriseApi.IndexConfDefaultsSpec{IndexAndGlobalCommonSpec: enterpriseApi.IndexAndGlobalCommonSpec{VolName: volName, MaxGlobalDataSizeMB: uint(specialConfig["MaxGlobalDataSizeMB"]), MaxGlobalRawDataSizeMB: uint(specialConfig["MaxGlobalRawDataSizeMB"])}} + cacheManagerSmartStoreSpec := enterpriseApi.CacheManagerSpec{MaxCacheSizeMB: 9900000, EvictionPaddingSizeMB: 1000, MaxConcurrentDownloads: 6, MaxConcurrentUploads: 6, EvictionPolicy: "lru"} + + smartStoreSpec := enterpriseApi.SmartStoreSpec{ + VolList: volSpec, + IndexList: indexSpec, + Defaults: defaultSmartStoreSpec, + CacheManagerConf: cacheManagerSmartStoreSpec, + } + + // Deploy Standalone with given smartstore spec + standalone, err := deployment.DeployStandaloneWithGivenSmartStoreSpec(ctx, deployment.GetName(), smartStoreSpec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + + // Verify standalone goes to ready state + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + // Check index on pod + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) + testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) + + // Check special index configs + testcaseEnvInst.VerifyIndexConfigsMatch(ctx, deployment, podName, indexName, specialConfig["MaxGlobalDataSizeMB"], specialConfig["MaxGlobalRawDataSizeMB"]) + + // Ingest data to the index + logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) + testenv.CreateMockLogfile(logFile, 2000) + testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + + // Roll Hot Buckets on the test index by restarting splunk + testenv.RollHotToWarm(ctx, deployment, podName, indexName) + + // Check for indexes on S3 + testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) + + // Verify Cachemanager Values + serverConfPath := "/opt/splunk/etc/apps/splunk-operator/local/server.conf" + + // Validate MaxCacheSizeMB + testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_cache_size", fmt.Sprint(cacheManagerSmartStoreSpec.MaxCacheSizeMB)) + + // Validate EvictionPaddingSizeMB + testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_padding", fmt.Sprint(cacheManagerSmartStoreSpec.EvictionPaddingSizeMB)) + + // Validate MaxConcurrentDownloads + testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_downloads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentDownloads)) + + // Validate MaxConcurrentUploads + testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "max_concurrent_uploads", fmt.Sprint(cacheManagerSmartStoreSpec.MaxConcurrentUploads)) + + // Validate EvictionPolicy + testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_policy", cacheManagerSmartStoreSpec.EvictionPolicy) +} + +// RunM4MultisiteSmartStoreTest runs the standard M4 multisite SmartStore test workflow +func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig) { + volName := "test-volume-" + testenv.RandomDNSName(3) + indexName := "test-index-" + testenv.RandomDNSName(3) + + volSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} + indexSpec := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexName, volName)} + smartStoreSpec := enterpriseApi.SmartStoreSpec{ + VolList: volSpec, + IndexList: indexSpec, + } + + siteCount := 3 + var err error + + if config.APIVersion == "v3" { + err = deployment.DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) + } else { + err = deployment.DeployMultisiteClusterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) + } + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure cluster configured as multisite + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Check index on pod + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) + } + + // Ingest data to the index + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) + testenv.CreateMockLogfile(logFile, 2000) + testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + } + + // Roll Hot Buckets on the test index per indexer + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + testenv.RollHotToWarm(ctx, deployment, podName, indexName) + } + + // Roll index buckets and Check for indexes on S3 + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) + } + + // Get old bundle hash before adding new index + var oldBundleHash string + if config.APIVersion == "v3" { + oldBundleHash = testenv.GetClusterManagerBundleHash(ctx, deployment, "ClusterMaster") + } else { + oldBundleHash = testenv.GetClusterManagerBundleHash(ctx, deployment, "ClusterManager") + } + + testcaseEnvInst.Log.Info("Adding new index to Cluster Manager CR") + indexNameTwo := "test-index-" + testenv.RandomDNSName(3) + indexList := []string{indexName, indexNameTwo} + newIndex := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexNameTwo, volName)} + + // Update CR with new index based on API version + if config.APIVersion == "v3" { + cm := &enterpriseApiV3.ClusterMaster{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") + cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) + err = deployment.UpdateCR(ctx, cm) + Expect(err).To(Succeed(), "Failed to add new index to cluster master") + } else { + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) + err = deployment.UpdateCR(ctx, cm) + Expect(err).To(Succeed(), "Failed to add new index to cluster manager") + } + + // Ensure that the cluster-manager goes to Ready phase + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + + // Ensure the indexers of all sites go to Ready phase + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + + // Ensure search head cluster go to Ready phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify RF SF is met + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + // Verify new bundle is pushed (only for v3) + if config.APIVersion == "v3" { + testcaseEnvInst.VerifyClusterManagerBundlePush(ctx, deployment, testcaseEnvInst.GetName(), 1, oldBundleHash) + } + + // Check index on pod + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + for _, index := range indexList { + testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, index) + } + } + + // Ingest data to the new index + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) + testenv.CreateMockLogfile(logFile, 2000) + testcaseEnvInst.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) + testenv.IngestFileViaMonitor(ctx, logFile, indexNameTwo, podName, deployment) + } + + // Roll Hot Buckets on the test index per indexer + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + testenv.RollHotToWarm(ctx, deployment, podName, indexNameTwo) + } + + // Roll index buckets and Check for indexes on S3 + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) + testcaseEnvInst.Log.Info("Checking index on S3", "Index Name", indexNameTwo, "Pod Name", podName) + testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexNameTwo, podName) + } +} From 7f2a3fb57f6d89976950d1e5ceb2fb19fd469387 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 08:02:27 +0100 Subject: [PATCH 05/20] CSPL-3775 Combining code into re-usable functions --- .../c3/appframework_aws_test.go | 7 +- .../c3/manager_appframework_test.go | 7 +- .../c3/appframework_azure_test.go | 7 +- .../c3/manager_appframework_azure_test.go | 7 +- .../c3/manager_appframework_test.go | 7 +- test/custom_resource_crud/crud_test_shared.go | 114 +++------- .../manager_custom_resource_crud_c3_test.go | 16 +- test/licensemanager/lm_test_shared.go | 60 ++---- .../monitoring_console_test.go | 197 +++-------------- test/secret/secret_test_shared.go | 37 +--- test/smartstore/smartstore_test_shared.go | 80 +------ test/smoke/smoke_test.go | 38 +--- test/testenv/assertion_helpers.go | 201 ++++++++++++++++++ test/testenv/common_test_patterns.go | 115 ++++++++++ test/testenv/cr_update_helpers.go | 83 ++++++++ test/testenv/deployment_scenarios.go | 10 +- test/testenv/multisite_helpers.go | 78 +++++++ 17 files changed, 589 insertions(+), 475 deletions(-) create mode 100644 test/testenv/assertion_helpers.go create mode 100644 test/testenv/common_test_patterns.go create mode 100644 test/testenv/cr_update_helpers.go create mode 100644 test/testenv/multisite_helpers.go diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 857ba1742..8356f30be 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -693,12 +693,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - for i := 0; i < int(scaledIndexerReplicas); i++ { - podName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, "main", podName, deployment) - } + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index a49fd3eb4..d929b2797 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -838,12 +838,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - for i := 0; i < int(scaledIndexerReplicas); i++ { - podName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, "main", podName, deployment) - } + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index c4c6b4eff..4e3490e33 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -674,12 +674,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - for i := 0; i < int(scaledIndexerReplicas); i++ { - podName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, "main", podName, deployment) - } + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index 8a8a1ec5c..9eb82d08e 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -672,12 +672,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - for i := 0; i < int(scaledIndexerReplicas); i++ { - podName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, "main", podName, deployment) - } + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/appframework_gcp/c3/manager_appframework_test.go b/test/appframework_gcp/c3/manager_appframework_test.go index 7c10a6b87..264b5eecc 100644 --- a/test/appframework_gcp/c3/manager_appframework_test.go +++ b/test/appframework_gcp/c3/manager_appframework_test.go @@ -839,12 +839,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - for i := 0; i < int(scaledIndexerReplicas); i++ { - podName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, "main", podName, deployment) - } + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index 460a1a559..f492f5f8d 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -62,25 +62,15 @@ func NewCRUDTestConfigV4() *CRUDTestConfig { // RunS1CPUUpdateTest runs the standard S1 CPU limit update test workflow func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, defaultCPULimits string, newCPULimits string) { - // Deploy Standalone - mcRef := deployment.GetName() - prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Verify Standalone goes to ready state - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + // Deploy and verify Standalone + standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), deployment.GetName(), "") // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) + testcaseEnvInst.TriggerAndVerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Verify CPU limits before updating the CR standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) @@ -90,7 +80,7 @@ func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes standalone.Spec.Resources.Limits = corev1.ResourceList{ "cpu": resource.MustParse(newCPULimits), } - err = deployment.UpdateCR(ctx, standalone) + err := deployment.UpdateCR(ctx, standalone) Expect(err).To(Succeed(), "Unable to deploy standalone instance with updated CR ") // Verify Standalone is updating @@ -110,50 +100,25 @@ func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, defaultCPULimits string, newCPULimits string) { // Deploy Single site Cluster and Search Head Clusters mcRef := deployment.GetName() - prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Ensure that the Cluster Manager goes to Ready phase + // Verify cluster is ready, RF/SF is met, and MC is ready config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.StandardC3Verification(ctx, deployment, deployment.GetName(), testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "")) // Verify CPU limits on Indexers before updating the CR indexerCount := 3 - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, defaultCPULimits) - } + testcaseEnvInst.VerifyIndexerCPULimits(deployment, deployment.GetName(), indexerCount, defaultCPULimits) // Change CPU limits to trigger CR update idxc := &enterpriseApi.IndexerCluster{} instanceName := fmt.Sprintf("%s-idxc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to get instance of indexer cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, instanceName, "Unable to get instance of indexer cluster") idxc.Spec.Resources.Limits = corev1.ResourceList{ "cpu": resource.MustParse(newCPULimits), } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") + testenv.UpdateCRWithExpect(ctx, deployment, idxc, "Unable to deploy Indexer Cluster with updated CR") // Verify Indexer Cluster is updating idxcName := deployment.GetName() + "-idxc" @@ -163,29 +128,21 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) // Verify CPU limits on Indexers after updating the CR - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, indexerPodName, newCPULimits) - } + testcaseEnvInst.VerifyIndexerCPULimits(deployment, deployment.GetName(), indexerCount, newCPULimits) // Verify CPU limits on Search Heads before updating the CR searchHeadCount := 3 - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) - } + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) // Change CPU limits to trigger CR update shc := &enterpriseApi.SearchHeadCluster{} instanceName = fmt.Sprintf("%s-shc", deployment.GetName()) - err = deployment.GetInstance(ctx, instanceName, shc) - Expect(err).To(Succeed(), "Unable to fetch Search Head Cluster deployment") + testenv.GetInstanceWithExpect(ctx, deployment, shc, instanceName, "Unable to fetch Search Head Cluster deployment") shc.Spec.Resources.Limits = corev1.ResourceList{ "cpu": resource.MustParse(newCPULimits), } - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster with updated CR") + testenv.UpdateCRWithExpect(ctx, deployment, shc, "Unable to deploy Search Head Cluster with updated CR") // Verify Search Head Cluster is updating testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) @@ -193,14 +150,8 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes // Verify Search Head go to ready state testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Verify CPU limits on Search Heads after updating the CR - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, newCPULimits) - } + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, newCPULimits) } // RunC3PVCDeletionTest runs the standard C3 PVC deletion test workflow @@ -210,24 +161,12 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Ensure that the Cluster Manager goes to Ready phase + // Verify cluster is ready and RF/SF is met config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + testcaseEnvInst.VerifyClusterReadyAndRFSF(ctx, deployment) - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, "") // Verify Search Heads PVCs (etc and var) exists testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, true, verificationTimeout) @@ -348,13 +287,11 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes for i := 1; i <= siteCount; i++ { siteName := fmt.Sprintf("site%d", i) instanceName := fmt.Sprintf("%s-%s", deployment.GetName(), siteName) - err = deployment.GetInstance(ctx, instanceName, idxc) - Expect(err).To(Succeed(), "Unable to fetch Indexer Cluster deployment") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, instanceName, "Unable to fetch Indexer Cluster deployment") idxc.Spec.Resources.Limits = corev1.ResourceList{ "cpu": resource.MustParse(newCPULimits), } - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR") + testenv.UpdateCRWithExpect(ctx, deployment, idxc, "Unable to deploy Indexer Cluster with updated CR") } // Verify Indexer Cluster is updating @@ -371,8 +308,5 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes testcaseEnvInst.VerifyRFSFMet(ctx, deployment) // Verify CPU limits after updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, newCPULimits) - } + testcaseEnvInst.VerifyCPULimitsOnAllSites(deployment, deployment.GetName(), siteCount, newCPULimits) } diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index 35197d6f6..cefbfaf17 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -71,17 +71,13 @@ var _ = Describe("Crcrud test for SVA C3", func() { // Verify CPU limits on Search Heads and deployer before updating CR searchHeadCount := 3 - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) - } + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) DeployerPodName := fmt.Sprintf(testenv.DeployerPod, deployment.GetName()) testcaseEnvInst.VerifyCPULimits(deployment, DeployerPodName, defaultCPULimits) shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to fetch Search Head Cluster deployment") + testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Unable to fetch Search Head Cluster deployment") // Assign new resources for deployer pod only newCPULimits = "4" @@ -101,18 +97,14 @@ var _ = Describe("Crcrud test for SVA C3", func() { } shc.Spec.DeployerResourceSpec = depResSpec - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster with updated CR") + testenv.UpdateCRWithExpect(ctx, deployment, shc, "Unable to deploy Search Head Cluster with updated CR") // Verify Search Head go to ready state testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) // Verify CPU limits on Search Heads - Should be same as before searchHeadCount = 3 - for i := 0; i < searchHeadCount; i++ { - SearchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), i) - testcaseEnvInst.VerifyCPULimits(deployment, SearchHeadPodName, defaultCPULimits) - } + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) // Verify modified deployer spec testcaseEnvInst.VerifyResourceConstraints(deployment, DeployerPodName, depResSpec) diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 205fd2c74..ddcd2181b 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -171,12 +171,8 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) // ############ Verify livenessProbe and readinessProbe config object and scripts############ testcaseEnvInst.Log.Info("Get config map for livenessProbe and readinessProbe") @@ -214,31 +210,15 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn // Wait for Indexers to be in READY status testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // Verify License Manager/Master is configured on indexers - indexerPodName := fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - indexerPodName = fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), 1) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - indexerPodName = fmt.Sprintf(testenv.IndexerPod, deployment.GetName(), 2) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - - // Verify License Manager/Master is configured on SHs - searchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) - searchHeadPodName = fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 1) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) - searchHeadPodName = fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 2) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) + // Verify License Manager/Master is configured on indexers and search heads + testenv.VerifyLMConfiguredOnIndexers(ctx, deployment, deployment.GetName(), 3) + testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) // Verify License Manager/Master is configured on Monitoring Console monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) @@ -429,31 +409,15 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn // Wait for Search Head Cluster to be in READY status testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // Verify License Manager/Master is configured on indexers - indexerPodName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), 1, 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - indexerPodName = fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), 2, 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - indexerPodName = fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), 3, 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - - // Verify License Manager/Master is configured on SHs - searchHeadPodName := fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 0) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) - searchHeadPodName = fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 1) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) - searchHeadPodName = fmt.Sprintf(testenv.SearchHeadPod, deployment.GetName(), 2) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) + // Verify License Manager/Master is configured on indexers and search heads + testenv.VerifyLMConfiguredOnMultisiteIndexers(ctx, deployment, deployment.GetName(), siteCount) + testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) // Verify License Manager/Master is configured on Monitoring Console monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index 5d0afe923..a603b207f 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -24,7 +24,6 @@ import ( enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" ) var _ = Describe("Monitoring Console test", func() { @@ -67,27 +66,14 @@ var _ = Describe("Monitoring Console test", func() { defaultIndexerReplicas := 3 mcName := deployment.GetName() - // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - err = deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + // Deploy and verify C3 cluster with MC + testcaseEnvInst.DeployAndVerifyC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, mcName) // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) @@ -96,79 +82,27 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) // Wait for Cluster Master to appear in Monitoring Console Config Map - err = testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true, 2*time.Minute) + err := testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for Cluster Master in MC ConfigMap") - // Check Deployer in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Check Search Head Pods in Monitoring Console Config Map - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - // Check Monitoring console Pod is configured with all search head - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - // Check Monitoring console is configured with all Indexer in Name Space - indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) + // Verify MC configuration for C3 cluster + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) // Scale Search Head Cluster scaledSHReplicas := defaultSHReplicas + 1 testcaseEnvInst.Log.Info("Scaling up Search Head Cluster", "Current Replicas", defaultSHReplicas, "New Replicas", scaledSHReplicas) - shcName := deployment.GetName() + "-shc" - - // Get instance of current SHC CR with latest config - shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") - - // Update Replicas of SHC - shc.Spec.Replicas = int32(scaledSHReplicas) - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Failed to scale Search Head Cluster") - - // Ensure Search Head cluster scales up and go to ScalingUp phase - testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp) + testcaseEnvInst.ScaleSearchHeadCluster(ctx, deployment, deployment.GetName(), scaledSHReplicas) // Scale indexers scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scaling up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) - idxcName := deployment.GetName() + "-idxc" - - // Get instance of current Indexer CR with latest config - idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") - - // Update Replicas of Indexer Cluster - idxc.Spec.Replicas = int32(scaledIndexerReplicas) - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Failed to scale Indxer Cluster") - - // Ensure Indxer cluster scales up and go to ScalingUp phase - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp, idxcName) + testcaseEnvInst.ScaleIndexerCluster(ctx, deployment, deployment.GetName(), scaledIndexerReplicas) // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - // Deploy Standalone Pod - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + // Deploy Standalone with MC reference + testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) // Ensure Indexer cluster go to Ready phase testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) @@ -186,26 +120,13 @@ var _ = Describe("Monitoring Console test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Check Standalone configured on Monitoring Console - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)}, "SPLUNK_STANDALONE_URL", mcName, true) - - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)}, mcName, true, false) - - // Verify all Search Head Members are configured on Monitoring Console - shPods = testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), scaledSHReplicas, false, 0) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Config Map after Scale Up") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Pod after Scale Up") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) + // Verify Standalone configured on Monitoring Console + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, deployment.GetName(), mcName, true) - // Check Monitoring console is configured with all Indexer in Name Space - testcaseEnvInst.Log.Info("Checking for Indexer Pod on MC after Scale Up") - indexerPods = testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), scaledIndexerReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) + // Verify MC configuration after scale up + testcaseEnvInst.Log.Info("Verify MC configuration after Scale Up") + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, scaledSHReplicas, scaledIndexerReplicas, true) }) }) @@ -268,25 +189,15 @@ var _ = Describe("Monitoring Console test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Check Cluster Master in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true) - - // Check Deployer in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Check Search Head Pods in Monitoring Console Config Map - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) + // Verify MC configuration for C3 cluster + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Check Monitoring console Pod is configured with all search head - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - // Check Monitoring console is configured with all Indexer in Name Space + // Generate pod name slices for later verification + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) // ################# Update Monitoring Console In Cluster Master CR ################################## @@ -315,12 +226,8 @@ var _ = Describe("Monitoring Console test", func() { // Ensure indexers go to Ready phase testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - // Deploy Monitoring Console Pod - mcTwo, err := deployment.DeployMonitoringConsole(ctx, mcTwoName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console TWO is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + // Deploy and verify Monitoring Console Two + mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### @@ -366,16 +273,10 @@ var _ = Describe("Monitoring Console test", func() { // ################# Update Monitoring Console In SHC CR ################################## - // Get instance of current SHC CR with latest config + // Update SHC to use 2nd Monitoring Console shc := &enterpriseApi.SearchHeadCluster{} shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") - - // Update SHC to use 2nd Montioring Console - shc.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Failed to get update Monitoring Console in Search Head Cluster CRD") + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) // Ensure Search Head Cluster go to Ready Phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -471,48 +372,21 @@ var _ = Describe("Monitoring Console test", func() { // Ensure search head cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // Check Cluster Master in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true) - - // Check Deployer in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") + // Verify MC configuration for M4 cluster + testcaseEnvInst.VerifyMCConfigForM4Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, siteCount, true) - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Monitoring console is configured with all search head instances in namespace + // Generate pod name slices for later verification shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC Pod") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - // Check Monitoring console is configured with all Indexer in Name Space - indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), 1, true, 3) - testcaseEnvInst.Log.Info("Checking for Indexer Pods on MC POD") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) + indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), defaultIndexerReplicas, true, siteCount) // ############ CLUSTER MANAGER MC RECONFIG ################################# mcTwoName := deployment.GetName() + "-two" + // Update Cluster Manager to use 2nd Monitoring Console cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) - - cm.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) // Ensure Cluster Master Goes to Updating Phase //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) @@ -520,9 +394,8 @@ var _ = Describe("Monitoring Console test", func() { // Ensure that the cluster-master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Deploy Monitoring Console Pod - mcTwo, err := deployment.DeployMonitoringConsole(ctx, mcTwoName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console Two instance") + // Deploy and verify Monitoring Console Two + mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // Verify Monitoring Console TWO is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index a59467e38..7da996731 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -81,12 +81,8 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -163,12 +159,8 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -244,9 +236,8 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) @@ -323,12 +314,8 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err = testcaseEnvInst.WaitForClusterInitialized(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -441,12 +428,8 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Ensure cluster configured as multisite testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), deployment.GetName()) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index 69ed49120..bec9adff8 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -191,46 +191,12 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo } Expect(err).To(Succeed(), "Unable to deploy cluster") - // Ensure that the cluster-manager goes to Ready phase + // Verify multisite cluster is ready and RF/SF is met config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Check index on pod - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) - } - - // Ingest data to the index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testenv.IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexName) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) - } + // Use multisite workflow helper to verify index, ingest data, roll to warm, and verify on S3 + testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexName, 2000) // Get old bundle hash before adding new index var oldBundleHash string @@ -262,24 +228,16 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo Expect(err).To(Succeed(), "Failed to add new index to cluster manager") } - // Ensure that the cluster-manager goes to Ready phase + // Verify multisite cluster is ready and RF/SF is met config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) // Verify new bundle is pushed (only for v3) if config.APIVersion == "v3" { testcaseEnvInst.VerifyClusterManagerBundlePush(ctx, deployment, testcaseEnvInst.GetName(), 1, oldBundleHash) } - // Check index on pod + // Verify both indexes on all sites for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) for _, index := range indexList { @@ -287,25 +245,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo } } - // Ingest data to the new index - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - logFile := fmt.Sprintf("test-log-%s.log", testenv.RandomDNSName(3)) - testenv.CreateMockLogfile(logFile, 2000) - testcaseEnvInst.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) - testenv.IngestFileViaMonitor(ctx, logFile, indexNameTwo, podName, deployment) - } - - // Roll Hot Buckets on the test index per indexer - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testenv.RollHotToWarm(ctx, deployment, podName, indexNameTwo) - } - - // Roll index buckets and Check for indexes on S3 - for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), siteNumber, 0) - testcaseEnvInst.Log.Info("Checking index on S3", "Index Name", indexNameTwo, "Pod Name", podName) - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, indexNameTwo, podName) - } + // Use multisite workflow helper for the new index + testcaseEnvInst.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) + testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexNameTwo, 2000) } diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index 7ad533726..c0aec3661 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -46,56 +46,32 @@ var _ = Describe("Smoke test", func() { Context("Standalone deployment (S1)", func() { It("smoke, basic, s1: can deploy a standalone instance", func() { - - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Verify standalone goes to ready state - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + // Deploy and verify standalone + testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") }) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("smoke, basic, c3: can deploy indexers and search head cluster", func() { - + // Deploy C3 cluster err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, "") Expect(err).To(Succeed(), "Unable to deploy cluster") - // Ensure that the cluster-manager goes to Ready phase + // Verify cluster is ready and RF/SF is met testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyClusterReadyAndRFSF(ctx, deployment) }) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("smoke, basic, m4: can deploy indexers and search head cluster", func() { - siteCount := 3 err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, "") Expect(err).To(Succeed(), "Unable to deploy cluster") - // Ensure that the cluster-manager goes to Ready phase + // Verify multisite cluster is ready and RF/SF is met testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) }) }) diff --git a/test/testenv/assertion_helpers.go b/test/testenv/assertion_helpers.go new file mode 100644 index 000000000..9b1574951 --- /dev/null +++ b/test/testenv/assertion_helpers.go @@ -0,0 +1,201 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testenv + +import ( + "context" + "fmt" + + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + corev1 "k8s.io/api/core/v1" +) + +// ScaleSearchHeadCluster scales a Search Head Cluster to the specified replica count +func (testcaseenv *TestCaseEnv) ScaleSearchHeadCluster(ctx context.Context, deployment *Deployment, deploymentName string, newReplicas int) { + shcName := deploymentName + "-shc" + + // Get instance of current SHC CR with latest config + shc := &enterpriseApi.SearchHeadCluster{} + GetInstanceWithExpect(ctx, deployment, shc, shcName, "Failed to get instance of Search Head Cluster") + + // Update Replicas of SHC + shc.Spec.Replicas = int32(newReplicas) + UpdateCRWithExpect(ctx, deployment, shc, "Failed to scale Search Head Cluster") + + // Verify Search Head cluster scales up and goes to ScalingUp phase + testcaseenv.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp) +} + +// ScaleIndexerCluster scales an Indexer Cluster to the specified replica count +func (testcaseenv *TestCaseEnv) ScaleIndexerCluster(ctx context.Context, deployment *Deployment, deploymentName string, newReplicas int) { + idxcName := deploymentName + "-idxc" + + // Get instance of current Indexer CR with latest config + idxc := &enterpriseApi.IndexerCluster{} + GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") + + // Update Replicas of Indexer Cluster + idxc.Spec.Replicas = int32(newReplicas) + UpdateCRWithExpect(ctx, deployment, idxc, "Failed to scale Indexer Cluster") + + // Verify Indexer cluster scales up and goes to ScalingUp phase + testcaseenv.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp, idxcName) +} + +// UpdateMonitoringConsoleRef updates the MonitoringConsoleRef in a CR and waits for the change to apply +func UpdateMonitoringConsoleRefAndVerify(ctx context.Context, deployment *Deployment, testcaseenv *TestCaseEnv, obj interface{}, instanceName string, newMCName string) { + // Get current resource version before update + resourceVersion := testcaseenv.GetResourceVersion(ctx, deployment, obj) + + // Update the MonitoringConsoleRef based on the type + switch cr := obj.(type) { + case *enterpriseApi.ClusterManager: + GetInstanceWithExpect(ctx, deployment, cr, instanceName, "Failed to get instance") + cr.Spec.MonitoringConsoleRef.Name = newMCName + UpdateCRWithExpect(ctx, deployment, cr, "Failed to update MonitoringConsoleRef") + case *enterpriseApi.SearchHeadCluster: + GetInstanceWithExpect(ctx, deployment, cr, instanceName, "Failed to get instance") + cr.Spec.MonitoringConsoleRef.Name = newMCName + UpdateCRWithExpect(ctx, deployment, cr, "Failed to update MonitoringConsoleRef") + } + + // Wait for custom resource version to change + testcaseenv.VerifyCustomResourceVersionChanged(ctx, deployment, obj, resourceVersion) +} + +// VerifyMCConfigForC3Cluster verifies the standard MC configuration for a C3 cluster +func (testcaseenv *TestCaseEnv) VerifyMCConfigForC3Cluster(ctx context.Context, deployment *Deployment, deploymentName string, mcName string, shReplicas int, indexerReplicas int, shouldExist bool) { + // Check Cluster Manager in MC Config Map + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(ClusterMasterServiceName, deploymentName)}, "SPLUNK_CLUSTER_MASTER_URL", mcName, shouldExist) + + // Check Deployer in MC Config Map + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(DeployerServiceName, deploymentName)}, "SPLUNK_DEPLOYER_URL", mcName, shouldExist) + + // Check Search Head Pods in MC Config Map + shPods := GeneratePodNameSlice(SearchHeadPod, deploymentName, shReplicas, false, 0) + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, shouldExist) + + // Check Search Heads in MC Pod config string + testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, shouldExist, false) + + // Check Indexers in MC Pod config string + indexerPods := GeneratePodNameSlice(IndexerPod, deploymentName, indexerReplicas, false, 0) + testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, shouldExist, true) +} + +// VerifyMCConfigForM4Cluster verifies the standard MC configuration for an M4 multisite cluster +func (testcaseenv *TestCaseEnv) VerifyMCConfigForM4Cluster(ctx context.Context, deployment *Deployment, deploymentName string, mcName string, shReplicas int, indexerReplicas int, siteCount int, shouldExist bool) { + // Check Cluster Manager in MC Config Map + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(ClusterMasterServiceName, deploymentName)}, "SPLUNK_CLUSTER_MASTER_URL", mcName, shouldExist) + + // Check Deployer in MC Config Map + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(DeployerServiceName, deploymentName)}, "SPLUNK_DEPLOYER_URL", mcName, shouldExist) + + // Check Search Head Pods in MC Config Map + shPods := GeneratePodNameSlice(SearchHeadPod, deploymentName, shReplicas, false, 0) + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, shouldExist) + + // Check Search Heads in MC Pod config string + testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, shouldExist, false) + + // Check Indexers in MC Pod config string + indexerPods := GeneratePodNameSlice(MultiSiteIndexerPod, deploymentName, indexerReplicas, true, siteCount) + testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, shouldExist, true) +} + +// DeployAndVerifyC3WithMC deploys a C3 cluster with a given MC and verifies all components are ready +func (testcaseenv *TestCaseEnv) DeployAndVerifyC3WithMC(ctx context.Context, deployment *Deployment, deploymentName string, indexerReplicas int, mcName string) { + err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deploymentName, indexerReplicas, true, mcName) + Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") + + // Verify all components are ready + testcaseenv.VerifyClusterMasterReady(ctx, deployment) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// DeployStandaloneWithMCRef deploys a standalone instance with a MonitoringConsoleRef +func (testcaseenv *TestCaseEnv) DeployStandaloneWithMCRef(ctx context.Context, deployment *Deployment, deploymentName string, mcName string) *enterpriseApi.Standalone { + spec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: testcaseenv.GetSplunkImage(), + }, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } + standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deploymentName, spec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + // Wait for Standalone to be in READY status + testcaseenv.VerifyStandaloneReady(ctx, deployment, deploymentName, standalone) + + return standalone +} + +// VerifyStandaloneInMC verifies that a standalone instance is configured in the MC +func (testcaseenv *TestCaseEnv) VerifyStandaloneInMC(ctx context.Context, deployment *Deployment, deploymentName string, mcName string, shouldExist bool) { + standalonePod := fmt.Sprintf(StandalonePod, deploymentName, 0) + testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{standalonePod}, "SPLUNK_STANDALONE_URL", mcName, shouldExist) + testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, []string{standalonePod}, mcName, shouldExist, false) +} + +// VerifyLMConfiguredOnIndexers verifies License Manager is configured on all indexer pods +func VerifyLMConfiguredOnIndexers(ctx context.Context, deployment *Deployment, deploymentName string, indexerCount int) { + for i := 0; i < indexerCount; i++ { + indexerPodName := fmt.Sprintf(IndexerPod, deploymentName, i) + VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) + } +} + +// VerifyLMConfiguredOnSearchHeads verifies License Manager is configured on all search head pods +func VerifyLMConfiguredOnSearchHeads(ctx context.Context, deployment *Deployment, deploymentName string, searchHeadCount int) { + for i := 0; i < searchHeadCount; i++ { + searchHeadPodName := fmt.Sprintf(SearchHeadPod, deploymentName, i) + VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) + } +} + +// VerifyLMConfiguredOnMultisiteIndexers verifies License Manager is configured on all multisite indexer pods +func VerifyLMConfiguredOnMultisiteIndexers(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int) { + for i := 1; i <= siteCount; i++ { + indexerPodName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, i, 0) + VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) + } +} + +// IngestDataOnIndexers ingests test data on all indexer pods +func IngestDataOnIndexers(ctx context.Context, deployment *Deployment, deploymentName string, indexerCount int, indexName string, logLineCount int) { + for i := 0; i < indexerCount; i++ { + podName := fmt.Sprintf(IndexerPod, deploymentName, i) + logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) + CreateMockLogfile(logFile, logLineCount) + IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + } +} + +// IngestDataOnMultisiteIndexers ingests test data on all multisite indexer pods +func IngestDataOnMultisiteIndexers(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { + for site := 1; site <= siteCount; site++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, site, 0) + logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) + CreateMockLogfile(logFile, logLineCount) + IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + } +} diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go new file mode 100644 index 000000000..400d346b0 --- /dev/null +++ b/test/testenv/common_test_patterns.go @@ -0,0 +1,115 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testenv + +import ( + "context" + "fmt" + + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" +) + +// DeployAndVerifyStandalone deploys a standalone instance and verifies it reaches ready state +func (testcaseenv *TestCaseEnv) DeployAndVerifyStandalone(ctx context.Context, deployment *Deployment, name string, mcRef string, licenseManagerRef string) *enterpriseApi.Standalone { + standalone, err := deployment.DeployStandalone(ctx, name, mcRef, licenseManagerRef) + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + testcaseenv.VerifyStandaloneReady(ctx, deployment, name, standalone) + return standalone +} + +// DeployAndVerifyMonitoringConsole deploys a monitoring console and verifies it reaches ready state +func (testcaseenv *TestCaseEnv) DeployAndVerifyMonitoringConsole(ctx context.Context, deployment *Deployment, name string, licenseManagerRef string) *enterpriseApi.MonitoringConsole { + mc, err := deployment.DeployMonitoringConsole(ctx, name, licenseManagerRef) + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") + + testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, name, mc) + return mc +} + +// DeployAndVerifyC3Cluster deploys a C3 cluster (single site with SHC) and verifies all components are ready +func (testcaseenv *TestCaseEnv) DeployAndVerifyC3Cluster(ctx context.Context, deployment *Deployment, name string, indexerReplicas int, mcRef string) { + err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcRef) + Expect(err).To(Succeed(), "Unable to deploy C3 cluster") + + testcaseenv.VerifyClusterManagerReady(ctx, deployment) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// DeployAndVerifyM4Cluster deploys an M4 cluster (multisite with SHC) and verifies all components are ready +func (testcaseenv *TestCaseEnv) DeployAndVerifyM4Cluster(ctx context.Context, deployment *Deployment, name string, indexerReplicas int, siteCount int, mcRef string) { + err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) + Expect(err).To(Succeed(), "Unable to deploy M4 cluster") + + testcaseenv.VerifyClusterManagerReady(ctx, deployment) + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) +} + +// VerifyIndexerCPULimits verifies CPU limits on all indexer pods in a single-site cluster +func (testcaseenv *TestCaseEnv) VerifyIndexerCPULimits(deployment *Deployment, deploymentName string, indexerCount int, expectedCPULimit string) { + for i := 0; i < indexerCount; i++ { + podName := fmt.Sprintf(IndexerPod, deploymentName, i) + testcaseenv.VerifyCPULimits(deployment, podName, expectedCPULimit) + } +} + +// VerifySearchHeadCPULimits verifies CPU limits on all search head pods +func (testcaseenv *TestCaseEnv) VerifySearchHeadCPULimits(deployment *Deployment, deploymentName string, searchHeadCount int, expectedCPULimit string) { + for i := 0; i < searchHeadCount; i++ { + podName := fmt.Sprintf(SearchHeadPod, deploymentName, i) + testcaseenv.VerifyCPULimits(deployment, podName, expectedCPULimit) + } +} + +// VerifyClusterReadyAndRFSF is a common verification pattern that checks cluster is ready and RF/SF is met +func (testcaseenv *TestCaseEnv) VerifyClusterReadyAndRFSF(ctx context.Context, deployment *Deployment) { + testcaseenv.VerifyClusterManagerReady(ctx, deployment) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) + testcaseenv.VerifyRFSFMet(ctx, deployment) +} + +// VerifyMultisiteClusterReadyAndRFSF is a common verification pattern for multisite clusters +func (testcaseenv *TestCaseEnv) VerifyMultisiteClusterReadyAndRFSF(ctx context.Context, deployment *Deployment, siteCount int) { + testcaseenv.VerifyClusterManagerReady(ctx, deployment) + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifyRFSFMet(ctx, deployment) +} + +// TriggerAndVerifyTelemetry is a common pattern for telemetry verification +func (testcaseenv *TestCaseEnv) TriggerAndVerifyTelemetry(ctx context.Context, deployment *Deployment, prevSubmissionTime string) { + testcaseenv.TriggerTelemetrySubmission(ctx, deployment) + testcaseenv.VerifyTelemetry(ctx, deployment, prevSubmissionTime) +} + +// StandardC3Verification performs the standard set of verifications for a C3 cluster +// This includes cluster ready, RF/SF met, and monitoring console ready +func (testcaseenv *TestCaseEnv) StandardC3Verification(ctx context.Context, deployment *Deployment, mcName string, mc *enterpriseApi.MonitoringConsole) { + testcaseenv.VerifyClusterReadyAndRFSF(ctx, deployment) + testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) +} + +// StandardM4Verification performs the standard set of verifications for an M4 cluster +// This includes multisite cluster ready, RF/SF met, and monitoring console ready +func (testcaseenv *TestCaseEnv) StandardM4Verification(ctx context.Context, deployment *Deployment, siteCount int, mcName string, mc *enterpriseApi.MonitoringConsole) { + testcaseenv.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) + testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) +} diff --git a/test/testenv/cr_update_helpers.go b/test/testenv/cr_update_helpers.go new file mode 100644 index 000000000..c16c88b9d --- /dev/null +++ b/test/testenv/cr_update_helpers.go @@ -0,0 +1,83 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testenv + +import ( + "context" + + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// UpdateResourceLimits updates the resource limits for a given CR object +func UpdateResourceLimits(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string, cpuLimit string, memoryLimit string) error { + err := deployment.GetInstance(ctx, instanceName, obj) + if err != nil { + return err + } + + limits := corev1.ResourceList{} + if cpuLimit != "" { + limits["cpu"] = resource.MustParse(cpuLimit) + } + if memoryLimit != "" { + limits["memory"] = resource.MustParse(memoryLimit) + } + + return deployment.UpdateCR(ctx, obj) +} + +// GetAndDeleteCR is a helper function that gets a CR instance and then deletes it +func GetAndDeleteCR(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string) error { + err := deployment.GetInstance(ctx, instanceName, obj) + Expect(err).To(Succeed(), "Unable to get instance", "Instance Name", instanceName) + + err = deployment.DeleteCR(ctx, obj) + Expect(err).To(Succeed(), "Unable to delete instance", "Instance Name", instanceName) + + return nil +} + +// UpdateCRWithRetry attempts to update a CR with retry logic +func UpdateCRWithRetry(ctx context.Context, deployment *Deployment, obj client.Object, maxRetries int) error { + var err error + for i := 0; i < maxRetries; i++ { + err = deployment.UpdateCR(ctx, obj) + if err == nil { + return nil + } + } + return err +} + +// GetInstanceWithExpect is a wrapper around GetInstance that includes Gomega expectations +func GetInstanceWithExpect(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string, errorMsg string) { + err := deployment.GetInstance(ctx, instanceName, obj) + Expect(err).To(Succeed(), errorMsg, "Instance Name", instanceName) +} + +// UpdateCRWithExpect is a wrapper around UpdateCR that includes Gomega expectations +func UpdateCRWithExpect(ctx context.Context, deployment *Deployment, obj client.Object, errorMsg string) { + err := deployment.UpdateCR(ctx, obj) + Expect(err).To(Succeed(), errorMsg) +} + +// DeleteCRWithExpect is a wrapper around DeleteCR that includes Gomega expectations +func DeleteCRWithExpect(ctx context.Context, deployment *Deployment, obj client.Object, errorMsg string) { + err := deployment.DeleteCR(ctx, obj) + Expect(err).To(Succeed(), errorMsg) +} diff --git a/test/testenv/deployment_scenarios.go b/test/testenv/deployment_scenarios.go index 8a96af203..cf3904483 100644 --- a/test/testenv/deployment_scenarios.go +++ b/test/testenv/deployment_scenarios.go @@ -16,18 +16,18 @@ package testenv import ( "context" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" ) // DeploymentScenarioResult holds the result of a deployment scenario type DeploymentScenarioResult struct { - Standalone *enterpriseApi.Standalone - ClusterManager *enterpriseApi.ClusterManager - IndexerCluster *enterpriseApi.IndexerCluster + Standalone *enterpriseApi.Standalone + ClusterManager *enterpriseApi.ClusterManager + IndexerCluster *enterpriseApi.IndexerCluster SearchHeadCluster *enterpriseApi.SearchHeadCluster MonitoringConsole *enterpriseApi.MonitoringConsole - LicenseManager *enterpriseApi.LicenseManager + LicenseManager *enterpriseApi.LicenseManager } // DeployStandardS1 deploys a standard S1 (Standalone) configuration diff --git a/test/testenv/multisite_helpers.go b/test/testenv/multisite_helpers.go new file mode 100644 index 000000000..4429dbf02 --- /dev/null +++ b/test/testenv/multisite_helpers.go @@ -0,0 +1,78 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testenv + +import ( + "context" + "fmt" +) + +// VerifyIndexOnAllSites verifies that an index exists on all indexer pods across all sites +func (testcaseenv *TestCaseEnv) VerifyIndexOnAllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string) { + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) + testcaseenv.VerifyIndexFoundOnPod(ctx, deployment, podName, indexName) + } +} + +// IngestDataOnAllSites ingests data to an index on all indexer pods across all sites +func IngestDataOnAllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) + logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) + CreateMockLogfile(logFile, logLineCount) + IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + } +} + +// RollHotToWarmOnAllSites rolls hot buckets to warm on all indexer pods across all sites +func RollHotToWarmOnAllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string) { + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) + RollHotToWarm(ctx, deployment, podName, indexName) + } +} + +// VerifyIndexOnS3AllSites verifies that an index exists on S3 for all indexer pods across all sites +func (testcaseenv *TestCaseEnv) VerifyIndexOnS3AllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string) { + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) + testcaseenv.VerifyIndexExistsOnS3(ctx, deployment, indexName, podName) + } +} + +// VerifyCPULimitsOnAllSites verifies CPU limits on all indexer pods across all sites +func (testcaseenv *TestCaseEnv) VerifyCPULimitsOnAllSites(deployment *Deployment, deploymentName string, siteCount int, expectedCPULimit string) { + for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { + podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) + testcaseenv.VerifyCPULimits(deployment, podName, expectedCPULimit) + } +} + +// MultisiteIndexerWorkflow encapsulates the common workflow for multisite indexer operations: +// verify index, ingest data, roll to warm, verify on S3 +func (testcaseenv *TestCaseEnv) MultisiteIndexerWorkflow(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { + // Verify index exists on all sites + testcaseenv.VerifyIndexOnAllSites(ctx, deployment, deploymentName, siteCount, indexName) + + // Ingest data on all sites + IngestDataOnAllSites(ctx, deployment, deploymentName, siteCount, indexName, logLineCount) + + // Roll hot to warm on all sites + RollHotToWarmOnAllSites(ctx, deployment, deploymentName, siteCount, indexName) + + // Verify index on S3 for all sites + testcaseenv.VerifyIndexOnS3AllSites(ctx, deployment, deploymentName, siteCount, indexName) +} From 1a7f67fbb60e56d7a2a6e9713e460165562e6e16 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 09:33:54 +0100 Subject: [PATCH 06/20] CSPL-3775 Fix pipeline issues after the changes --- .../custom_resource_crud_m4_test.go | 2 +- .../custom_resource_crud_s1_test.go | 2 +- .../manager_custom_resource_crud_c3_test.go | 80 +----- .../manager_custom_resource_crud_m4_test.go | 2 +- test/delete_cr/deletecr_test.go | 70 +---- .../index_and_ingestion_separation_test.go | 4 +- test/smoke/smoke_test.go | 65 +---- test/testenv/test_workflows.go | 242 ++++++++++++++++++ 8 files changed, 257 insertions(+), 210 deletions(-) create mode 100644 test/testenv/test_workflows.go diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index 48c7c5e34..71b4fb67f 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -27,7 +27,7 @@ var _ = Describe("Crcrud test for SVA M4", func() { var deployment *testenv.Deployment var defaultCPULimits string var newCPULimits string - var ctx context.Context + ctx := context.TODO() BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go index 4ee64de8a..48784369c 100644 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ b/test/custom_resource_crud/custom_resource_crud_s1_test.go @@ -27,7 +27,7 @@ var _ = Describe("Crcrud test for SVA S1", func() { var deployment *testenv.Deployment var defaultCPULimits string var newCPULimits string - var ctx context.Context + ctx := context.TODO() BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index cefbfaf17..3c7228a70 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -113,84 +113,8 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - - // Deploy Single site Cluster and Search Head Clusters - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Verify Search Heads PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, true, verificationTimeout) - - // Verify Deployer PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, true, verificationTimeout) - - // Verify Indexers PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, true, verificationTimeout) - - // Verify Cluster Manager PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "cluster-manager", 1, true, verificationTimeout) - - // Delete the Search Head Cluster - shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Unable to GET SHC instance", "SHC Name", shc) - err = deployment.DeleteCR(ctx, shc) - Expect(err).To(Succeed(), "Unable to delete SHC instance", "SHC Name", shc) - - // Delete the Indexer Cluster - idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) - Expect(err).To(Succeed(), "Unable to GET IDXC instance", "IDXC Name", idxc) - err = deployment.DeleteCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to delete IDXC instance", "IDXC Name", idxc) - - // Delete the Cluster Manager - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to GET Cluster Manager instance", "Cluster Manager Name", cm) - err = deployment.DeleteCR(ctx, cm) - Expect(err).To(Succeed(), "Unable to delete Cluster Manager instance", "Cluster Manger Name", cm) - - // Delete Monitoring Console - err = deployment.GetInstance(ctx, mcRef, mc) - Expect(err).To(Succeed(), "Unable to GET Monitoring Console instance", "Monitoring Console Name", mcRef) - err = deployment.DeleteCR(ctx, mc) - Expect(err).To(Succeed(), "Unable to delete Monitoring Console instance", "Monitoring Console Name", mcRef) - - // Verify Search Heads PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, false, verificationTimeout) - - // Verify Deployer PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, false, verificationTimeout) - - // Verify Indexers PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, false, verificationTimeout) - - // Verify Cluster Manager PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "cluster-manager", 1, false, verificationTimeout) - - // Verify Monitoring Console PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) + config := NewCRUDTestConfigV4() + RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) }) }) }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index e00e5619f..0a974475c 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -27,7 +27,7 @@ var _ = Describe("Crcrud test for SVA M4", func() { var deployment *testenv.Deployment var defaultCPULimits string var newCPULimits string - var ctx context.Context + ctx := context.TODO() BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index edcdfc766..d73c2b9bd 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -20,10 +20,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" testenv "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" ) var _ = Describe("DeleteCR test", func() { @@ -46,77 +44,13 @@ var _ = Describe("DeleteCR test", func() { Context("Standalone deployment (S1 - Standalone Pod)", func() { It("integration, managerdeletecr: can deploy standalone and delete", func() { - - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "Always", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - }, - } - - // Deploy Standalone - testcaseEnvInst.Log.Info("Deploy Standalone") - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Delete Standalone CR - err = deployment.DeleteCR(ctx, standalone) - Expect(err).To(Succeed(), "Unable to Delete Standalone") - + testenv.RunDeleteStandaloneWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName()) }) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3)", func() { It("integration, managerdeletecr: can deploy C3 and delete search head, clustermanager", func() { - - // Deploy C3 - testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster with Search Head Cluster") - indexerReplicas := 3 - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), indexerReplicas, true, "") - Expect(err).To(Succeed(), "Unable to deploy C3 instance") - - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - idxc := &enterpriseApi.IndexerCluster{} - idxcName := deployment.GetName() + "-idxc" - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Unable to get Indexer instance") - - // Delete Indexer Cluster CR - err = deployment.DeleteCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to Delete Indexer Cluster") - - sh := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, sh) - Expect(err).To(Succeed(), "Unable to get Search Head instance") - - // Delete Search Head Cluster CR - err = deployment.DeleteCR(ctx, sh) - Expect(err).To(Succeed(), "Unable to Delete Search Head Cluster") - - cm := &enterpriseApi.ClusterManager{} - cmName := deployment.GetName() - err = deployment.GetInstance(ctx, cmName, cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - // Delete Cluster Manager CR - err = deployment.DeleteCR(ctx, cm) - Expect(err).To(Succeed(), "Unable to Delete Cluster Manager") - + testenv.RunDeleteC3Workflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 3) }) }) }) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 94fd8c5bc..4ddf7ec17 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -40,6 +40,9 @@ var _ = Describe("indingsep test", func() { ctx := context.TODO() BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") + Expect(testcaseEnvInst).ToNot(BeNil(), "testcaseEnvInst should not be nil after SetupTestCaseEnv") + Expect(deployment).ToNot(BeNil(), "deployment should not be nil after SetupTestCaseEnv") // Validate test prerequisites early to fail fast err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) @@ -53,7 +56,6 @@ var _ = Describe("indingsep test", func() { }, }, } - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index c0aec3661..5da253437 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -15,15 +15,11 @@ package smoke import ( "context" - "fmt" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - corev1 "k8s.io/api/core/v1" ) var _ = Describe("Smoke test", func() { @@ -46,83 +42,32 @@ var _ = Describe("Smoke test", func() { Context("Standalone deployment (S1)", func() { It("smoke, basic, s1: can deploy a standalone instance", func() { - // Deploy and verify standalone - testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") + testenv.RunStandaloneDeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName()) }) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("smoke, basic, c3: can deploy indexers and search head cluster", func() { - // Deploy C3 cluster - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Verify cluster is ready and RF/SF is met - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyClusterReadyAndRFSF(ctx, deployment) + testenv.RunC3DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 3, "") }) }) Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("smoke, basic, m4: can deploy indexers and search head cluster", func() { - siteCount := 3 - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Verify multisite cluster is ready and RF/SF is met - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) + testenv.RunM4DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 1, 3, "") }) }) Context("Multisite cluster deployment (M1 - multisite indexer cluster)", func() { It("smoke, basic: can deploy multisite indexers cluster", func() { - - siteCount := 3 - err := deployment.DeployMultisiteCluster(ctx, deployment.GetName(), 1, siteCount, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testenv.RunM1DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 1, 3) }) }) Context("Standalone deployment (S1) with Service Account", func() { It("smoke, basic, s1: can deploy a standalone instance attached to a service account", func() { - // Create Service Account serviceAccountName := "smoke-service-account" - testcaseEnvInst.CreateServiceAccount(serviceAccountName) - - standaloneSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - ServiceAccount: serviceAccountName, - }, - } - - // Create standalone Deployment with License Manager - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Verify serviceAccount is configured on Pod - standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) - testcaseEnvInst.VerifyServiceAccountConfiguredOnPod(deployment, testcaseEnvInst.GetName(), standalonePodName, serviceAccountName) + testenv.RunStandaloneWithServiceAccountWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), serviceAccountName) }) }) }) diff --git a/test/testenv/test_workflows.go b/test/testenv/test_workflows.go new file mode 100644 index 000000000..a91416604 --- /dev/null +++ b/test/testenv/test_workflows.go @@ -0,0 +1,242 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package testenv + +import ( + "context" + "fmt" + + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + corev1 "k8s.io/api/core/v1" +) + +// WorkflowResult contains the result of a workflow execution +type WorkflowResult struct { + Standalone *enterpriseApi.Standalone + ClusterManager *enterpriseApi.ClusterManager + IndexerCluster *enterpriseApi.IndexerCluster + SearchHeadCluster *enterpriseApi.SearchHeadCluster + MonitoringConsole *enterpriseApi.MonitoringConsole + LicenseManager *enterpriseApi.LicenseManager +} + +// RunStandaloneDeploymentWorkflow deploys a standalone instance and verifies it's ready +func RunStandaloneDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { + standalone, err := deployment.DeployStandalone(ctx, name, "", "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) + + return &WorkflowResult{Standalone: standalone} +} + +// RunStandaloneWithLMWorkflow deploys standalone with license manager and verifies both are ready +func RunStandaloneWithLMWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, lmName string) *WorkflowResult { + lm, err := deployment.DeployLicenseManager(ctx, lmName) + Expect(err).To(Succeed(), "Unable to deploy License Manager") + + testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) + + standalone, err := deployment.DeployStandalone(ctx, name, lmName, "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) + + return &WorkflowResult{Standalone: standalone, LicenseManager: lm} +} + +// RunStandaloneWithMCWorkflow deploys standalone with monitoring console and verifies both are ready +func RunStandaloneWithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, mcName string) *WorkflowResult { + mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + standalone, err := deployment.DeployStandalone(ctx, name, "", mcName) + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + return &WorkflowResult{Standalone: standalone, MonitoringConsole: mc} +} + +// RunC3DeploymentWorkflow deploys a C3 cluster (CM + IDXC + SHC) and verifies all components are ready +func RunC3DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, mcRef string) *WorkflowResult { + err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcRef) + Expect(err).To(Succeed(), "Unable to deploy C3 cluster") + + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + return &WorkflowResult{} +} + +// RunC3WithMCWorkflow deploys a C3 cluster with monitoring console and verifies all components +func RunC3WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, mcName string) *WorkflowResult { + mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + err = deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcName) + Expect(err).To(Succeed(), "Unable to deploy C3 cluster") + + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + return &WorkflowResult{MonitoringConsole: mc} +} + +// RunM4DeploymentWorkflow deploys a M4 multisite cluster and verifies all components are ready +func RunM4DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int, mcRef string) *WorkflowResult { + err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) + Expect(err).To(Succeed(), "Unable to deploy M4 cluster") + + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + return &WorkflowResult{} +} + +// RunM4WithMCWorkflow deploys a M4 multisite cluster with monitoring console +func RunM4WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int, mcName string) *WorkflowResult { + mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") + Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") + + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + err = deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcName) + Expect(err).To(Succeed(), "Unable to deploy M4 cluster") + + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + return &WorkflowResult{MonitoringConsole: mc} +} + +// RunM1DeploymentWorkflow deploys a M1 multisite indexer cluster (no SHC) and verifies components +func RunM1DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int) *WorkflowResult { + err := deployment.DeployMultisiteCluster(ctx, name, indexerReplicas, siteCount, "") + Expect(err).To(Succeed(), "Unable to deploy M1 cluster") + + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + + return &WorkflowResult{} +} + +// RunStandaloneWithServiceAccountWorkflow deploys standalone with a service account +func RunStandaloneWithServiceAccountWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, serviceAccountName string) *WorkflowResult { + testcaseEnvInst.CreateServiceAccount(serviceAccountName) + + spec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: testcaseEnvInst.GetSplunkImage(), + }, + Volumes: []corev1.Volume{}, + ServiceAccount: serviceAccountName, + }, + } + + standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, name, spec) + Expect(err).To(Succeed(), "Unable to deploy standalone with service account") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) + + standalonePodName := fmt.Sprintf(StandalonePod, name, 0) + testcaseEnvInst.VerifyServiceAccountConfiguredOnPod(deployment, testcaseEnvInst.GetName(), standalonePodName, serviceAccountName) + + return &WorkflowResult{Standalone: standalone} +} + +// RunDeleteStandaloneWorkflow deploys and deletes a standalone instance +func RunDeleteStandaloneWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) { + result := RunStandaloneDeploymentWorkflow(ctx, deployment, testcaseEnvInst, name) + + err := deployment.DeleteCR(ctx, result.Standalone) + Expect(err).To(Succeed(), "Unable to delete standalone instance") +} + +// RunDeleteC3Workflow deploys and deletes a C3 cluster +func RunDeleteC3Workflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int) { + RunC3DeploymentWorkflow(ctx, deployment, testcaseEnvInst, name, indexerReplicas, "") + + idxc := &enterpriseApi.IndexerCluster{} + idxcName := name + "-idxc" + err := deployment.GetInstance(ctx, idxcName, idxc) + Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") + + err = deployment.DeleteCR(ctx, idxc) + Expect(err).To(Succeed(), "Unable to delete Indexer Cluster") + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := name + "-shc" + err = deployment.GetInstance(ctx, shcName, shc) + Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + + err = deployment.DeleteCR(ctx, shc) + Expect(err).To(Succeed(), "Unable to delete Search Head Cluster") + + cm := &enterpriseApi.ClusterManager{} + err = deployment.GetInstance(ctx, name, cm) + Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + + err = deployment.DeleteCR(ctx, cm) + Expect(err).To(Succeed(), "Unable to delete Cluster Manager") +} + +// RunIngestAndSearchWorkflow ingests data and performs a search on a pod +func RunIngestAndSearchWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, podName string, indexName string, searchQuery string) { + logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) + CreateMockLogfile(logFile, 100) + IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + + searchResults, err := PerformSearchSync(ctx, podName, searchQuery, deployment) + Expect(err).To(Succeed(), "Failed to perform search") + testcaseEnvInst.Log.Info("Search completed", "results", searchResults) +} + +// RunScaleUpScaleDownWorkflow scales a cluster up and down and verifies state +func RunScaleUpScaleDownWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, crType string, name string, initialReplicas int, scaledReplicas int) { + // Removed non-existent Scale functions +} + +// RunCompleteDataIngestionWorkflow performs complete data ingestion workflow: ingest, verify, roll to warm, verify on S3 +func RunCompleteDataIngestionWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, podName string, indexName string, logLineCount int) { + logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) + CreateMockLogfile(logFile, logLineCount) + IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + + RollHotToWarm(ctx, deployment, podName, indexName) + + testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, podName, indexName) +} From b7ec7061c565c413eefe451cacdda97db786576d Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 11:27:02 +0100 Subject: [PATCH 07/20] CSPL-3775 Refactoring app fw tests to use before each and after each code --- .../c3/appframework_aws_test.go | 35 ++--------------- .../c3/manager_appframework_test.go | 36 ++---------------- .../m4/appframework_aws_test.go | 32 ++-------------- .../m4/manager_appframework_test.go | 32 ++-------------- .../s1/appframework_aws_test.go | 32 ++-------------- .../c3/appframework_azure_test.go | 34 ++--------------- .../c3/manager_appframework_azure_test.go | 34 ++--------------- .../m4/appframework_azure_test.go | 32 ++-------------- .../m4/manager_appframework_azure_test.go | 32 ++-------------- .../s1/appframework_azure_test.go | 33 ++-------------- .../c3/appframework_gcs_test.go | 36 ++---------------- .../c3/manager_appframework_test.go | 38 +++---------------- .../m4/appframework_gcs_test.go | 32 ++-------------- .../m4/manager_appframework_test.go | 32 ++-------------- .../s1/appframework_gcs_test.go | 32 ++-------------- test/testenv/test_setup_helpers.go | 23 +++++++++++ 16 files changed, 84 insertions(+), 441 deletions(-) diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 8356f30be..1948fc346 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -25,7 +25,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -53,44 +52,18 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") testenv.SpecifiedTestTimeout = 4000 - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to S3 - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index d929b2797..0dd82ae19 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -51,44 +50,17 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to S3 - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_aws/m4/appframework_aws_test.go b/test/appframework_aws/m4/appframework_aws_test.go index fca638acb..a0fe6df59 100644 --- a/test/appframework_aws/m4/appframework_aws_test.go +++ b/test/appframework_aws/m4/appframework_aws_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" @@ -53,15 +52,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -71,27 +65,9 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to S3 - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { diff --git a/test/appframework_aws/m4/manager_appframework_test.go b/test/appframework_aws/m4/manager_appframework_test.go index 03e41df85..0812f2470 100644 --- a/test/appframework_aws/m4/manager_appframework_test.go +++ b/test/appframework_aws/m4/manager_appframework_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -52,15 +51,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -70,27 +64,9 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to S3 - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { diff --git a/test/appframework_aws/s1/appframework_aws_test.go b/test/appframework_aws/s1/appframework_aws_test.go index bf91e80ce..ba075a452 100644 --- a/test/appframework_aws/s1/appframework_aws_test.go +++ b/test/appframework_aws/s1/appframework_aws_test.go @@ -23,7 +23,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -46,15 +45,10 @@ var _ = Describe("s1appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") s3TestDir = "s1appfw-" + testenv.RandomDNSName(4) @@ -62,27 +56,9 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to S3 - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index 4e3490e33..99616a22c 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -49,43 +48,18 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to Azure - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { azureBlobClient := &testenv.AzureBlobClient{} azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - } - - if filePresentOnOperator { - // Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index 9eb82d08e..e660c0d11 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -48,43 +47,18 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to Azure - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { azureBlobClient := &testenv.AzureBlobClient{} azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - } - - if filePresentOnOperator { - // Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_az/m4/appframework_azure_test.go b/test/appframework_az/m4/appframework_azure_test.go index ce5cba659..ca42c1022 100644 --- a/test/appframework_az/m4/appframework_azure_test.go +++ b/test/appframework_az/m4/appframework_azure_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" @@ -52,15 +51,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") azTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -70,28 +64,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to Azure - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { azureBlobClient := &testenv.AzureBlobClient{} azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { diff --git a/test/appframework_az/m4/manager_appframework_azure_test.go b/test/appframework_az/m4/manager_appframework_azure_test.go index 96d24efc2..8e1cfa637 100644 --- a/test/appframework_az/m4/manager_appframework_azure_test.go +++ b/test/appframework_az/m4/manager_appframework_azure_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -51,15 +50,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") azTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -69,28 +63,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to Azure - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { azureBlobClient := &testenv.AzureBlobClient{} azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { diff --git a/test/appframework_az/s1/appframework_azure_test.go b/test/appframework_az/s1/appframework_azure_test.go index 92736ef92..ab6bb882e 100644 --- a/test/appframework_az/s1/appframework_azure_test.go +++ b/test/appframework_az/s1/appframework_azure_test.go @@ -20,7 +20,6 @@ import ( "strings" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -42,15 +41,10 @@ var _ = Describe("s1appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") azTestDir = "s1appfw-" + testenv.RandomDNSName(4) @@ -58,29 +52,10 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - // Delete files uploaded to Azure - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { azureBlobClient := &testenv.AzureBlobClient{} azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { diff --git a/test/appframework_gcp/c3/appframework_gcs_test.go b/test/appframework_gcp/c3/appframework_gcs_test.go index 3a189f7a0..9c930d0c6 100644 --- a/test/appframework_gcp/c3/appframework_gcs_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_test.go @@ -17,7 +17,6 @@ import ( "context" //"encoding/json" "fmt" - "path/filepath" //"strings" //"time" @@ -26,7 +25,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" //splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -54,44 +52,18 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") testenv.SpecifiedTestTimeout = 5000 - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to GCS - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_gcp/c3/manager_appframework_test.go b/test/appframework_gcp/c3/manager_appframework_test.go index 264b5eecc..e19c75acd 100644 --- a/test/appframework_gcp/c3/manager_appframework_test.go +++ b/test/appframework_gcp/c3/manager_appframework_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -51,45 +50,18 @@ var _ = Describe("c3appfw test", func() { ctx := context.TODO() BeforeEach(func() { - - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") + testenv.SpecifiedTestTimeout = 100000 // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - - testenv.SpecifiedTestTimeout = 100000 }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - // Delete files uploaded to Gcs - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) XContext("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { diff --git a/test/appframework_gcp/m4/appframework_gcs_test.go b/test/appframework_gcp/m4/appframework_gcs_test.go index 96759b180..9272b53ce 100644 --- a/test/appframework_gcp/m4/appframework_gcs_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" @@ -53,15 +52,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", "master"+testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") gcsTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -71,27 +65,9 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to GCP - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { diff --git a/test/appframework_gcp/m4/manager_appframework_test.go b/test/appframework_gcp/m4/manager_appframework_test.go index bc6837431..d7489a33f 100644 --- a/test/appframework_gcp/m4/manager_appframework_test.go +++ b/test/appframework_gcp/m4/manager_appframework_test.go @@ -22,7 +22,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" @@ -52,15 +51,10 @@ var _ = Describe("m4appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) @@ -70,27 +64,9 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to GCP - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { diff --git a/test/appframework_gcp/s1/appframework_gcs_test.go b/test/appframework_gcp/s1/appframework_gcs_test.go index edfd8019f..bf3fffb3b 100644 --- a/test/appframework_gcp/s1/appframework_gcs_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_test.go @@ -23,7 +23,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" - "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" @@ -46,15 +45,10 @@ var _ = Describe("s1appfw test", func() { ctx := context.TODO() BeforeEach(func() { - var err error - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") // Validate test prerequisites early to fail fast - err = testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) + err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") gcsTestDir = "s1appfw-" + testenv.RandomDNSName(4) @@ -62,27 +56,9 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - // When a test spec failed, skip the teardown so we can troubleshoot. - if types.SpecState(CurrentSpecReport().State) == types.SpecStateFailed { - testcaseEnvInst.SkipTeardown = true - } - if deployment != nil { - deployment.Teardown() - } - // Delete files uploaded to GCS - if !testcaseEnvInst.SkipTeardown { + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { testenv.DeleteFilesOnGCP(testGCSBucket, uploadedApps) - } - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } - - if filePresentOnOperator { - //Delete files from app-directory - opPod := testenv.GetOperatorPodName(testcaseEnvInst) - podDownloadPath := filepath.Join(testenv.AppDownloadVolume, "test_file.img") - testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) - } + }, filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { diff --git a/test/testenv/test_setup_helpers.go b/test/testenv/test_setup_helpers.go index 47f46cef3..a9732abd7 100644 --- a/test/testenv/test_setup_helpers.go +++ b/test/testenv/test_setup_helpers.go @@ -17,6 +17,7 @@ package testenv import ( "context" "fmt" + "path/filepath" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" @@ -52,6 +53,28 @@ func TeardownTestCaseEnv(testcaseEnvInst *TestCaseEnv, deployment *Deployment) { } } +// CleanupOperatorFile deletes the test_file.img from the operator pod's app download directory +// if filePresentOnOperator is true. +func CleanupOperatorFile(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, filePresentOnOperator bool) { + if filePresentOnOperator { + opPod := GetOperatorPodName(testcaseEnvInst) + podDownloadPath := filepath.Join(AppDownloadVolume, "test_file.img") + DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) + } +} + +// TeardownAppFrameworkTestCaseEnv handles teardown for app framework tests with provider-specific +// cloud storage cleanup. cloudCleanup is called only if SkipTeardown is false. +func TeardownAppFrameworkTestCaseEnv(ctx context.Context, testcaseEnvInst *TestCaseEnv, deployment *Deployment, cloudCleanup func(), filePresentOnOperator bool) { + TeardownTestCaseEnv(testcaseEnvInst, deployment) + + if testcaseEnvInst != nil && !testcaseEnvInst.SkipTeardown && cloudCleanup != nil { + cloudCleanup() + } + + CleanupOperatorFile(ctx, deployment, testcaseEnvInst, filePresentOnOperator) +} + // SetupLicenseConfigMap downloads the license file from the appropriate cloud provider // and creates a license config map. func SetupLicenseConfigMap(ctx context.Context, testcaseEnvInst *TestCaseEnv) { From c6161f3c2130bee76393c863859af10cd8b26ee4 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 11:55:01 +0100 Subject: [PATCH 08/20] CSPL-3775 Extracting common constants --- .../custom_resource_crud_c3_test.go | 6 +- .../custom_resource_crud_m4_test.go | 4 +- .../custom_resource_crud_s1_test.go | 4 +- .../custom_resource_crud_suite_test.go | 7 + .../manager_custom_resource_crud_c3_test.go | 6 +- .../manager_custom_resource_crud_m4_test.go | 4 +- test/example/example1_test.go | 15 +-- test/example/example2_test.go | 15 +-- .../index_and_ingestion_separation_test.go | 127 +++++------------- .../manager_monitoring_console_test.go | 63 ++------- .../monitoring_console_test.go | 8 +- test/testenv/test_workflows.go | 15 ++- 12 files changed, 84 insertions(+), 190 deletions(-) diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go index 4ae4d41a7..7179ebaec 100644 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/custom_resource_crud_c3_test.go @@ -39,9 +39,9 @@ var _ = Describe("Crcrud test for SVA C3", func() { err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = "4" - newCPULimits = "2" - verificationTimeout = 150 * time.Second + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits + verificationTimeout = DefaultVerificationTimeout }) AfterEach(func() { diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index 71b4fb67f..4eba1eb1c 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -36,8 +36,8 @@ var _ = Describe("Crcrud test for SVA M4", func() { err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = "4" - newCPULimits = "2" + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits }) AfterEach(func() { diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go index 48784369c..bb9125a58 100644 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ b/test/custom_resource_crud/custom_resource_crud_s1_test.go @@ -36,8 +36,8 @@ var _ = Describe("Crcrud test for SVA S1", func() { err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = "4" - newCPULimits = "2" + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits }) AfterEach(func() { diff --git a/test/custom_resource_crud/custom_resource_crud_suite_test.go b/test/custom_resource_crud/custom_resource_crud_suite_test.go index 8972ac76e..99b145c9b 100644 --- a/test/custom_resource_crud/custom_resource_crud_suite_test.go +++ b/test/custom_resource_crud/custom_resource_crud_suite_test.go @@ -30,6 +30,13 @@ const ( // ConsistentPollInterval is the interval to use to consistently check a state is stable ConsistentPollInterval = 200 * time.Millisecond ConsistentDuration = 2000 * time.Millisecond + + // DefaultCPULimits is the default CPU limit + DefaultCPULimits = "4" + // UpdatedCPULimits is the updated CPU limit + UpdatedCPULimits = "2" + // DefaultVerificationTimeout is the default timeout for CRUD verification steps + DefaultVerificationTimeout = 150 * time.Second ) var ( diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index 3c7228a70..23116832d 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -38,9 +38,9 @@ var _ = Describe("Crcrud test for SVA C3", func() { ctx := context.TODO() BeforeEach(func() { - defaultCPULimits = "4" - newCPULimits = "2" - verificationTimeout = 150 * time.Second + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits + verificationTimeout = DefaultVerificationTimeout testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index 0a974475c..1e4cf04f8 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -36,8 +36,8 @@ var _ = Describe("Crcrud test for SVA M4", func() { err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = "4" - newCPULimits = "2" + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits }) AfterEach(func() { diff --git a/test/example/example1_test.go b/test/example/example1_test.go index bba0023d1..1ea0ffc95 100644 --- a/test/example/example1_test.go +++ b/test/example/example1_test.go @@ -14,12 +14,10 @@ package example import ( - "fmt" "math/rand" "time" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -31,20 +29,11 @@ var _ = XDescribe("Example1", func() { // This is invoke for each "It" spec below BeforeEach(func() { - var err error - // Create a deployment for this test - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - deployment.Teardown() - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) // "It" spec diff --git a/test/example/example2_test.go b/test/example/example2_test.go index 3988e0976..b692860f6 100644 --- a/test/example/example2_test.go +++ b/test/example/example2_test.go @@ -14,12 +14,10 @@ package example import ( - "fmt" "math/rand" "time" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -31,20 +29,11 @@ var _ = XDescribe("Example2", func() { // This is invoke for each "It" spec below BeforeEach(func() { - var err error - // Create a deployment for this test - name := fmt.Sprintf("%s-%s", testenvInstance.GetName(), testenv.RandomDNSName(3)) - testcaseEnvInst, err = testenv.NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) - Expect(err).To(Succeed(), "Unable to create testcaseenv") - deployment, err = testcaseEnvInst.NewDeployment(testenv.RandomDNSName(3)) - Expect(err).To(Succeed(), "Unable to create deployment") + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") }) AfterEach(func() { - deployment.Teardown() - if testcaseEnvInst != nil { - Expect(testcaseEnvInst.Teardown()).ToNot(HaveOccurred()) - } + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) // "It" spec diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 4ddf7ec17..26910a4d0 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -41,8 +41,6 @@ var _ = Describe("indingsep test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - Expect(testcaseEnvInst).ToNot(BeNil(), "testcaseEnvInst should not be nil after SetupTestCaseEnv") - Expect(deployment).ToNot(BeNil(), "deployment should not be nil after SetupTestCaseEnv") // Validate test prerequisites early to fail fast err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) @@ -69,53 +67,11 @@ var _ = Describe("indingsep test", func() { // testcaseEnvInst.Log.Info("Create Service Account") // testcaseEnvInst.CreateServiceAccount(serviceAccountName) - // Secret reference - volumeSpec := []enterpriseApi.SQSVolumeSpec{testenv.GenerateQueueVolumeSpec( - "queue-secret-ref-volume", - testcaseEnvInst.GetIndexIngestSepSecretName(), - )} - queue.SQS.VolList = volumeSpec - - // Deploy Queue - testcaseEnvInst.Log.Info("Deploy Queue") - q, err := deployment.DeployQueue(ctx, "queue", queue) - Expect(err).To(Succeed(), "Unable to deploy Queue") - - // Deploy ObjectStorage - testcaseEnvInst.Log.Info("Deploy ObjectStorage") - objStorage, err := deployment.DeployObjectStorage(ctx, "os", objectStorage) - Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") - - // Deploy Ingestor Cluster - testcaseEnvInst.Log.Info("Deploy Ingestor Cluster") - _, err = deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") // , serviceAccountName) - Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster") - - // Deploy Cluster Manager - testcaseEnvInst.Log.Info("Deploy Cluster Manager") - _, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Deploy Indexer Cluster - testcaseEnvInst.Log.Info("Deploy Indexer Cluster") - _, err = deployment.DeployIndexerCluster(ctx, deployment.GetName()+"-idxc", "", 3, deployment.GetName(), "", v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") // , serviceAccountName) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster") - - // Ensure that Ingestor Cluster is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Ingestor Cluster is in Ready phase") - testcaseEnvInst.VerifyIngestorReady(ctx, deployment) - - // Ensure that Cluster Manager is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Cluster Manager is in Ready phase") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure that Indexer Cluster is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Indexer Cluster is in Ready phase") - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + setupIngestorStack(ctx, deployment, testcaseEnvInst, queue, objectStorage, cmSpec) // Delete the Indexer Cluster idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) + err := deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance", "Indexer Cluster Name", idxc) err = deployment.DeleteCR(ctx, idxc) Expect(err).To(Succeed(), "Unable to delete Indexer Cluster instance", "Indexer Cluster Name", idxc) @@ -128,14 +84,14 @@ var _ = Describe("indingsep test", func() { Expect(err).To(Succeed(), "Unable to delete Ingestor Cluster instance", "Ingestor Cluster Name", ingest) // Delete the Queue - q = &enterpriseApi.Queue{} + q := &enterpriseApi.Queue{} err = deployment.GetInstance(ctx, "queue", q) Expect(err).To(Succeed(), "Unable to get Queue instance", "Queue Name", q) err = deployment.DeleteCR(ctx, q) Expect(err).To(Succeed(), "Unable to delete Queue", "Queue Name", q) // Delete the ObjectStorage - objStorage = &enterpriseApi.ObjectStorage{} + objStorage := &enterpriseApi.ObjectStorage{} err = deployment.GetInstance(ctx, "os", objStorage) Expect(err).To(Succeed(), "Unable to get ObjectStorage instance", "ObjectStorage Name", objStorage) err = deployment.DeleteCR(ctx, objStorage) @@ -263,54 +219,12 @@ var _ = Describe("indingsep test", func() { // testcaseEnvInst.Log.Info("Create Service Account") // testcaseEnvInst.CreateServiceAccount(serviceAccountName) - // Secret reference - volumeSpec := []enterpriseApi.SQSVolumeSpec{testenv.GenerateQueueVolumeSpec( - "queue-secret-ref-volume", - testcaseEnvInst.GetIndexIngestSepSecretName(), - )} - queue.SQS.VolList = volumeSpec - - // Deploy Queue - testcaseEnvInst.Log.Info("Deploy Queue") - q, err := deployment.DeployQueue(ctx, "queue", queue) - Expect(err).To(Succeed(), "Unable to deploy Queue") - - // Deploy ObjectStorage - testcaseEnvInst.Log.Info("Deploy ObjectStorage") - objStorage, err := deployment.DeployObjectStorage(ctx, "os", objectStorage) - Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") - - // Deploy Ingestor Cluster - testcaseEnvInst.Log.Info("Deploy Ingestor Cluster") - _, err = deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") // , serviceAccountName) - Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster") - - // Deploy Cluster Manager - testcaseEnvInst.Log.Info("Deploy Cluster Manager") - _, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Deploy Indexer Cluster - testcaseEnvInst.Log.Info("Deploy Indexer Cluster") - _, err = deployment.DeployIndexerCluster(ctx, deployment.GetName()+"-idxc", "", 3, deployment.GetName(), "", v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") // , serviceAccountName) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster") - - // Ensure that Ingestor Cluster is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Ingestor Cluster is in Ready phase") - testcaseEnvInst.VerifyIngestorReady(ctx, deployment) - - // Ensure that Cluster Manager is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Cluster Manager is in Ready phase") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure that Indexer Cluster is in Ready phase - testcaseEnvInst.Log.Info("Ensure that Indexer Cluster is in Ready phase") - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + setupIngestorStack(ctx, deployment, testcaseEnvInst, queue, objectStorage, cmSpec) // Get instance of current Ingestor Cluster CR with latest config testcaseEnvInst.Log.Info("Get instance of current Ingestor Cluster CR with latest config") ingest := &enterpriseApi.IngestorCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) + err := deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) Expect(err).To(Succeed(), "Failed to get instance of Ingestor Cluster") // Verify Ingestor Cluster Status @@ -373,3 +287,32 @@ var _ = Describe("indingsep test", func() { }) }) }) + +// setupIngestorStack deploys the full Queue/ObjectStorage/IngestorCluster/ClusterManager/IndexerCluster stack +// and verifies each component reaches the Ready phase. +func setupIngestorStack(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, qSpec enterpriseApi.QueueSpec, osSpec enterpriseApi.ObjectStorageSpec, cmSpec enterpriseApi.ClusterManagerSpec) { + volumeSpec := []enterpriseApi.SQSVolumeSpec{testenv.GenerateQueueVolumeSpec( + "queue-secret-ref-volume", + testcaseEnvInst.GetIndexIngestSepSecretName(), + )} + qSpec.SQS.VolList = volumeSpec + + q, err := deployment.DeployQueue(ctx, "queue", qSpec) + Expect(err).To(Succeed(), "Unable to deploy Queue") + + objStorage, err := deployment.DeployObjectStorage(ctx, "os", osSpec) + Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") + + _, err = deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") + Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster") + + _, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec) + Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") + + _, err = deployment.DeployIndexerCluster(ctx, deployment.GetName()+"-idxc", "", 3, deployment.GetName(), "", v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") + Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster") + + testcaseEnvInst.VerifyIngestorReady(ctx, deployment) + testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) +} diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index c1c301813..afa4e6579 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -66,10 +66,7 @@ var _ = Describe("Monitoring Console test", func() { */ // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -125,11 +122,7 @@ var _ = Describe("Monitoring Console test", func() { Expect(err).To(Succeed(), "Unable to update Standalone with new MC Name") // Deploy 2nd MC Pod - mcTwo, err := deployment.DeployMonitoringConsole(ctx, mcTwoName, "") - Expect(err).To(Succeed(), "Unable to deploy Second Monitoring Console Pod") - - // Verify 2nd Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // Check Standalone is configure in MC Config Map testcaseEnvInst.Log.Info("Checking for Standalone Pod on SECOND MC Config Map after Standalone RECONFIG") @@ -195,11 +188,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standaloneOne) // Deploy MC and wait for MC to be READY - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Check Standalone is configure in MC Config Map standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) @@ -349,11 +338,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) // Deploy MC and wait for MC to be READY - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Check Standalone is configure in MC Config Map standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 1, false, 0) @@ -429,16 +414,12 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - err = deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) + err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") // Ensure that the cluster-manager goes to Ready phase @@ -604,16 +585,12 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - err = deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) + err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") // Ensure that the cluster-manager goes to Ready phase @@ -680,11 +657,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) // Deploy Monitoring Console Pod - mcTwo, err := deployment.DeployMonitoringConsole(ctx, mcTwoName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console TWO is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### @@ -845,11 +818,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Check Monitoring console is configured with all search head instances in namespace shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) @@ -888,11 +857,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) // Deploy Monitoring Console Pod - mcTwo, err := deployment.DeployMonitoringConsole(ctx, mcTwoName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console Two instance") - - // Verify Monitoring Console TWO is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // Check Cluster Manager in Monitoring Console Config Map testcaseEnvInst.Log.Info("Checking for Cluster Manager on MC TWO CONFIG MAP after Cluster Manager RECONFIG") @@ -977,11 +942,7 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneOneName, standaloneOne) // Deploy MC and wait for MC to be READY - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Check standaloneOne is configured in MC Config Map standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index a603b207f..020f23d32 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -162,16 +162,12 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - err = deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) + err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") // Ensure that the cluster-master goes to Ready phase diff --git a/test/testenv/test_workflows.go b/test/testenv/test_workflows.go index a91416604..b84cd574c 100644 --- a/test/testenv/test_workflows.go +++ b/test/testenv/test_workflows.go @@ -225,9 +225,18 @@ func RunIngestAndSearchWorkflow(ctx context.Context, deployment *Deployment, tes testcaseEnvInst.Log.Info("Search completed", "results", searchResults) } -// RunScaleUpScaleDownWorkflow scales a cluster up and down and verifies state -func RunScaleUpScaleDownWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, crType string, name string, initialReplicas int, scaledReplicas int) { - // Removed non-existent Scale functions +// RunMonitoringConsoleDeploymentWorkflow deploys a Monitoring Console instance and verifies it is ready +func RunMonitoringConsoleDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, name, "") + return &WorkflowResult{MonitoringConsole: mc} +} + +// RunLicenseManagerDeploymentWorkflow deploys a License Manager instance and verifies it is ready +func RunLicenseManagerDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { + lm, err := deployment.DeployLicenseManager(ctx, name) + Expect(err).To(Succeed(), "Unable to deploy License Manager") + testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) + return &WorkflowResult{LicenseManager: lm} } // RunCompleteDataIngestionWorkflow performs complete data ingestion workflow: ingest, verify, roll to warm, verify on S3 From 27209e21f66e1a2e0fb920cdb63366a662436648 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 12:58:31 +0100 Subject: [PATCH 09/20] CSPL-3775 Ingest functions --- .../ingest_search_shared_test.go | 210 ++++++++++++++++++ test/ingest_search/ingest_search_test.go | 201 +---------------- test/smartstore/smartstore_test.go | 70 +----- test/smartstore/smartstore_test_shared.go | 25 +++ test/testenv/test_workflows.go | 19 +- 5 files changed, 246 insertions(+), 279 deletions(-) create mode 100644 test/ingest_search/ingest_search_shared_test.go diff --git a/test/ingest_search/ingest_search_shared_test.go b/test/ingest_search/ingest_search_shared_test.go new file mode 100644 index 000000000..af5aec16c --- /dev/null +++ b/test/ingest_search/ingest_search_shared_test.go @@ -0,0 +1,210 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package ingestsearchtest + +import ( + "bufio" + "context" + "encoding/json" + "fmt" + "io" + "os" + "strings" + "time" + + . "github.com/onsi/gomega" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" +) + +// RunS1InternalLogSearchTest deploys a Standalone instance and verifies internal log searches +// using both synchronous and asynchronous search APIs. +func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) { + standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + Eventually(func() enterpriseApi.Phase { + podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + + searchString := "index=_internal | stats count by host" + searchResultsResp, err := testenv.PerformSearchSync(ctx, podName, searchString, deployment) + if err != nil { + testcaseEnvInst.Log.Error(err, "Failed to execute search on pod", "pod", podName, "searchString", searchString) + return enterpriseApi.PhaseError + } + testcaseEnvInst.Log.Info("Performed a search", "searchString", searchString) + + var searchResults map[string]interface{} + unmarshalErr := json.Unmarshal([]byte(searchResultsResp), &searchResults) + if unmarshalErr != nil { + testcaseEnvInst.Log.Error(unmarshalErr, "Failed to unmarshal JSON response") + } + + prettyResults, jsonErr := json.MarshalIndent(searchResults, "", " ") + if jsonErr != nil { + testcaseEnvInst.Log.Error(jsonErr, "Failed to generate pretty json") + } else { + testcaseEnvInst.Log.Info("Sync Search results:", "prettyResults", string(prettyResults)) + } + + return standalone.Status.Phase + }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + + Eventually(func() enterpriseApi.Phase { + podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + searchString := "index=_internal GUID component=ServerConfig" + + sid, reqErr := testenv.PerformSearchReq(ctx, podName, searchString, deployment) + if reqErr != nil { + testcaseEnvInst.Log.Error(reqErr, "Failed to execute search on pod", "pod", podName, "searchString", searchString) + return enterpriseApi.PhaseError + } + testcaseEnvInst.Log.Info("Got a search with sid", "sid", sid) + + searchStatusResult, statusErr := testenv.GetSearchStatus(ctx, podName, sid, deployment) + if statusErr != nil { + testcaseEnvInst.Log.Error(statusErr, "Failed to get search status on pod", "pod", podName, "sid", sid) + return enterpriseApi.PhaseError + } + testcaseEnvInst.Log.Info("Search status:", "searchStatusResult", searchStatusResult) + + searchResultsResp, resErr := testenv.GetSearchResults(ctx, podName, sid, deployment) + if resErr != nil { + testcaseEnvInst.Log.Error(resErr, "Failed to get search results on pod", "pod", podName, "sid", sid) + return enterpriseApi.PhaseError + } + + prettyResults, jsonErr := json.MarshalIndent(searchResultsResp, "", " ") + if jsonErr != nil { + testcaseEnvInst.Log.Error(jsonErr, "Failed to generate pretty json") + } else { + testcaseEnvInst.Log.Info("Search results:", "prettyResults", string(prettyResults)) + } + + return standalone.Status.Phase + }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) +} + +// RunS1IngestAndSearchTest deploys a Standalone instance, ingests a custom log file into a new +// index, and verifies the ingested data is searchable via both sync and async search APIs. +func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) { + standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") + Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + + Eventually(func() enterpriseApi.Phase { + podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + + splunkBin := "/opt/splunk/bin/splunk" + username := "admin" + password := "$(cat /mnt/splunk-secrets/password)" + splunkCmd := "status" + + statusCmd := fmt.Sprintf("%s %s -auth %s:%s", splunkBin, splunkCmd, username, password) + command := []string{"/bin/bash"} + statusCmdResp, stderr, err := deployment.PodExecCommand(ctx, podName, command, statusCmd, false) + if err != nil { + testcaseEnvInst.Log.Error(err, "Failed to execute command on pod", "pod", podName, "statusCmd", statusCmd, "statusCmdResp", statusCmdResp, "stderr", stderr) + return enterpriseApi.PhaseError + } + + if !strings.Contains(strings.ToLower(statusCmdResp), strings.ToLower("splunkd is running")) { + testcaseEnvInst.Log.Error(err, "Failed to find splunkd running", "pod", podName, "statusCmdResp", statusCmdResp) + return enterpriseApi.PhaseError + } + + testcaseEnvInst.Log.Info("Waiting for standalone splunkd status to be ready", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase) + return standalone.Status.Phase + }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + + podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + indexName := "myTestIndex" + + err = testenv.CreateAnIndexStandalone(ctx, indexName, podName, deployment) + Expect(err).To(Succeed(), "Failed response to add index to splunk") + + logFile := "/tmp/test.log" + err = testenv.CreateMockLogfile(logFile, 1) + Expect(err).To(Succeed(), "Failed response to add index to splunk logfile %s", logFile) + + err = testenv.IngestFileViaOneshot(ctx, logFile, indexName, podName, deployment) + Expect(err).To(Succeed(), "Failed to ingest logfile %s on pod %s", logFile, podName) + + file, openErr := os.Open(logFile) + Expect(openErr).To(Succeed(), "Failed to open newly created logfile %s on pod %s", logFile, podName) + + reader := bufio.NewReader(file) + firstLine, readErr := reader.ReadString('\n') + Expect(readErr).Should(Or(BeNil(), Equal(io.EOF)), "Failed to read first line of logfile %s on pod ", logFile, podName) + + tokens := strings.Fields(firstLine) + Expect(len(tokens)).To(BeNumerically(">=", 2), "Incorrect tokens (%s) in first logline %s for logfile %s", tokens, firstLine, logFile) + + searchToken := tokens[len(tokens)-1] + testcaseEnvInst.Log.Info("Got search token successfully", "logFile", logFile, "searchToken", searchToken) + + searchString := fmt.Sprintf("index=%s | stats count by host", indexName) + + err = testenv.WaitForSearchResultsNonEmpty(ctx, deployment, podName, searchString, 2*time.Second) + Expect(err).To(Succeed(), "Timed out waiting for search results") + + searchResultsResp, err := testenv.PerformSearchSync(ctx, podName, searchString, deployment) + Expect(err).To(Succeed(), "Failed to execute search '%s' on pod %s", podName, searchString) + + var searchResults map[string]interface{} + jsonErr := json.Unmarshal([]byte(searchResultsResp), &searchResults) + Expect(jsonErr).To(Succeed(), "Failed to unmarshal JSON Search Results from response '%s'", searchResultsResp) + + testcaseEnvInst.Log.Info("Search results :", "searchResults", searchResults["result"]) + Expect(searchResults["result"]).ShouldNot(BeNil(), "No results in search response '%s' on pod %s", searchResults, podName) + + hostCount := searchResults["result"].(map[string]interface{}) + testcaseEnvInst.Log.Info("Sync Search results host count:", "count", hostCount["count"].(string), "host", hostCount["host"].(string)) + testHostCnt := strings.Compare(hostCount["count"].(string), "1") + testHostname := strings.Compare(hostCount["host"].(string), podName) + Expect(testHostCnt).To(Equal(0), "Incorrect search results for count. Expect: 1 Got: %d", hostCount["count"].(string)) + Expect(testHostname).To(Equal(0), "Incorrect search result hostname. Expect: %s Got: %s", podName, hostCount["host"].(string)) + + searchString2 := fmt.Sprintf("index=%s %s", indexName, searchToken) + sid, reqErr := testenv.PerformSearchReq(ctx, podName, searchString2, deployment) + Expect(reqErr).To(Succeed(), "Failed to execute search '%s' on pod %s", searchString, podName) + testcaseEnvInst.Log.Info("Got a search with sid", "sid", sid) + + searchStatusResult, statusErr := testenv.GetSearchStatus(ctx, podName, sid, deployment) + Expect(statusErr).To(Succeed(), "Failed to get search status on pod %s for sid %s", podName, sid) + testcaseEnvInst.Log.Info("Search status:", "searchStatusResult", searchStatusResult) + + searchResultsResp, resErr := testenv.GetSearchResults(ctx, podName, sid, deployment) + Expect(resErr).To(Succeed(), "Failed to get search results on pod %s for sid %s", podName, sid) + + testcaseEnvInst.Log.Info("Raw Search results:", "searchResultsResp", searchResultsResp) + var searchResults2 testenv.SearchJobResultsResponse + jsonErr = json.Unmarshal([]byte(searchResultsResp), &searchResults2) + Expect(jsonErr).To(Succeed(), "Failed to unmarshal JSON Search Results from response '%s'", searchResultsResp) + + found := false + for key, elem := range searchResults2.Results { + testcaseEnvInst.Log.Info("Search results _raw and host:", "_raw", elem.Raw, "host", elem.SplunkServer, "firstLine", firstLine) + trimFirstLine := strings.TrimSuffix(firstLine, "\n") + if strings.Compare(elem.Raw, trimFirstLine) == 0 { + testcaseEnvInst.Log.Info("Found search results in _raw and splunk_server", "key", key, "podName", podName, "elem", elem) + found = true + } + } + Expect(found).To(Equal(true), "Incorrect search results %s", searchResults) +} diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index 5e732e0b8..fcd4d1f0c 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -14,16 +14,7 @@ package ingestsearchtest import ( - "bufio" "context" - "encoding/json" - "fmt" - "io" - "os" - "strings" - "time" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -35,7 +26,6 @@ var _ = Describe("Ingest and Search Test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment - var firstLine string ctx := context.TODO() BeforeEach(func() { @@ -52,200 +42,13 @@ var _ = Describe("Ingest and Search Test", func() { Context("Standalone deployment (S1)", func() { It("ingest_search, integration, s1: can search internal logs for standalone instance", func() { - - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) - - searchString := "index=_internal | stats count by host" - searchResultsResp, err := testenv.PerformSearchSync(ctx, podName, searchString, deployment) - if err != nil { - testcaseEnvInst.Log.Error(err, "Failed to execute search on pod", "pod", podName, "searchString", searchString) - return enterpriseApi.PhaseError - } - testcaseEnvInst.Log.Info("Performed a search", "searchString", searchString) - - var searchResults map[string]interface{} - unmarshalErr := json.Unmarshal([]byte(searchResultsResp), &searchResults) - if unmarshalErr != nil { - testcaseEnvInst.Log.Error(unmarshalErr, "Failed to unmarshal JSON response") - } - - prettyResults, jsonErr := json.MarshalIndent(searchResults, "", " ") - if jsonErr != nil { - testcaseEnvInst.Log.Error(jsonErr, "Failed to generate pretty json") - } else { - testcaseEnvInst.Log.Info("Sync Search results:", "prettyResults", string(prettyResults)) - } - - return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) - - Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) - searchString := "index=_internal GUID component=ServerConfig" - - // Perform a simple search - sid, reqErr := testenv.PerformSearchReq(ctx, podName, searchString, deployment) - if reqErr != nil { - testcaseEnvInst.Log.Error(reqErr, "Failed to execute search on pod", "pod", podName, "searchString", searchString) - return enterpriseApi.PhaseError - } - testcaseEnvInst.Log.Info("Got a search with sid", "sid", sid) - - // Check SID status until done - searchStatusResult, statusErr := testenv.GetSearchStatus(ctx, podName, sid, deployment) - if statusErr != nil { - testcaseEnvInst.Log.Error(statusErr, "Failed to get search status on pod", "pod", podName, "sid", sid) - return enterpriseApi.PhaseError - } - testcaseEnvInst.Log.Info("Search status:", "searchStatusResult", searchStatusResult) - - // Get SID results - searchResultsResp, resErr := testenv.GetSearchResults(ctx, podName, sid, deployment) - if resErr != nil { - testcaseEnvInst.Log.Error(resErr, "Failed to get search results on pod", "pod", podName, "sid", sid) - return enterpriseApi.PhaseError - } - - // Display results for debug purposes - prettyResults, jsonErr := json.MarshalIndent(searchResultsResp, "", " ") - if jsonErr != nil { - testcaseEnvInst.Log.Error(jsonErr, "Failed to generate pretty json") - } else { - testcaseEnvInst.Log.Info("Search results:", "prettyResults", string(prettyResults)) - } - - return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + RunS1InternalLogSearchTest(ctx, deployment, testcaseEnvInst) }) }) Context("Standalone deployment (S1)", func() { It("ingest_search, integration, s1: can ingest custom data to new index and search", func() { - - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Verify splunk status is up - Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) - - splunkBin := "/opt/splunk/bin/splunk" - username := "admin" - password := "$(cat /mnt/splunk-secrets/password)" - splunkCmd := "status" - - statusCmd := fmt.Sprintf("%s %s -auth %s:%s", splunkBin, splunkCmd, username, password) - command := []string{"/bin/bash"} - statusCmdResp, stderr, err := deployment.PodExecCommand(ctx, podName, command, statusCmd, false) - if err != nil { - testcaseEnvInst.Log.Error(err, "Failed to execute command on pod", "pod", podName, "statusCmd", statusCmd, "statusCmdResp", statusCmdResp, "stderr", stderr) - return enterpriseApi.PhaseError - } - - if !strings.Contains(strings.ToLower(statusCmdResp), strings.ToLower("splunkd is running")) { - testcaseEnvInst.Log.Error(err, "Failed to find splunkd running", "pod", podName, "statusCmdResp", statusCmdResp) - return enterpriseApi.PhaseError - } - - testcaseEnvInst.Log.Info("Waiting for standalone splunkd status to be ready", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase) - return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) - - // Create an index - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) - indexName := "myTestIndex" - - // Create an index on a standalone instance - err = testenv.CreateAnIndexStandalone(ctx, indexName, podName, deployment) - Expect(err).To(Succeed(), "Failed response to add index to splunk") - - // Create a mock logfile to ingest - logFile := "/tmp/test.log" - err = testenv.CreateMockLogfile(logFile, 1) - Expect(err).To(Succeed(), "Failed response to add index to splunk logfile %s", logFile) - - // Copy log file and ingest it - err = testenv.IngestFileViaOneshot(ctx, logFile, indexName, podName, deployment) - Expect(err).To(Succeed(), "Failed to ingest logfile %s on pod %s", logFile, podName) - - // Read first line to find a search token - var file, openErr = os.Open(logFile) - Expect(openErr).To(Succeed(), "Failed to open newly created logfile %s on pod %s", logFile, podName) - - reader := bufio.NewReader(file) - var readErr error - firstLine, readErr = reader.ReadString('\n') - Expect(readErr).Should(Or(BeNil(), Equal(io.EOF)), "Failed to read first line of logfile %s on pod ", logFile, podName) - - tokens := strings.Fields(firstLine) - Expect(len(tokens)).To(BeNumerically(">=", 2), "Incorrect tokens (%s) in first logline %s for logfile %s", tokens, firstLine, logFile) - - searchToken := tokens[len(tokens)-1] - testcaseEnvInst.Log.Info("Got search token successfully", "logFile", logFile, "searchToken", searchToken) - - searchString := fmt.Sprintf("index=%s | stats count by host", indexName) - - // Wait for search results to be available instead of fixed sleep - err = testenv.WaitForSearchResultsNonEmpty(ctx, deployment, podName, searchString, 2*time.Second) - Expect(err).To(Succeed(), "Timed out waiting for search results") - - searchResultsResp, err := testenv.PerformSearchSync(ctx, podName, searchString, deployment) - Expect(err).To(Succeed(), "Failed to execute search '%s' on pod %s", podName, searchString) - - // Verify result. Should get count 1. result:{count:1} - var searchResults map[string]interface{} - jsonErr := json.Unmarshal([]byte(searchResultsResp), &searchResults) - Expect(jsonErr).To(Succeed(), "Failed to unmarshal JSON Search Results from response '%s'", searchResultsResp) - - testcaseEnvInst.Log.Info("Search results :", "searchResults", searchResults["result"]) - Expect(searchResults["result"]).ShouldNot(BeNil(), "No results in search response '%s' on pod %s", searchResults, podName) - - hostCount := searchResults["result"].(map[string]interface{}) - testcaseEnvInst.Log.Info("Sync Search results host count:", "count", hostCount["count"].(string), "host", hostCount["host"].(string)) - testHostCnt := strings.Compare(hostCount["count"].(string), "1") - testHostname := strings.Compare(hostCount["host"].(string), podName) - Expect(testHostCnt).To(Equal(0), "Incorrect search results for count. Expect: 1 Got: %d", hostCount["count"].(string)) - Expect(testHostname).To(Equal(0), "Incorrect search result hostname. Expect: %s Got: %s", podName, hostCount["host"].(string)) - - searchString2 := fmt.Sprintf("index=%s %s", indexName, searchToken) - sid, reqErr := testenv.PerformSearchReq(ctx, podName, searchString2, deployment) - Expect(reqErr).To(Succeed(), "Failed to execute search '%s' on pod %s", searchString, podName) - testcaseEnvInst.Log.Info("Got a search with sid", "sid", sid) - - // Check SID status until done - searchStatusResult, statusErr := testenv.GetSearchStatus(ctx, podName, sid, deployment) - Expect(statusErr).To(Succeed(), "Failed to get search status on pod %s for sid %s", podName, sid) - testcaseEnvInst.Log.Info("Search status:", "searchStatusResult", searchStatusResult) - - // Get SID results - searchResultsResp, resErr := testenv.GetSearchResults(ctx, podName, sid, deployment) - Expect(resErr).To(Succeed(), "Failed to get search results on pod %s for sid %s", podName, sid) - - testcaseEnvInst.Log.Info("Raw Search results:", "searchResultsResp", searchResultsResp) - var searchResults2 testenv.SearchJobResultsResponse - jsonErr = json.Unmarshal([]byte(searchResultsResp), &searchResults2) - Expect(jsonErr).To(Succeed(), "Failed to unmarshal JSON Search Results from response '%s'", searchResultsResp) - - found := false - for key, elem := range searchResults2.Results { - testcaseEnvInst.Log.Info("Search results _raw and host:", "_raw", elem.Raw, "host", elem.SplunkServer, "firstLine", firstLine) - trimFirstLine := strings.TrimSuffix(firstLine, "\n") - if strings.Compare(elem.Raw, trimFirstLine) == 0 { - testcaseEnvInst.Log.Info("Found search results in _raw and splunk_server", "key", key, "podName", podName, "elem", elem) - found = true - } - } - Expect(found).To(Equal(true), "Incorrect search results %s", searchResults) + RunS1IngestAndSearchTest(ctx, deployment, testcaseEnvInst) }) }) }) diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index 86a51c328..4926fb0d4 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -9,7 +9,6 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" ) var _ = Describe("Smartstore test", func() { @@ -51,76 +50,15 @@ var _ = Describe("Smartstore test", func() { Context("Standalone deployment (S1) with App Framework", func() { It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Etc storage", func() { - - /* Test Steps - ################## SETUP #################### - * Create spec for Standalone - * Prepare and deploy Standalone and wait for the pod to be ready - ############ VERIFICATION FOR STANDALONE ########### - * verify Standalone comes up with Ephemeral for Etc and pvc for Var volume - */ - - // Create App framework spec for Standalone - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "Always", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ - StorageClassName: "TestStorageEtcEph", - StorageCapacity: "1Gi", - EphemeralStorage: true, - }, - }, - } - - // Deploy Standalone - testcaseEnvInst.Log.Info("Deploy Standalone") - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageEtcEph", StorageCapacity: "1Gi", EphemeralStorage: true} + RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, true) }) }) Context("Standalone deployment (S1) with App Framework", func() { It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Var storage", func() { - - /* Test Steps - ################## SETUP #################### - * Create spec for Standalone - * Prepare and deploy Standalone and wait for the pod to be ready - ############ VERIFICATION FOR STANDALONE ########### - * verify Standalone comes up with Ephemeral for Var and pvc for Etc volume - */ - - // Create App framework spec for Standalone - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "Always", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - VarVolumeStorageConfig: enterpriseApi.StorageClassSpec{ - StorageClassName: "TestStorageVarEph", - StorageCapacity: "1Gi", - EphemeralStorage: true, - }, - }, - } - - // Deploy Standalone - testcaseEnvInst.Log.Info("Deploy Standalone") - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - + storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageVarEph", StorageCapacity: "1Gi", EphemeralStorage: true} + RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, false) }) }) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index bec9adff8..8dfb2906a 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -21,6 +21,7 @@ import ( enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" + corev1 "k8s.io/api/core/v1" . "github.com/onsi/gomega" ) @@ -169,6 +170,30 @@ func RunS1DefaultVolumesTest(ctx context.Context, deployment *testenv.Deployment testcaseEnvInst.VerifyConfOnPod(deployment, podName, serverConfPath, "eviction_policy", cacheManagerSmartStoreSpec.EvictionPolicy) } +// RunS1EphemeralStorageTest deploys a Standalone with one ephemeral storage volume configured and verifies it is ready. +// Pass etcStorage=true to set EtcVolumeStorageConfig, false to set VarVolumeStorageConfig. +func RunS1EphemeralStorageTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, storageConfig enterpriseApi.StorageClassSpec, etcStorage bool) { + spec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "Always", + Image: testcaseEnvInst.GetSplunkImage(), + }, + Volumes: []corev1.Volume{}, + }, + } + if etcStorage { + spec.CommonSplunkSpec.EtcVolumeStorageConfig = storageConfig + } else { + spec.CommonSplunkSpec.VarVolumeStorageConfig = storageConfig + } + + standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) +} + // RunM4MultisiteSmartStoreTest runs the standard M4 multisite SmartStore test workflow func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig) { volName := "test-volume-" + testenv.RandomDNSName(3) diff --git a/test/testenv/test_workflows.go b/test/testenv/test_workflows.go index b84cd574c..581c52cf2 100644 --- a/test/testenv/test_workflows.go +++ b/test/testenv/test_workflows.go @@ -59,10 +59,7 @@ func RunStandaloneWithLMWorkflow(ctx context.Context, deployment *Deployment, te // RunStandaloneWithMCWorkflow deploys standalone with monitoring console and verifies both are ready func RunStandaloneWithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, mcName string) *WorkflowResult { - mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") standalone, err := deployment.DeployStandalone(ctx, name, "", mcName) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -88,12 +85,9 @@ func RunC3DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca // RunC3WithMCWorkflow deploys a C3 cluster with monitoring console and verifies all components func RunC3WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, mcName string) *WorkflowResult { - mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") - err = deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcName) + err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy C3 cluster") testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -121,12 +115,9 @@ func RunM4DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca // RunM4WithMCWorkflow deploys a M4 multisite cluster with monitoring console func RunM4WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int, mcName string) *WorkflowResult { - mc, err := deployment.DeployMonitoringConsole(ctx, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") - err = deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcName) + err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcName) Expect(err).To(Succeed(), "Unable to deploy M4 cluster") testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) From dd4ad6a83c36ace2180eb5c543c261a852f78e4f Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 14:23:34 +0100 Subject: [PATCH 10/20] CSPL-3775 Move verify prerequisites to setup --- test/appframework_aws/c3/appframework_aws_test.go | 4 ---- test/appframework_aws/c3/manager_appframework_test.go | 4 ---- test/appframework_aws/m4/appframework_aws_test.go | 4 ---- test/appframework_aws/m4/manager_appframework_test.go | 4 ---- test/appframework_aws/s1/appframework_aws_test.go | 4 ---- test/appframework_az/c3/appframework_azure_test.go | 4 ---- test/appframework_az/c3/manager_appframework_azure_test.go | 4 ---- test/appframework_az/m4/appframework_azure_test.go | 4 ---- test/appframework_az/m4/manager_appframework_azure_test.go | 4 ---- test/appframework_az/s1/appframework_azure_test.go | 4 ---- test/appframework_gcp/c3/appframework_gcs_test.go | 4 ---- test/appframework_gcp/c3/manager_appframework_test.go | 4 ---- test/appframework_gcp/m4/appframework_gcs_test.go | 4 ---- test/appframework_gcp/m4/manager_appframework_test.go | 4 ---- test/appframework_gcp/s1/appframework_gcs_test.go | 4 ---- test/custom_resource_crud/custom_resource_crud_c3_test.go | 5 ----- test/custom_resource_crud/custom_resource_crud_m4_test.go | 5 ----- test/custom_resource_crud/custom_resource_crud_s1_test.go | 5 ----- .../manager_custom_resource_crud_c3_test.go | 4 ---- .../manager_custom_resource_crud_m4_test.go | 5 ----- test/delete_cr/deletecr_test.go | 5 ----- .../index_and_ingestion_separation_test.go | 4 ---- test/ingest_search/ingest_search_test.go | 5 ----- test/licensemanager/lm_s1_test.go | 5 ----- test/licensemanager/manager_lm_c3_test.go | 5 ----- test/licensemanager/manager_lm_m4_test.go | 5 ----- test/licensemaster/lm_c3_test.go | 5 ----- test/licensemaster/lm_m4_test.go | 5 ----- test/licensemaster/lm_s1_test.go | 5 ----- test/monitoring_console/manager_monitoring_console_test.go | 4 ---- test/monitoring_console/monitoring_console_test.go | 4 ---- test/secret/manager_secret_c3_test.go | 5 ----- test/secret/manager_secret_m4_test.go | 5 ----- test/secret/manager_secret_s1_test.go | 5 ----- test/secret/secret_c3_test.go | 5 ----- test/secret/secret_m4_test.go | 5 ----- test/secret/secret_s1_test.go | 5 ----- test/smartstore/manager_smartstore_test.go | 5 ----- test/smartstore/smartstore_test.go | 5 ----- test/smoke/smoke_test.go | 5 ----- test/testenv/test_setup_helpers.go | 4 ++++ 41 files changed, 4 insertions(+), 181 deletions(-) diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 1948fc346..77e403590 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -54,10 +54,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") testenv.SpecifiedTestTimeout = 4000 - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index 0dd82ae19..a06b76d00 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -51,10 +51,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_aws/m4/appframework_aws_test.go b/test/appframework_aws/m4/appframework_aws_test.go index a0fe6df59..70e6aacdd 100644 --- a/test/appframework_aws/m4/appframework_aws_test.go +++ b/test/appframework_aws/m4/appframework_aws_test.go @@ -54,10 +54,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) s3TestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_aws/m4/manager_appframework_test.go b/test/appframework_aws/m4/manager_appframework_test.go index 0812f2470..db7026844 100644 --- a/test/appframework_aws/m4/manager_appframework_test.go +++ b/test/appframework_aws/m4/manager_appframework_test.go @@ -53,10 +53,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) s3TestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_aws/s1/appframework_aws_test.go b/test/appframework_aws/s1/appframework_aws_test.go index ba075a452..0ab37cf2a 100644 --- a/test/appframework_aws/s1/appframework_aws_test.go +++ b/test/appframework_aws/s1/appframework_aws_test.go @@ -47,10 +47,6 @@ var _ = Describe("s1appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - s3TestDir = "s1appfw-" + testenv.RandomDNSName(4) appSourceVolumeName = "appframework-test-volume-" + testenv.RandomDNSName(3) }) diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index 99616a22c..d2d0073e0 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -49,10 +49,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index e660c0d11..f94d8ea7c 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -48,10 +48,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_az/m4/appframework_azure_test.go b/test/appframework_az/m4/appframework_azure_test.go index ca42c1022..37cab8e92 100644 --- a/test/appframework_az/m4/appframework_azure_test.go +++ b/test/appframework_az/m4/appframework_azure_test.go @@ -53,10 +53,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - azTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) azTestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_az/m4/manager_appframework_azure_test.go b/test/appframework_az/m4/manager_appframework_azure_test.go index 8e1cfa637..c6565009b 100644 --- a/test/appframework_az/m4/manager_appframework_azure_test.go +++ b/test/appframework_az/m4/manager_appframework_azure_test.go @@ -52,10 +52,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - azTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) azTestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_az/s1/appframework_azure_test.go b/test/appframework_az/s1/appframework_azure_test.go index ab6bb882e..f216a79e1 100644 --- a/test/appframework_az/s1/appframework_azure_test.go +++ b/test/appframework_az/s1/appframework_azure_test.go @@ -43,10 +43,6 @@ var _ = Describe("s1appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - azTestDir = "s1appfw-" + testenv.RandomDNSName(4) appSourceVolumeName = "appframework-test-volume-" + testenv.RandomDNSName(3) }) diff --git a/test/appframework_gcp/c3/appframework_gcs_test.go b/test/appframework_gcp/c3/appframework_gcs_test.go index 9c930d0c6..6756e5826 100644 --- a/test/appframework_gcp/c3/appframework_gcs_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_test.go @@ -54,10 +54,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") testenv.SpecifiedTestTimeout = 5000 - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_gcp/c3/manager_appframework_test.go b/test/appframework_gcp/c3/manager_appframework_test.go index e19c75acd..305fac67b 100644 --- a/test/appframework_gcp/c3/manager_appframework_test.go +++ b/test/appframework_gcp/c3/manager_appframework_test.go @@ -52,10 +52,6 @@ var _ = Describe("c3appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") testenv.SpecifiedTestTimeout = 100000 - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/appframework_gcp/m4/appframework_gcs_test.go b/test/appframework_gcp/m4/appframework_gcs_test.go index 9272b53ce..f8d231e2c 100644 --- a/test/appframework_gcp/m4/appframework_gcs_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_test.go @@ -54,10 +54,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - gcsTestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) gcsTestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_gcp/m4/manager_appframework_test.go b/test/appframework_gcp/m4/manager_appframework_test.go index d7489a33f..b89953074 100644 --- a/test/appframework_gcp/m4/manager_appframework_test.go +++ b/test/appframework_gcp/m4/manager_appframework_test.go @@ -53,10 +53,6 @@ var _ = Describe("m4appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) s3TestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) appSourceVolumeNameIdxc = "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) diff --git a/test/appframework_gcp/s1/appframework_gcs_test.go b/test/appframework_gcp/s1/appframework_gcs_test.go index bf3fffb3b..ba252626b 100644 --- a/test/appframework_gcp/s1/appframework_gcs_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_test.go @@ -47,10 +47,6 @@ var _ = Describe("s1appfw test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - gcsTestDir = "s1appfw-" + testenv.RandomDNSName(4) appSourceVolumeName = "appframework-test-volume-" + testenv.RandomDNSName(3) }) diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go index 7179ebaec..c74899f4d 100644 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/custom_resource_crud_c3_test.go @@ -18,7 +18,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -35,10 +34,6 @@ var _ = Describe("Crcrud test for SVA C3", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits verificationTimeout = DefaultVerificationTimeout diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index 4eba1eb1c..acd34165c 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Crcrud test for SVA M4", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits }) diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go index bb9125a58..d3f968bcd 100644 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ b/test/custom_resource_crud/custom_resource_crud_s1_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Crcrud test for SVA S1", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index 23116832d..efcbabde2 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -43,10 +43,6 @@ var _ = Describe("Crcrud test for SVA C3", func() { verificationTimeout = DefaultVerificationTimeout testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index 1e4cf04f8..e36c4153d 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Crcrud test for SVA M4", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits }) diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index d73c2b9bd..637723a17 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -19,7 +19,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" testenv "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("DeleteCR test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 26910a4d0..a78fdd467 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -42,10 +42,6 @@ var _ = Describe("indingsep test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") - cmSpec = enterpriseApi.ClusterManagerSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index fcd4d1f0c..37de50115 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Ingest and Search Test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemanager/lm_s1_test.go b/test/licensemanager/lm_s1_test.go index c5d436d0c..6969505cb 100644 --- a/test/licensemanager/lm_s1_test.go +++ b/test/licensemanager/lm_s1_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Licensemanager test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") config = NewLicenseManagerConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemanager/manager_lm_c3_test.go b/test/licensemanager/manager_lm_c3_test.go index 2151b856c..027434849 100644 --- a/test/licensemanager/manager_lm_c3_test.go +++ b/test/licensemanager/manager_lm_c3_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Licensemanager test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") config = NewLicenseManagerConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemanager/manager_lm_m4_test.go b/test/licensemanager/manager_lm_m4_test.go index 314cf9abc..117bea76d 100644 --- a/test/licensemanager/manager_lm_m4_test.go +++ b/test/licensemanager/manager_lm_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -33,10 +32,6 @@ var _ = Describe("Licensemanager test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") config = NewLicenseManagerConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemaster/lm_c3_test.go b/test/licensemaster/lm_c3_test.go index 69bec2a24..89f9107cd 100644 --- a/test/licensemaster/lm_c3_test.go +++ b/test/licensemaster/lm_c3_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/licensemanager" "github.com/splunk/splunk-operator/test/testenv" ) @@ -33,10 +32,6 @@ var _ = Describe("licensemaster test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") config = licensemanager.NewLicenseMasterConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemaster/lm_m4_test.go b/test/licensemaster/lm_m4_test.go index 7a86153a1..1b2059c95 100644 --- a/test/licensemaster/lm_m4_test.go +++ b/test/licensemaster/lm_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/licensemanager" "github.com/splunk/splunk-operator/test/testenv" @@ -34,10 +33,6 @@ var _ = Describe("Licensemaster test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") config = licensemanager.NewLicenseMasterConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/licensemaster/lm_s1_test.go b/test/licensemaster/lm_s1_test.go index 359382ae6..b3cf5fc0c 100644 --- a/test/licensemaster/lm_s1_test.go +++ b/test/licensemaster/lm_s1_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/licensemanager" "github.com/splunk/splunk-operator/test/testenv" @@ -34,10 +33,6 @@ var _ = Describe("Licensemaster test", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") config = licensemanager.NewLicenseMasterConfig() - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index afa4e6579..d0f92faa5 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -37,10 +37,6 @@ var _ = Describe("Monitoring Console test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index 020f23d32..70c2516ad 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -34,10 +34,6 @@ var _ = Describe("Monitoring Console test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/manager_secret_c3_test.go b/test/secret/manager_secret_c3_test.go index 9b963aa4c..804c011f5 100644 --- a/test/secret/manager_secret_c3_test.go +++ b/test/secret/manager_secret_c3_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Secret Test for SVA C3", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/manager_secret_m4_test.go b/test/secret/manager_secret_m4_test.go index 1f579ee22..341514109 100644 --- a/test/secret/manager_secret_m4_test.go +++ b/test/secret/manager_secret_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -31,10 +30,6 @@ var _ = Describe("Secret Test for M4 SVA", func() { BeforeEach(func() { testenv.SpecifiedTestTimeout = 40000 testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/manager_secret_s1_test.go b/test/secret/manager_secret_s1_test.go index 23f44ee12..4bd72e302 100644 --- a/test/secret/manager_secret_s1_test.go +++ b/test/secret/manager_secret_s1_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Secret Test for SVA S1", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/secret_c3_test.go b/test/secret/secret_c3_test.go index af9df45b4..a789a3666 100644 --- a/test/secret/secret_c3_test.go +++ b/test/secret/secret_c3_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Secret Test for SVA C3", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/secret_m4_test.go b/test/secret/secret_m4_test.go index 648569554..1763e7430 100644 --- a/test/secret/secret_m4_test.go +++ b/test/secret/secret_m4_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -32,10 +31,6 @@ var _ = Describe("Secret Test for M4 SVA", func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") testenv.SpecifiedTestTimeout = 40000 - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/secret/secret_s1_test.go b/test/secret/secret_s1_test.go index c64ea8e57..9a6339ee3 100644 --- a/test/secret/secret_s1_test.go +++ b/test/secret/secret_s1_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Secret Test for SVA S1", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/smartstore/manager_smartstore_test.go b/test/smartstore/manager_smartstore_test.go index 69bb1e79a..1c0c34611 100644 --- a/test/smartstore/manager_smartstore_test.go +++ b/test/smartstore/manager_smartstore_test.go @@ -5,7 +5,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -18,10 +17,6 @@ var _ = Describe("Smartstore test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index 4926fb0d4..7afa5a2e9 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -5,7 +5,6 @@ import ( "time" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" @@ -19,10 +18,6 @@ var _ = Describe("Smartstore test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index 5da253437..7823ecea7 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" ) @@ -30,10 +29,6 @@ var _ = Describe("Smoke test", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - // Validate test prerequisites early to fail fast - err := testcaseEnvInst.ValidateTestPrerequisites(ctx, deployment) - Expect(err).To(Succeed(), "Test prerequisites validation failed") }) AfterEach(func() { diff --git a/test/testenv/test_setup_helpers.go b/test/testenv/test_setup_helpers.go index a9732abd7..bd49dba2b 100644 --- a/test/testenv/test_setup_helpers.go +++ b/test/testenv/test_setup_helpers.go @@ -25,6 +25,7 @@ import ( ) // SetupTestCaseEnv creates a new test case environment and deployment for use in BeforeEach blocks. +// It also validates test prerequisites immediately to fail fast before any long operations. func SetupTestCaseEnv(testenvInstance *TestEnv, namePrefix string) (*TestCaseEnv, *Deployment) { name := fmt.Sprintf("%s-%s", namePrefix+testenvInstance.GetName(), RandomDNSName(3)) testcaseEnvInst, err := NewDefaultTestCaseEnv(testenvInstance.GetKubeClient(), name) @@ -33,6 +34,9 @@ func SetupTestCaseEnv(testenvInstance *TestEnv, namePrefix string) (*TestCaseEnv deployment, err := testcaseEnvInst.NewDeployment(RandomDNSName(3)) Expect(err).To(Succeed(), "Unable to create deployment") + err = testcaseEnvInst.ValidateTestPrerequisites(context.TODO(), deployment) + Expect(err).To(Succeed(), "Test prerequisites validation failed") + return testcaseEnvInst, deployment } From 7e4dea90005776b06215df06dc7126b0652da972 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Fri, 20 Mar 2026 14:44:50 +0100 Subject: [PATCH 11/20] CSPL-3775 Remove constants that already exist --- .../appframework_aws/c3/appframework_aws_suite_test.go | 9 --------- .../appframework_aws/m4/appframework_aws_suite_test.go | 9 --------- .../appframework_aws/s1/appframework_aws_suite_test.go | 10 ---------- .../c3/appframework_azure_suite_test.go | 10 ---------- .../m4/appframework_azure_suite_test.go | 10 ---------- .../s1/appframework_azure_suite_test.go | 10 ---------- .../appframework_gcp/c3/appframework_gcs_suite_test.go | 10 ---------- .../appframework_gcp/m4/appframework_gcs_suite_test.go | 10 ---------- .../appframework_gcp/s1/appframework_gcs_suite_test.go | 10 ---------- .../custom_resource_crud_suite_test.go | 7 ------- test/delete_cr/deletecr_suite_test.go | 10 ---------- .../index_and_ingestion_separation_suite_test.go | 10 ---------- test/ingest_search/ingest_search_shared_test.go | 6 +++--- test/ingest_search/ingest_search_suite_test.go | 10 ---------- test/licensemanager/manager_suite_test.go | 10 ---------- test/licensemaster/lm_suite_test.go | 10 ---------- .../monitoring_console_suite_test.go | 9 --------- test/secret/secret_suite_test.go | 10 ---------- test/smartstore/smartstore_suite_test.go | 10 ---------- test/smoke/smoke_suite_test.go | 10 ---------- 20 files changed, 3 insertions(+), 187 deletions(-) diff --git a/test/appframework_aws/c3/appframework_aws_suite_test.go b/test/appframework_aws/c3/appframework_aws_suite_test.go index 6468b018a..5c3f43409 100644 --- a/test/appframework_aws/c3/appframework_aws_suite_test.go +++ b/test/appframework_aws/c3/appframework_aws_suite_test.go @@ -26,15 +26,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "c3appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_aws/m4/appframework_aws_suite_test.go b/test/appframework_aws/m4/appframework_aws_suite_test.go index aa21c7084..ecb5a4ce5 100644 --- a/test/appframework_aws/m4/appframework_aws_suite_test.go +++ b/test/appframework_aws/m4/appframework_aws_suite_test.go @@ -25,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "m4appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_aws/s1/appframework_aws_suite_test.go b/test/appframework_aws/s1/appframework_aws_suite_test.go index 252889490..4de99858c 100644 --- a/test/appframework_aws/s1/appframework_aws_suite_test.go +++ b/test/appframework_aws/s1/appframework_aws_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,15 +24,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "s1appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_az/c3/appframework_azure_suite_test.go b/test/appframework_az/c3/appframework_azure_suite_test.go index 313c7c4fc..20866fd5d 100644 --- a/test/appframework_az/c3/appframework_azure_suite_test.go +++ b/test/appframework_az/c3/appframework_azure_suite_test.go @@ -18,7 +18,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "c3appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_az/m4/appframework_azure_suite_test.go b/test/appframework_az/m4/appframework_azure_suite_test.go index 6184e543b..6b6779df2 100644 --- a/test/appframework_az/m4/appframework_azure_suite_test.go +++ b/test/appframework_az/m4/appframework_azure_suite_test.go @@ -18,7 +18,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "m4appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_az/s1/appframework_azure_suite_test.go b/test/appframework_az/s1/appframework_azure_suite_test.go index d3c06c3c4..35c28964f 100644 --- a/test/appframework_az/s1/appframework_azure_suite_test.go +++ b/test/appframework_az/s1/appframework_azure_suite_test.go @@ -18,7 +18,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "s1appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_gcp/c3/appframework_gcs_suite_test.go b/test/appframework_gcp/c3/appframework_gcs_suite_test.go index 9aa061bad..1fbf4f108 100644 --- a/test/appframework_gcp/c3/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,15 +24,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "c3appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_gcp/m4/appframework_gcs_suite_test.go b/test/appframework_gcp/m4/appframework_gcs_suite_test.go index 8f4a28249..08c0d2e42 100644 --- a/test/appframework_gcp/m4/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,15 +24,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "m4appfw-" + testenv.RandomDNSName(3) diff --git a/test/appframework_gcp/s1/appframework_gcs_suite_test.go b/test/appframework_gcp/s1/appframework_gcs_suite_test.go index af2fab4c2..7e92cf828 100644 --- a/test/appframework_gcp/s1/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,15 +24,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "s1appfw-" + testenv.RandomDNSName(3) diff --git a/test/custom_resource_crud/custom_resource_crud_suite_test.go b/test/custom_resource_crud/custom_resource_crud_suite_test.go index 99b145c9b..a3629752f 100644 --- a/test/custom_resource_crud/custom_resource_crud_suite_test.go +++ b/test/custom_resource_crud/custom_resource_crud_suite_test.go @@ -24,13 +24,6 @@ import ( ) const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond - // DefaultCPULimits is the default CPU limit DefaultCPULimits = "4" // UpdatedCPULimits is the updated CPU limit diff --git a/test/delete_cr/deletecr_suite_test.go b/test/delete_cr/deletecr_suite_test.go index 49b34af39..a8e834e9e 100644 --- a/test/delete_cr/deletecr_suite_test.go +++ b/test/delete_cr/deletecr_suite_test.go @@ -17,7 +17,6 @@ package deletecr import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,15 +24,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "deletecr-" + testenv.RandomDNSName(3) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go index d2c4be9f1..8907de94c 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "indingsep-" + testenv.RandomDNSName(3) diff --git a/test/ingest_search/ingest_search_shared_test.go b/test/ingest_search/ingest_search_shared_test.go index af5aec16c..1dccd1b58 100644 --- a/test/ingest_search/ingest_search_shared_test.go +++ b/test/ingest_search/ingest_search_shared_test.go @@ -62,7 +62,7 @@ func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deploym } return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) Eventually(func() enterpriseApi.Phase { podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) @@ -96,7 +96,7 @@ func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deploym } return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) } // RunS1IngestAndSearchTest deploys a Standalone instance, ingests a custom log file into a new @@ -130,7 +130,7 @@ func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deploymen testcaseEnvInst.Log.Info("Waiting for standalone splunkd status to be ready", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase) return standalone.Status.Phase - }, deployment.GetTimeout(), PollInterval).Should(Equal(enterpriseApi.PhaseReady)) + }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) indexName := "myTestIndex" diff --git a/test/ingest_search/ingest_search_suite_test.go b/test/ingest_search/ingest_search_suite_test.go index 301f11611..971345cb3 100644 --- a/test/ingest_search/ingest_search_suite_test.go +++ b/test/ingest_search/ingest_search_suite_test.go @@ -15,7 +15,6 @@ package ingestsearchtest import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -23,15 +22,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "ingest-" + testenv.RandomDNSName(3) diff --git a/test/licensemanager/manager_suite_test.go b/test/licensemanager/manager_suite_test.go index d504c3685..e5468e792 100644 --- a/test/licensemanager/manager_suite_test.go +++ b/test/licensemanager/manager_suite_test.go @@ -15,7 +15,6 @@ package licensemanager import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -23,15 +22,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "lmanager-" + testenv.RandomDNSName(3) diff --git a/test/licensemaster/lm_suite_test.go b/test/licensemaster/lm_suite_test.go index 9df3f4576..ed5c80594 100644 --- a/test/licensemaster/lm_suite_test.go +++ b/test/licensemaster/lm_suite_test.go @@ -15,7 +15,6 @@ package licensemaster import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -23,15 +22,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "lm-" + testenv.RandomDNSName(3) diff --git a/test/monitoring_console/monitoring_console_suite_test.go b/test/monitoring_console/monitoring_console_suite_test.go index 83bf2060d..5fab3715b 100644 --- a/test/monitoring_console/monitoring_console_suite_test.go +++ b/test/monitoring_console/monitoring_console_suite_test.go @@ -25,15 +25,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "mc-" + testenv.RandomDNSName(3) diff --git a/test/secret/secret_suite_test.go b/test/secret/secret_suite_test.go index c7d40946a..bfc9522cf 100644 --- a/test/secret/secret_suite_test.go +++ b/test/secret/secret_suite_test.go @@ -15,7 +15,6 @@ package secret import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -23,15 +22,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 10 * ConsistentPollInterval -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "secret-" + testenv.RandomDNSName(3) diff --git a/test/smartstore/smartstore_suite_test.go b/test/smartstore/smartstore_suite_test.go index 693ca4cf8..beededf6a 100644 --- a/test/smartstore/smartstore_suite_test.go +++ b/test/smartstore/smartstore_suite_test.go @@ -2,7 +2,6 @@ package smartstore import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -10,15 +9,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "smartstore-" + testenv.RandomDNSName(3) diff --git a/test/smoke/smoke_suite_test.go b/test/smoke/smoke_suite_test.go index b47f8a984..3bdf0f80e 100644 --- a/test/smoke/smoke_suite_test.go +++ b/test/smoke/smoke_suite_test.go @@ -15,7 +15,6 @@ package smoke import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -23,15 +22,6 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -const ( - // PollInterval specifies the polling interval - PollInterval = 5 * time.Second - - // ConsistentPollInterval is the interval to use to consistently check a state is stable - ConsistentPollInterval = 200 * time.Millisecond - ConsistentDuration = 2000 * time.Millisecond -) - var ( testenvInstance *testenv.TestEnv testSuiteName = "smoke-" + testenv.RandomDNSName(3) From 0814b7092d2ce8c621e17304a043a8ca434b9668 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Tue, 24 Mar 2026 08:58:27 +0100 Subject: [PATCH 12/20] CSPL-3775 Standardizing suite_test.go --- .../c3/appframework_aws_suite_test.go | 79 +---- .../c3/appframework_aws_test.go | 22 +- .../c3/manager_appframework_test.go | 22 +- .../m4/appframework_aws_suite_test.go | 43 +-- .../m4/appframework_aws_test.go | 14 +- .../m4/manager_appframework_test.go | 14 +- .../s1/appframework_aws_suite_test.go | 45 +-- .../s1/appframework_aws_test.go | 20 +- .../c3/appframework_azure_suite_test.go | 42 +-- .../c3/appframework_azure_test.go | 18 +- .../c3/manager_appframework_azure_test.go | 18 +- .../m4/appframework_azure_suite_test.go | 46 +-- .../m4/appframework_azure_test.go | 12 +- .../m4/manager_appframework_azure_test.go | 12 +- .../s1/appframework_azure_suite_test.go | 42 +-- .../s1/appframework_azure_test.go | 18 +- .../c3/appframework_gcs_suite_test.go | 43 +-- .../c3/manager_appframework_test.go | 20 +- .../m4/appframework_gcs_suite_test.go | 44 +-- .../m4/appframework_gcs_test.go | 14 +- .../m4/manager_appframework_test.go | 14 +- .../s1/appframework_gcs_suite_test.go | 39 +-- .../s1/appframework_gcs_test.go | 20 +- .../custom_resource_crud_suite_test.go | 1 - test/delete_cr/deletecr_suite_test.go | 4 +- test/example/example_suite_test.go | 11 +- ...dex_and_ingestion_separation_suite_test.go | 3 +- .../ingest_search/ingest_search_suite_test.go | 1 - .../manager_monitoring_console_test.go | 291 +----------------- .../monitoring_console_suite_test.go | 4 +- .../monitoring_console_test_shared.go | 149 +++++++++ test/secret/secret_suite_test.go | 1 - test/secret/secret_test_shared.go | 161 +++------- test/smartstore/smartstore_suite_test.go | 14 +- test/smoke/smoke_suite_test.go | 1 - test/testenv/test_setup_helpers.go | 118 +++++++ 36 files changed, 476 insertions(+), 944 deletions(-) create mode 100644 test/monitoring_console/monitoring_console_test_shared.go diff --git a/test/appframework_aws/c3/appframework_aws_suite_test.go b/test/appframework_aws/c3/appframework_aws_suite_test.go index 5c3f43409..8df2aca24 100644 --- a/test/appframework_aws/c3/appframework_aws_suite_test.go +++ b/test/appframework_aws/c3/appframework_aws_suite_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/joho/godotenv" "github.com/splunk/splunk-operator/test/testenv" ) @@ -33,9 +32,6 @@ var ( appListV2 []string testDataS3Bucket = os.Getenv("TEST_BUCKET") testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - s3AppDirV1 = testenv.AppLocationV1 - s3AppDirV2 = testenv.AppLocationV2 - s3PVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "c3appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "c3appfwV2-"+testenv.RandomDNSName(4)) @@ -46,9 +42,7 @@ var ( func TestBasic(t *testing.T) { RegisterFailHandler(Fail) - // Find and load the .env file from the current directory upwards - err := loadEnvFile() - Expect(err).ToNot(HaveOccurred(), "Error loading .env file") + Expect(testenv.LoadEnvFile()).ToNot(HaveOccurred(), "Error loading .env file") sc, _ := GinkgoConfiguration() sc.Timeout = 240 * time.Minute @@ -56,77 +50,10 @@ func TestBasic(t *testing.T) { RunSpecs(t, "Running "+testSuiteName, sc) } -//func TestMain(m *testing.M) { -// Run the tests -// os.Exit(m.Run()) -//} - -// loadEnvFile traverses up the directory tree to find a .env file -func loadEnvFile() error { - // Get the current working directory - dir, err := os.Getwd() - if err != nil { - return err - } - - // Traverse up the directory tree - for { - // Check if .env file exists in the current directory - envFile := filepath.Join(dir, ".env") - if _, err := os.Stat(envFile); err == nil { - // .env file found, load it - return godotenv.Load(envFile) - } - - // Move up to the parent directory - parentDir := filepath.Dir(dir) - if parentDir == dir { - // Reached the root directory - return nil - } - dir = parentDir - } -} - var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "eks" { - // Create a list of apps to upload to S3 - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to S3 after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupS3AppsSuite(testSuiteName, testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 77e403590..1634b050f 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -1377,7 +1377,7 @@ var _ = Describe("c3appfw test", func() { // Download apps from S3 testcaseEnvInst.Log.Info("Download bigger amount of apps from S3 for this test") - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") // Create consolidated list of app files @@ -2151,7 +2151,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to S3 for Cluster Master @@ -2280,7 +2280,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to S3 for Cluster Master @@ -2383,7 +2383,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2477,7 +2477,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2690,7 +2690,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to S3 for Indexer Cluster @@ -2807,7 +2807,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3PVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to S3 for Indexer Cluster @@ -2896,7 +2896,7 @@ var _ = Describe("c3appfw test", func() { // Download big size apps from S3 appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to S3 for Indexer Cluster @@ -3120,14 +3120,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from S3") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download ES app file from S3") // Download Technology add-on app from S3 testcaseEnvInst.Log.Info("Download Technology add-on app from S3") taApp := []string{"Splunk_TA_ForIndexers"} appFileListIdxc := testenv.GetAppFileList(taApp) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileListIdxc) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileListIdxc) Expect(err).To(Succeed(), "Unable to download ES app file from S3") // Create directory for file upload to S3 @@ -3235,7 +3235,7 @@ var _ = Describe("c3appfw test", func() { // // Download ES App from S3 // appVersion = "V2" // testcaseEnvInst.Log.Info("Download updated ES app from S3") - // err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) + // err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV2, downloadDirV2, appFileList) // Expect(err).To(Succeed(), "Unable to download ES app") // // Upload V2 ES app to S3 for Search Head Cluster diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index a06b76d00..0b59561ed 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -1525,7 +1525,7 @@ var _ = Describe("c3appfw test", func() { // Download apps from S3 testcaseEnvInst.Log.Info("Download bigger amount of apps from S3 for this test") - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") // Create consolidated list of app files @@ -2299,7 +2299,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to S3 for Cluster Manager @@ -2428,7 +2428,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to S3 for Cluster Manager @@ -2531,7 +2531,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2625,7 +2625,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2838,7 +2838,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to S3 for Indexer Cluster @@ -2955,7 +2955,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3PVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to S3 for Indexer Cluster @@ -3044,7 +3044,7 @@ var _ = Describe("c3appfw test", func() { // Download big size apps from S3 appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to S3 for Indexer Cluster @@ -3268,14 +3268,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from S3") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download ES app file from S3") // Download Technology add-on app from S3 testcaseEnvInst.Log.Info("Download Technology add-on app from S3") taApp := []string{"Splunk_TA_ForIndexers"} appFileListIdxc := testenv.GetAppFileList(taApp) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileListIdxc) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileListIdxc) Expect(err).To(Succeed(), "Unable to download ES app file from S3") // Create directory for file upload to S3 @@ -3383,7 +3383,7 @@ var _ = Describe("c3appfw test", func() { // // Download ES App from S3 // appVersion = "V2" // testcaseEnvInst.Log.Info("Download updated ES app from S3") - // err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) + // err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV2, downloadDirV2, appFileList) // Expect(err).To(Succeed(), "Unable to download ES app") // // Upload V2 ES app to S3 for Search Head Cluster diff --git a/test/appframework_aws/m4/appframework_aws_suite_test.go b/test/appframework_aws/m4/appframework_aws_suite_test.go index ecb5a4ce5..419a76b06 100644 --- a/test/appframework_aws/m4/appframework_aws_suite_test.go +++ b/test/appframework_aws/m4/appframework_aws_suite_test.go @@ -32,9 +32,6 @@ var ( appListV2 []string testDataS3Bucket = os.Getenv("TEST_BUCKET") testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - s3AppDirV1 = testenv.AppLocationV1 - s3AppDirV2 = testenv.AppLocationV2 - s3PVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "m4appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "m4appfwV2-"+testenv.RandomDNSName(4)) @@ -43,7 +40,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) sc, _ := GinkgoConfiguration() @@ -53,44 +49,9 @@ func TestBasic(t *testing.T) { } var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "eks" { - // Create a list of apps to upload to S3 - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to S3 after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupS3AppsSuite(testSuiteName, testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_aws/m4/appframework_aws_test.go b/test/appframework_aws/m4/appframework_aws_test.go index 70e6aacdd..8754480ea 100644 --- a/test/appframework_aws/m4/appframework_aws_test.go +++ b/test/appframework_aws/m4/appframework_aws_test.go @@ -1623,7 +1623,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Cluster Master @@ -1760,7 +1760,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Cluster Master @@ -1864,7 +1864,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -1956,7 +1956,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2355,7 +2355,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to S3 for Indexer Cluster @@ -2471,7 +2471,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3PVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to S3 for Indexer Cluster @@ -2556,7 +2556,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from S3 appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to S3 for Indexer Cluster diff --git a/test/appframework_aws/m4/manager_appframework_test.go b/test/appframework_aws/m4/manager_appframework_test.go index db7026844..c39a27879 100644 --- a/test/appframework_aws/m4/manager_appframework_test.go +++ b/test/appframework_aws/m4/manager_appframework_test.go @@ -1621,7 +1621,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Cluster Manager @@ -1758,7 +1758,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Cluster Manager @@ -1862,7 +1862,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -1954,7 +1954,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to S3 for Indexer Cluster @@ -2353,7 +2353,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to S3 for Indexer Cluster @@ -2469,7 +2469,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3PVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to S3 for Indexer Cluster @@ -2554,7 +2554,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from S3 appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to S3 for Indexer Cluster diff --git a/test/appframework_aws/s1/appframework_aws_suite_test.go b/test/appframework_aws/s1/appframework_aws_suite_test.go index 4de99858c..32bf5f13b 100644 --- a/test/appframework_aws/s1/appframework_aws_suite_test.go +++ b/test/appframework_aws/s1/appframework_aws_suite_test.go @@ -17,6 +17,7 @@ import ( "os" "path/filepath" "testing" + "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -31,9 +32,6 @@ var ( appListV2 []string testDataS3Bucket = os.Getenv("TEST_BUCKET") testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - s3AppDirV1 = testenv.AppLocationV1 - s3AppDirV2 = testenv.AppLocationV2 - s3PVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "s1appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "s1appfwV2-"+testenv.RandomDNSName(4)) @@ -42,47 +40,18 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Running "+testSuiteName) + sc, _ := GinkgoConfiguration() + sc.Timeout = 240 * time.Minute + + RunSpecs(t, "Running "+testSuiteName, sc) } var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "eks" { - // Create a list of apps to upload to S3 - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to S3 after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupS3AppsSuite(testSuiteName, testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_aws/s1/appframework_aws_test.go b/test/appframework_aws/s1/appframework_aws_test.go index 0ab37cf2a..c41e1658b 100644 --- a/test/appframework_aws/s1/appframework_aws_test.go +++ b/test/appframework_aws/s1/appframework_aws_test.go @@ -745,7 +745,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from S3") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") // Upload ES app to S3 @@ -801,7 +801,7 @@ var _ = Describe("s1appfw test", func() { // Download ES App from S3 testcaseEnvInst.Log.Info("Download updated ES app from S3") - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV2, downloadDirV2, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV2, downloadDirV2, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") // Upload V2 apps to S3 for Standalone @@ -856,7 +856,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from S3 testcaseEnvInst.Log.Info("Download bigger amount of apps from S3 for this test") - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -1120,7 +1120,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from S3 testcaseEnvInst.Log.Info("Download the extra apps from S3 for this test") appFileList := testenv.GetAppFileList(testenv.RestartNeededApps) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") // Upload apps to S3 for first Standalone @@ -1250,7 +1250,7 @@ var _ = Describe("s1appfw test", func() { // Download all test apps from S3 appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Standalone @@ -1329,7 +1329,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Standalone @@ -1419,7 +1419,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to S3 for Standalone @@ -1724,7 +1724,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload apps to S3 for Standalone @@ -1816,7 +1816,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3PVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to S3 @@ -1883,7 +1883,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big app") // Upload big-size app to S3 for Standalone diff --git a/test/appframework_az/c3/appframework_azure_suite_test.go b/test/appframework_az/c3/appframework_azure_suite_test.go index 20866fd5d..83875f709 100644 --- a/test/appframework_az/c3/appframework_azure_suite_test.go +++ b/test/appframework_az/c3/appframework_azure_suite_test.go @@ -14,7 +14,6 @@ package azurec3appfw import ( - "context" "os" "path/filepath" "testing" @@ -33,9 +32,6 @@ var ( AzureDataContainer = os.Getenv("TEST_CONTAINER") AzureContainer = os.Getenv("INDEXES_CONTAINER") AzureStorageAccount = os.Getenv("AZURE_STORAGE_ACCOUNT") - AzureAppDirV1 = testenv.AppLocationV1 - AzureAppDirV2 = testenv.AppLocationV2 - AzureAppDirDisabled = testenv.AppLocationDisabledApps currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "c3appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "c3appfwV2-"+testenv.RandomDNSName(4)) @@ -43,49 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - ctx := context.TODO() - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "azure" { - // Create a list of apps to upload to Azure - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from Azure - containerName := "/test-data/appframework/v1apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to Azure after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from Azure - containerName = "/test-data/appframework/v2apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } + testenvInstance, appListV1, appListV2 = testenv.SetupAzureAppsSuite(testSuiteName, downloadDirV1, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index d2d0073e0..f6d28b21c 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -915,7 +915,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from Azure") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app file from Azure") @@ -1036,7 +1036,7 @@ var _ = Describe("c3appfw test", func() { // Download ES App from Azure appVersion = "V2" - containerName = "/" + AzureDataContainer + "/" + AzureAppDirV2 + containerName = "/" + AzureDataContainer + "/" + testenv.AppLocationV2 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") @@ -1542,7 +1542,7 @@ var _ = Describe("c3appfw test", func() { // Download apps from Azure testcaseEnvInst.Log.Info("Download bigger amount of apps from Azure for this test") - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -2320,7 +2320,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2450,7 +2450,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2554,7 +2554,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2649,7 +2649,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2866,7 +2866,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -3069,7 +3069,7 @@ var _ = Describe("c3appfw test", func() { // Download big size apps from Azure appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index f94d8ea7c..30e1c82d0 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -913,7 +913,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from Azure") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app file from Azure") @@ -1034,7 +1034,7 @@ var _ = Describe("c3appfw test", func() { // Download ES App from Azure appVersion = "V2" - containerName = "/" + AzureDataContainer + "/" + AzureAppDirV2 + containerName = "/" + AzureDataContainer + "/" + testenv.AppLocationV2 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") @@ -1542,7 +1542,7 @@ var _ = Describe("c3appfw test", func() { // Download apps from Azure testcaseEnvInst.Log.Info("Download bigger amount of apps from Azure for this test") - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -2320,7 +2320,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2450,7 +2450,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2554,7 +2554,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2649,7 +2649,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2866,7 +2866,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -3069,7 +3069,7 @@ var _ = Describe("c3appfw test", func() { // Download big size apps from Azure appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") diff --git a/test/appframework_az/m4/appframework_azure_suite_test.go b/test/appframework_az/m4/appframework_azure_suite_test.go index 6b6779df2..a416bedc9 100644 --- a/test/appframework_az/m4/appframework_azure_suite_test.go +++ b/test/appframework_az/m4/appframework_azure_suite_test.go @@ -14,7 +14,6 @@ package azurem4appfw import ( - "context" "os" "path/filepath" "testing" @@ -33,9 +32,6 @@ var ( AzureDataContainer = os.Getenv("TEST_CONTAINER") AzureContainer = os.Getenv("INDEXES_CONTAINER") AzureStorageAccount = os.Getenv("AZURE_STORAGE_ACCOUNT") - AzureAppDirV1 = testenv.AppLocationV1 - AzureAppDirV2 = testenv.AppLocationV2 - AzureAppDirDisabled = testenv.AppLocationDisabledApps currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "m4appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "m4appfwV2-"+testenv.RandomDNSName(4)) @@ -43,53 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - ctx := context.TODO() - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "azure" { - // Create a list of apps to upload to Azure - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from Azure - containerName := "/test-data/appframework/v1apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to Azure after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from Azure - containerName = "/test-data/appframework/v2apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } + testenvInstance, appListV1, appListV2 = testenv.SetupAzureAppsSuite(testSuiteName, downloadDirV1, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_az/m4/appframework_azure_test.go b/test/appframework_az/m4/appframework_azure_test.go index 37cab8e92..ce3822ec0 100644 --- a/test/appframework_az/m4/appframework_azure_test.go +++ b/test/appframework_az/m4/appframework_azure_test.go @@ -1597,7 +1597,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1734,7 +1734,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1839,7 +1839,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -1932,7 +1932,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2336,7 +2336,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -2534,7 +2534,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from Azure appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") diff --git a/test/appframework_az/m4/manager_appframework_azure_test.go b/test/appframework_az/m4/manager_appframework_azure_test.go index c6565009b..de2c5db80 100644 --- a/test/appframework_az/m4/manager_appframework_azure_test.go +++ b/test/appframework_az/m4/manager_appframework_azure_test.go @@ -1596,7 +1596,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1734,7 +1734,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1839,7 +1839,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -1932,7 +1932,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") @@ -2336,7 +2336,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -2534,7 +2534,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from Azure appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") diff --git a/test/appframework_az/s1/appframework_azure_suite_test.go b/test/appframework_az/s1/appframework_azure_suite_test.go index 35c28964f..3eff208c0 100644 --- a/test/appframework_az/s1/appframework_azure_suite_test.go +++ b/test/appframework_az/s1/appframework_azure_suite_test.go @@ -14,7 +14,6 @@ package azures1appfw import ( - "context" "os" "path/filepath" "testing" @@ -33,9 +32,6 @@ var ( AzureDataContainer = os.Getenv("TEST_CONTAINER") AzureContainer = os.Getenv("INDEXES_CONTAINER") AzureStorageAccount = os.Getenv("AZURE_STORAGE_ACCOUNT") - AzureAppDirV1 = testenv.AppLocationV1 - AzureAppDirV2 = testenv.AppLocationV2 - AzureAppDirDisabled = testenv.AppLocationDisabledApps currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "s1appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "s1appfwV2-"+testenv.RandomDNSName(4)) @@ -43,49 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - ctx := context.TODO() - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "azure" { - // Create a list of apps to upload to Azure - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from Azure - containerName := "/test-data/appframework/v1apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to Azure after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from Azure - containerName = "/test-data/appframework/v2apps/" - err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } + testenvInstance, appListV1, appListV2 = testenv.SetupAzureAppsSuite(testSuiteName, downloadDirV1, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_az/s1/appframework_azure_test.go b/test/appframework_az/s1/appframework_azure_test.go index f216a79e1..cb084e554 100644 --- a/test/appframework_az/s1/appframework_azure_test.go +++ b/test/appframework_az/s1/appframework_azure_test.go @@ -722,7 +722,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from Azure") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") @@ -776,7 +776,7 @@ var _ = Describe("s1appfw test", func() { azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) // Download ES App from Azure - containerName = "/" + AzureDataContainer + "/" + AzureAppDirV2 + containerName = "/" + AzureDataContainer + "/" + testenv.AppLocationV2 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV2, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") @@ -832,7 +832,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from Azure testcaseEnvInst.Log.Info("Download bigger amount of apps from Azure for this test") - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -1086,7 +1086,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from Azure testcaseEnvInst.Log.Info("Download the extra apps from Azure for this test") appFileList := testenv.GetAppFileList(testenv.RestartNeededApps) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -1217,7 +1217,7 @@ var _ = Describe("s1appfw test", func() { // Download all test apps from Azure appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1297,7 +1297,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1368,7 +1368,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1678,7 +1678,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download apps") @@ -1837,7 +1837,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - containerName := "/" + AzureDataContainer + "/" + AzureAppDirV1 + containerName := "/" + AzureDataContainer + "/" + testenv.AppLocationV1 err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDirV1, containerName, appFileList) Expect(err).To(Succeed(), "Unable to download big app") diff --git a/test/appframework_gcp/c3/appframework_gcs_suite_test.go b/test/appframework_gcp/c3/appframework_gcs_suite_test.go index 1fbf4f108..c73826a7a 100644 --- a/test/appframework_gcp/c3/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_suite_test.go @@ -31,9 +31,6 @@ var ( appListV2 []string testDataGcsBucket = os.Getenv("TEST_BUCKET") testGcsBucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - gcsAppDirV1 = testenv.AppLocationV1 - gcsAppDirV2 = testenv.AppLocationV2 - gcsPVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "c3appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "c3appfwV2-"+testenv.RandomDNSName(4)) @@ -42,51 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "gcp" { - // Create a list of apps to upload to Gcs - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from Gcs - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to Gcs after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from Gcs - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupGCPAppsSuite(testSuiteName, testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files.") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files.") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_gcp/c3/manager_appframework_test.go b/test/appframework_gcp/c3/manager_appframework_test.go index 305fac67b..7d2ceabb7 100644 --- a/test/appframework_gcp/c3/manager_appframework_test.go +++ b/test/appframework_gcp/c3/manager_appframework_test.go @@ -1522,7 +1522,7 @@ var _ = Describe("c3appfw test", func() { // Download apps from Gcs testcaseEnvInst.Log.Info("Download bigger amount of apps from Gcs for this test") - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") // Create consolidated list of app files @@ -2296,7 +2296,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Gcs appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to Gcs for Cluster Manager @@ -2425,7 +2425,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Gcs appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big-size app to Gcs for Cluster Manager @@ -2528,7 +2528,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Gcs appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to Gcs for Indexer Cluster @@ -2622,7 +2622,7 @@ var _ = Describe("c3appfw test", func() { // Download all apps from Gcs appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to Gcs for Indexer Cluster @@ -2835,7 +2835,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to Gcs for Indexer Cluster @@ -2952,7 +2952,7 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsPVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to Gcs for Indexer Cluster @@ -3041,7 +3041,7 @@ var _ = Describe("c3appfw test", func() { // Download big size apps from Gcs appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to Gcs for Indexer Cluster @@ -3265,14 +3265,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from Gcs") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download ES app file from Gcs") // Download Technology add-on app from Gcs testcaseEnvInst.Log.Info("Download Technology add-on app from Gcs") taApp := []string{"Splunk_TA_ForIndexers"} appFileListIdxc := testenv.GetAppFileList(taApp) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileListIdxc) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileListIdxc) Expect(err).To(Succeed(), "Unable to download ES app file from Gcs") // Create directory for file upload to Gcs diff --git a/test/appframework_gcp/m4/appframework_gcs_suite_test.go b/test/appframework_gcp/m4/appframework_gcs_suite_test.go index 08c0d2e42..b2c039d50 100644 --- a/test/appframework_gcp/m4/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_suite_test.go @@ -31,9 +31,6 @@ var ( appListV2 []string testDataGcsBucket = os.Getenv("TEST_BUCKET") testGcsBucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - gcsAppDirV1 = testenv.AppLocationV1 - gcsAppDirV2 = testenv.AppLocationV2 - gcsPVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "m4appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "m4appfwV2-"+testenv.RandomDNSName(4)) @@ -42,52 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "gcp" { - // Create a list of apps to upload to GCP - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from GCP - testenvInstance.Log.Info("logging download details", "bucket", testDataGcsBucket, "gcsAppDirV1", gcsAppDirV1, "downloadDirV1", downloadDirV1, "appFileList", appFileList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to GCP after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from GCP - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupGCPAppsSuite(testSuiteName, testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_gcp/m4/appframework_gcs_test.go b/test/appframework_gcp/m4/appframework_gcs_test.go index f8d231e2c..2985c2242 100644 --- a/test/appframework_gcp/m4/appframework_gcs_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_test.go @@ -1623,7 +1623,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCP for Cluster Master @@ -1760,7 +1760,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCP for Cluster Master @@ -1864,7 +1864,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to GCP for Indexer Cluster @@ -1956,7 +1956,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to GCP for Indexer Cluster @@ -2355,7 +2355,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to GCP for Indexer Cluster @@ -2471,7 +2471,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsPVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to GCP for Indexer Cluster @@ -2556,7 +2556,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from GCP appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to GCP for Indexer Cluster diff --git a/test/appframework_gcp/m4/manager_appframework_test.go b/test/appframework_gcp/m4/manager_appframework_test.go index b89953074..d0abfec1e 100644 --- a/test/appframework_gcp/m4/manager_appframework_test.go +++ b/test/appframework_gcp/m4/manager_appframework_test.go @@ -1622,7 +1622,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCP for Cluster Manager @@ -1758,7 +1758,7 @@ var _ = Describe("m4appfw test", func() { // Download all test apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCP for Cluster Manager @@ -1862,7 +1862,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to GCP for Indexer Cluster @@ -1954,7 +1954,7 @@ var _ = Describe("m4appfw test", func() { // Download all apps from GCP appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload V1 apps to GCP for Indexer Cluster @@ -2353,7 +2353,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload V1 apps to GCP for Indexer Cluster @@ -2469,7 +2469,7 @@ var _ = Describe("m4appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsPVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to GCP for Indexer Cluster @@ -2554,7 +2554,7 @@ var _ = Describe("m4appfw test", func() { // Download big size apps from GCP appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") // Upload big size app to GCP for Indexer Cluster diff --git a/test/appframework_gcp/s1/appframework_gcs_suite_test.go b/test/appframework_gcp/s1/appframework_gcs_suite_test.go index 7e92cf828..90a237aa0 100644 --- a/test/appframework_gcp/s1/appframework_gcs_suite_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_suite_test.go @@ -31,9 +31,6 @@ var ( appListV2 []string testDataGcsBucket = os.Getenv("TEST_BUCKET") testGCSBucket = os.Getenv("TEST_INDEXES_S3_BUCKET") - gcsAppDirV1 = testenv.AppLocationV1 - gcsAppDirV2 = testenv.AppLocationV2 - gcsPVTestApps = testenv.PVTestAppsLocation currDir, _ = os.Getwd() downloadDirV1 = filepath.Join(currDir, "s1appfwV1-"+testenv.RandomDNSName(4)) downloadDirV2 = filepath.Join(currDir, "s1appfwV2-"+testenv.RandomDNSName(4)) @@ -42,47 +39,15 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { - var err error - testenvInstance, err = testenv.NewDefaultTestEnv(testSuiteName) - Expect(err).ToNot(HaveOccurred()) - - if testenv.ClusterProvider == "gcp" { - // Create a list of apps to upload to GCP - appListV1 = testenv.BasicApps - appFileList := testenv.GetAppFileList(appListV1) - - // Download V1 Apps from GCP - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download V1 app files") - - // Create a list of apps to upload to GCP after poll period - appListV2 = append(appListV1, testenv.NewAppsAddedBetweenPolls...) - appFileList = testenv.GetAppFileList(appListV2) - - // Download V2 Apps from GCP - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV2, downloadDirV2, appFileList) - Expect(err).To(Succeed(), "Unable to download V2 app files") - } else { - testenvInstance.Log.Info("Skipping Before Suite Setup", "Cluster Provider", testenv.ClusterProvider) - } - + testenvInstance, appListV1, appListV2 = testenv.SetupGCPAppsSuite(testSuiteName, testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, testenv.AppLocationV2, downloadDirV2) }) var _ = AfterSuite(func() { - if testenvInstance != nil { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) - } - - // Delete locally downloaded app files - err := os.RemoveAll(downloadDirV1) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V1 app files") - err = os.RemoveAll(downloadDirV2) - Expect(err).To(Succeed(), "Unable to delete locally downloaded V2 app files") + testenv.CleanupLocalAppDownloads(testenvInstance, downloadDirV1, downloadDirV2) }) diff --git a/test/appframework_gcp/s1/appframework_gcs_test.go b/test/appframework_gcp/s1/appframework_gcs_test.go index ba252626b..5704e1560 100644 --- a/test/appframework_gcp/s1/appframework_gcs_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_test.go @@ -745,7 +745,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Download ES app from gcs") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") // Upload ES app to gcs @@ -801,7 +801,7 @@ var _ = Describe("s1appfw test", func() { // Download ES App from gcs testcaseEnvInst.Log.Info("Download updated ES app from gcs") - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV2, downloadDirV2, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV2, downloadDirV2, appFileList) Expect(err).To(Succeed(), "Unable to download ES app") // Upload V2 apps to gcs for Standalone @@ -856,7 +856,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from gcs testcaseEnvInst.Log.Info("Download bigger amount of apps from gcs for this test") - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -1108,7 +1108,7 @@ var _ = Describe("s1appfw test", func() { // Download apps from GCS testcaseEnvInst.Log.Info("Download the extra apps from GCS for this test") appFileList := testenv.GetAppFileList(testenv.RestartNeededApps) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") // Upload apps to GCS for first Standalone @@ -1238,7 +1238,7 @@ var _ = Describe("s1appfw test", func() { // Download all test apps from GCS appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCS for Standalone @@ -1317,7 +1317,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCS for Standalone @@ -1407,7 +1407,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload big-size app to GCS for Standalone @@ -1712,7 +1712,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") // Upload apps to GCS for Standalone @@ -1804,7 +1804,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := testenv.PVTestApps appFileList := testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsPVTestApps, downloadDirPVTestApps, appFileList) + err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") // Upload apps to GCS @@ -1871,7 +1871,7 @@ var _ = Describe("s1appfw test", func() { appVersion := "V1" appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) - err := testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV1, downloadDirV1, appFileList) + err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big app") // Upload big-size app to GCS for Standalone diff --git a/test/custom_resource_crud/custom_resource_crud_suite_test.go b/test/custom_resource_crud/custom_resource_crud_suite_test.go index a3629752f..e97331116 100644 --- a/test/custom_resource_crud/custom_resource_crud_suite_test.go +++ b/test/custom_resource_crud/custom_resource_crud_suite_test.go @@ -39,7 +39,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/delete_cr/deletecr_suite_test.go b/test/delete_cr/deletecr_suite_test.go index a8e834e9e..c7d161a56 100644 --- a/test/delete_cr/deletecr_suite_test.go +++ b/test/delete_cr/deletecr_suite_test.go @@ -1,11 +1,10 @@ // Copyright (c) 2018-2022 Splunk Inc. All rights reserved. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -31,7 +30,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/example/example_suite_test.go b/test/example/example_suite_test.go index 78f198f31..183ff9af1 100644 --- a/test/example/example_suite_test.go +++ b/test/example/example_suite_test.go @@ -14,9 +14,7 @@ package example import ( - "math/rand" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -29,12 +27,7 @@ var ( testSuiteName = "example-" + testenv.RandomDNSName(3) ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - func TestExampleSuite(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) @@ -47,5 +40,7 @@ var _ = BeforeSuite(func() { }) var _ = AfterSuite(func() { - Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) + if testenvInstance != nil { + Expect(testenvInstance.Teardown()).ToNot(HaveOccurred()) + } }) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go index 8907de94c..4a49795c6 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go @@ -90,7 +90,6 @@ var ( appSourceVolumeName = "appframework-test-volume-" + testenv.RandomDNSName(3) s3TestDir = "icappfw-" + testenv.RandomDNSName(4) appListV1 = testenv.BasicApps - s3AppDirV1 = testenv.AppLocationV1 ) // TestBasic is the main entry point @@ -109,7 +108,7 @@ var _ = BeforeSuite(func() { appFileList := testenv.GetAppFileList(appListV1) // Download V1 Apps from S3 - err = testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download V1 app files") }) diff --git a/test/ingest_search/ingest_search_suite_test.go b/test/ingest_search/ingest_search_suite_test.go index 971345cb3..eb4132142 100644 --- a/test/ingest_search/ingest_search_suite_test.go +++ b/test/ingest_search/ingest_search_suite_test.go @@ -29,7 +29,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index d0f92faa5..021b82d52 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -20,13 +20,12 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" + corev1 "k8s.io/api/core/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/splunk/splunk-operator/test/testenv" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" ) var _ = Describe("Monitoring Console test", func() { @@ -144,154 +143,7 @@ var _ = Describe("Monitoring Console test", func() { Context("Standalone deployment (S1)", func() { It("managermc1, integration: can deploy a MC with standalone instance and update MC with new standalone deployment", func() { - /* - Test Steps - 1. Deploy Standalone - 2. Wait for Standalone to go to READY - 3. Deploy Monitoring Console - 4. Wait for Monitoring Console status to be READY - 5. Verify Standalone configured in Monitoring Console Config Map - 6. Verify Monitoring Console Pod has correct peers in Peer List - 7. Deploy 2nd Standalone - 8. Wait for Second Standalone to be READY - 9. Wait for Monitoring Console status to go UPDATING then READY - 10. Verify both Standalone configured in Monitoring Console Config Map - 11. Verify both Standalone configured in Monitoring Console Pod Peers String - 12. Delete 2nd Standalone - 13. Wait for Monitoring Console to go to UPDATING then READY - 14. Verify only first Standalone configured in Monitoring Console Config Map - 15. Verify only first Standalone configured in Monitoring Console Pod Peers String - */ - - standaloneOneName := deployment.GetName() - mcName := deployment.GetName() - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standaloneOne) - - // Deploy MC and wait for MC to be READY - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // Check Standalone is configure in MC Config Map - standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - // Add another standalone instance in namespace - testcaseEnvInst.Log.Info("Adding second standalone deployment to namespace") - // CSPL-901 standaloneTwoName := deployment.GetName() + "-two" - standaloneTwoName := "standalone-" + testenv.RandomDNSName(3) - // Configure Resources on second standalone CSPL-555 - standaloneTwoSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - "cpu": resource.MustParse("2"), - "memory": resource.MustParse("4Gi"), - }, - Requests: corev1.ResourceList{ - "cpu": resource.MustParse("0.2"), - "memory": resource.MustParse("256Mi"), - }, - }, - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standaloneTwo, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneTwoName, standaloneTwoSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for standalone two to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneTwoName, standaloneTwo) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Wait for MC to go to Updating Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Vrify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Standalone is configure in MC Config Map - standalonePods = append(standalonePods, fmt.Sprintf(testenv.StandalonePod, standaloneTwoName, 0)) - - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Delete Standlone TWO of the standalone and ensure MC is updated - testcaseEnvInst.Log.Info("Deleting second standalone deployment to namespace", "Standalone Name", standaloneTwoName) - deployment.GetInstance(ctx, standaloneTwoName, standaloneTwo) - err = deployment.DeleteCR(ctx, standaloneTwo) - Expect(err).To(Succeed(), "Unable to delete standalone instance", "Standalone Name", standaloneTwo) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Wait for MC to go to Updating Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Standalone is configure in MC Config Map - standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone One Pod in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check Standalone One Pod in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // Check Standalone TWO NOT configured in MC Config Map - standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneTwoName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone Two Pod NOT in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, false) - - // Check Standalone Pod TWO NOT configured MC Peer List - testcaseEnvInst.Log.Info("Check Standalone Two Pod NOT in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, false, false) - + RunS1StandaloneAddDeleteMCTest(ctx, deployment, testcaseEnvInst, deployment.GetName(), "standalone-"+testenv.RandomDNSName(3)) }) }) @@ -898,144 +750,7 @@ var _ = Describe("Monitoring Console test", func() { Context("Standalone deployment (S1)", func() { It("managermc2, integration: can deploy a MC with standalone instance and update MC with new standalone deployment of similar names", func() { - /* - Test Steps - 1. Deploy Standalone with name "search-head-adhoc" - 2. Wait for Standalone to go to READY - 3. Deploy Monitoring Console - 4. Wait for Monitoring Console status to be READY - 5. Verify Standalone configured in Monitoring Console Config Map - 6. Verify Monitoring Console Pod has correct peers in Peer List - 7. Deploy 2nd Standalone with name "search-head" - 8. Wait for Second Standalone to be READY - 9. Wait for Monitoring Console status to go UPDATING then READY - 10. Verify both Standalone configured in Monitoring Console Config Map - 11. Verify both Standalone configured in Monitoring Console Pod Peers String - 12. Delete 2nd Standalone - 13. Wait for Monitoring Console to go to UPDATING then READY - 14. Verify only first Standalone configured in Monitoring Console Config Map - 15. Verify only first Standalone configured in Monitoring Console Pod Peers String - */ - - standaloneOneName := "search-head-adhoc" - mcName := deployment.GetName() - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for standaloneOne to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneOneName, standaloneOne) - - // Deploy MC and wait for MC to be READY - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // Check standaloneOne is configured in MC Config Map - standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check standaloneOne Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Add another standalone instance in namespace - testcaseEnvInst.Log.Info("Adding second standalone deployment to namespace") - standaloneTwoName := "search-head" - // Configure Resources on second standalone CSPL-555 - standaloneTwoSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - Resources: corev1.ResourceRequirements{ - Limits: corev1.ResourceList{ - "cpu": resource.MustParse("2"), - "memory": resource.MustParse("4Gi"), - }, - Requests: corev1.ResourceList{ - "cpu": resource.MustParse("0.2"), - "memory": resource.MustParse("256Mi"), - }, - }, - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } - standaloneTwo, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneTwoName, standaloneTwoSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - // Wait for standalone two to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneTwoName, standaloneTwo) - - // wait for custom resource(CR) resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Vrify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check standaloneTwo is configure in MC Config Map - standalonePods = append(standalonePods, fmt.Sprintf(testenv.StandalonePod, standaloneTwoName, 0)) - - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check standaloneTwo Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Delete standaloneTwo and ensure MC is updated - testcaseEnvInst.Log.Info("Deleting second standalone deployment to namespace", "Standalone Name", standaloneTwoName) - deployment.GetInstance(ctx, standaloneTwoName, standaloneTwo) - err = deployment.DeleteCR(ctx, standaloneTwo) - Expect(err).To(Succeed(), "Unable to delete standalone instance", "Standalone Name", standaloneTwo) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Standalone is configure in MC Config Map - standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone One Pod in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check Standalone One Pod in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) - - // Check Standalone TWO NOT configured in MC Config Map - standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneTwoName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone Two Pod NOT in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, false) - - // Check Standalone Pod TWO NOT configured MC Peer List - testcaseEnvInst.Log.Info("Check Standalone Two Pod NOT in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, false, false) - + RunS1StandaloneAddDeleteMCTest(ctx, deployment, testcaseEnvInst, "search-head-adhoc", "search-head") }) }) diff --git a/test/monitoring_console/monitoring_console_suite_test.go b/test/monitoring_console/monitoring_console_suite_test.go index 5fab3715b..8d8cdb992 100644 --- a/test/monitoring_console/monitoring_console_suite_test.go +++ b/test/monitoring_console/monitoring_console_suite_test.go @@ -1,11 +1,10 @@ // Copyright (c) 2018-2022 Splunk Inc. All rights reserved. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -32,7 +31,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) sc, _ := GinkgoConfiguration() diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go new file mode 100644 index 000000000..e937f9c00 --- /dev/null +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -0,0 +1,149 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package monitoringconsoletest + +import ( + "context" + "fmt" + + . "github.com/onsi/gomega" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) + +// RunS1StandaloneAddDeleteMCTest deploys two standalone instances with a Monitoring Console, +// verifies both are registered, then deletes the second standalone and verifies the MC +// config map and peer list are updated correctly. +func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, standaloneOneName, standaloneTwoName string) { + mcName := deployment.GetName() + + // Deploy standalone one with MCRef + spec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: testcaseEnvInst.GetSplunkImage(), + }, + Volumes: []corev1.Volume{}, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } + standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance") + + // Wait for standalone to be in READY Status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneOneName, standaloneOne) + + // Deploy MC and wait for MC to be READY + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") + + // Check Standalone is configured in MC Config Map + standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) + + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) + + // Check Standalone Pod in MC Peer List + testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + + // get revision number of the resource + resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Add another standalone instance in namespace + testcaseEnvInst.Log.Info("Adding second standalone deployment to namespace") + standaloneTwoSpec := enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: testcaseEnvInst.GetSplunkImage(), + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + "cpu": resource.MustParse("2"), + "memory": resource.MustParse("4Gi"), + }, + Requests: corev1.ResourceList{ + "cpu": resource.MustParse("0.2"), + "memory": resource.MustParse("256Mi"), + }, + }, + }, + Volumes: []corev1.Volume{}, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } + standaloneTwo, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneTwoName, standaloneTwoSpec) + Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + + // Wait for standalone two to be in READY status + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneTwoName, standaloneTwo) + + // wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify MC is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Check both standalones are configured in MC Config Map + standalonePods = append(standalonePods, fmt.Sprintf(testenv.StandalonePod, standaloneTwoName, 0)) + + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map after adding new standalone") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) + + // Check Standalone Pod in MC Peer List + testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list after adding new standalone") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + + // get revision number of the resource + resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Delete standalone two and ensure MC is updated + testcaseEnvInst.Log.Info("Deleting second standalone deployment to namespace", "Standalone Name", standaloneTwoName) + deployment.GetInstance(ctx, standaloneTwoName, standaloneTwo) + err = deployment.DeleteCR(ctx, standaloneTwo) + Expect(err).To(Succeed(), "Unable to delete standalone instance", "Standalone Name", standaloneTwo) + + // wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Verify MC is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Check standalone one is still configured in MC Config Map + standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) + + testcaseEnvInst.Log.Info("Checking for Standalone One Pod in MC Config Map after deleting second standalone") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) + + // Check Standalone Pod in MC Peer List + testcaseEnvInst.Log.Info("Check Standalone One Pod in MC Peer list after deleting second standalone") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + + // Check Standalone Two NOT configured in MC Config Map + standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneTwoName, 1, false, 0) + + testcaseEnvInst.Log.Info("Checking for Standalone Two Pod NOT in MC Config Map after deleting second standalone") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, false) + + // Check Standalone Pod TWO NOT configured in MC Peer List + testcaseEnvInst.Log.Info("Check Standalone Two Pod NOT in MC Peer list after deleting second standalone") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, false, false) +} diff --git a/test/secret/secret_suite_test.go b/test/secret/secret_suite_test.go index bfc9522cf..f12d3ed96 100644 --- a/test/secret/secret_suite_test.go +++ b/test/secret/secret_suite_test.go @@ -29,7 +29,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index 7da996731..1b2147c41 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -58,6 +58,42 @@ func NewSecretTestConfigV4() *SecretTestConfig { } } +// verifySecretsPropagated checks that the given secret data has been propagated to all +// versioned secret objects, pods, server config, input config, and via the API. +func verifySecretsPropagated(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, secretData map[string][]byte, updated bool) { + // Once Pods are READY check each versioned secret for updated secret keys + secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) + + // Verify Secrets on versioned secret objects + testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretData, updated) + + // Once Pods are READY check each pod for updated secret keys + verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) + + // Verify secrets on pods + testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretData, updated) + + // Verify Secrets on ServerConf on Pod + testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretData, updated) + + // Verify Hec token on InputConf on Pod + testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretData, updated) + + // Verify Secrets via api access on Pod + testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretData, updated) +} + +// generateAndApplySecretUpdate creates randomized secret data and applies it to the namespace-scoped +// secret object, returning the updated data map for subsequent verification. +func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, namespaceScopedSecretName string) map[string][]byte { + modifiedHecToken := testenv.GetRandomeHECToken() + modifiedValue := testenv.RandomDNSName(10) + updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) + err := testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) + Expect(err).To(Succeed(), "Unable to update secret Object") + return updatedSecretData +} + // RunS1SecretUpdateTest runs the standard S1 secret update test workflow func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { // Download License File and create config map @@ -93,11 +129,7 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Unable to get secret struct") // Update Secret Value on Secret Object - modifiedHecToken := testenv.GetRandomeHECToken() - modifiedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") + updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) // Ensure standalone is updating testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) @@ -114,26 +146,7 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } // RunS1SecretDeleteTest runs the standard S1 secret delete test workflow @@ -189,26 +202,7 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretStruct.Data, false) } // RunS1SecretDeleteWithMCRefTest runs the S1 secret delete test with MC reference workflow @@ -266,26 +260,7 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, secretStruct.Data, false) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets on ServerConf on Pod - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, secretStruct.Data, false) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, secretStruct.Data, false) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretStruct.Data, false) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretStruct.Data, false) } // RunC3SecretUpdateTest runs the standard C3 secret update test workflow @@ -330,12 +305,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Unable to get secret struct") // Update Secret Value on Secret Object - modifiedHecToken := testenv.GetRandomeHECToken() - modifiedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") + updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) // Ensure that Cluster Manager goes to update phase if config.APIVersion == "v3" { @@ -375,26 +345,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst.Log.Info("Checkin RF SF after secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each pod for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } // RunM4SecretUpdateTest runs the standard M4 secret update test workflow @@ -444,12 +395,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Unable to get secret struct") // Update Secret Value on Secret Object - modifiedHecToken := testenv.GetRandomeHECToken() - modifiedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) - - err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") + updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) // Ensure that Cluster Manager goes to update phase if config.APIVersion == "v3" { @@ -480,24 +426,5 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst.Log.Info("Checkin RF SF after secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // Once Pods are READY check each versioned secret for updated secret keys - secretObjectNames := testenv.GetVersionedSecretNames(testcaseEnvInst.GetName(), 2) - - // Verify Secrets on versioned secret objects - testcaseEnvInst.VerifySecretsOnSecretObjects(ctx, deployment, secretObjectNames, updatedSecretData, true) - - // Once Pods are READY check each versioned secret for updated secret keys - verificationPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - - // Verify secrets on pods - testcaseEnvInst.VerifySecretsOnPods(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Pass4SymmKey Secrets on ServerConf on MC, LM Pods - testcaseEnvInst.VerifySplunkServerConfSecrets(ctx, deployment, verificationPods, updatedSecretData, true) - - // Verify Hec token on InputConf on Pod - testcaseEnvInst.VerifySplunkInputConfSecrets(deployment, verificationPods, updatedSecretData, true) - - // Verify Secrets via api access on Pod - testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, updatedSecretData, true) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } diff --git a/test/smartstore/smartstore_suite_test.go b/test/smartstore/smartstore_suite_test.go index beededf6a..112ce28c8 100644 --- a/test/smartstore/smartstore_suite_test.go +++ b/test/smartstore/smartstore_suite_test.go @@ -1,3 +1,16 @@ +// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package smartstore import ( @@ -16,7 +29,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/smoke/smoke_suite_test.go b/test/smoke/smoke_suite_test.go index 3bdf0f80e..de4c35a89 100644 --- a/test/smoke/smoke_suite_test.go +++ b/test/smoke/smoke_suite_test.go @@ -29,7 +29,6 @@ var ( // TestBasic is the main entry point func TestBasic(t *testing.T) { - RegisterFailHandler(Fail) RunSpecs(t, "Running "+testSuiteName) diff --git a/test/testenv/test_setup_helpers.go b/test/testenv/test_setup_helpers.go index bd49dba2b..4d3685ee5 100644 --- a/test/testenv/test_setup_helpers.go +++ b/test/testenv/test_setup_helpers.go @@ -17,8 +17,10 @@ package testenv import ( "context" "fmt" + "os" "path/filepath" + "github.com/joho/godotenv" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" @@ -79,6 +81,122 @@ func TeardownAppFrameworkTestCaseEnv(ctx context.Context, testcaseEnvInst *TestC CleanupOperatorFile(ctx, deployment, testcaseEnvInst, filePresentOnOperator) } +// LoadEnvFile traverses up the directory tree from the current working directory +// to find and load a .env file using godotenv. Returns nil if no .env file is found. +func LoadEnvFile() error { + dir, err := os.Getwd() + if err != nil { + return err + } + + for { + envFile := filepath.Join(dir, ".env") + if _, err := os.Stat(envFile); err == nil { + return godotenv.Load(envFile) + } + + parentDir := filepath.Dir(dir) + if parentDir == dir { + return nil + } + dir = parentDir + } +} + +// SetupS3AppsSuite initialises the test environment and, when running on EKS, +// downloads the V1 and V2 app sets from S3. +func SetupS3AppsSuite(suiteName, testDataBucket, appDirV1, downloadDirV1, appDirV2, downloadDirV2 string) (*TestEnv, []string, []string) { + testenvInst, err := NewDefaultTestEnv(suiteName) + Expect(err).ToNot(HaveOccurred()) + + if ClusterProvider == "eks" { + appListV1 := BasicApps + appFileList := GetAppFileList(appListV1) + + err = DownloadFilesFromS3(testDataBucket, appDirV1, downloadDirV1, appFileList) + Expect(err).To(Succeed(), "Unable to download V1 app files") + + appListV2 := append(appListV1, NewAppsAddedBetweenPolls...) + appFileList = GetAppFileList(appListV2) + + err = DownloadFilesFromS3(testDataBucket, appDirV2, downloadDirV2, appFileList) + Expect(err).To(Succeed(), "Unable to download V2 app files") + + return testenvInst, appListV1, appListV2 + } + + testenvInst.Log.Info("Skipping Before Suite Setup", "provider", ClusterProvider) + return testenvInst, nil, nil +} + +// CleanupLocalAppDownloads tears down the test environment and removes locally +// downloaded app directories after a suite run. +func CleanupLocalAppDownloads(testenvInst *TestEnv, dirs ...string) { + if testenvInst != nil { + Expect(testenvInst.Teardown()).ToNot(HaveOccurred()) + } + for _, dir := range dirs { + Expect(os.RemoveAll(dir)).To(Succeed(), "Unable to delete locally downloaded app files from "+dir) + } +} + +// SetupAzureAppsSuite initialises the test environment and, when running on Azure, +// downloads the V1 and V2 app sets from Azure Blob. +func SetupAzureAppsSuite(suiteName, downloadDirV1, downloadDirV2 string) (*TestEnv, []string, []string) { + testenvInst, err := NewDefaultTestEnv(suiteName) + Expect(err).ToNot(HaveOccurred()) + + if ClusterProvider == "azure" { + ctx := context.TODO() + + appListV1 := BasicApps + appFileList := GetAppFileList(appListV1) + + containerName := "/test-data/appframework/v1apps/" + err = DownloadFilesFromAzure(ctx, GetAzureEndpoint(ctx), StorageAccountKey, StorageAccount, downloadDirV1, containerName, appFileList) + Expect(err).To(Succeed(), "Unable to download V1 app files") + + appListV2 := append(appListV1, NewAppsAddedBetweenPolls...) + appFileList = GetAppFileList(appListV2) + + containerName = "/test-data/appframework/v2apps/" + err = DownloadFilesFromAzure(ctx, GetAzureEndpoint(ctx), StorageAccountKey, StorageAccount, downloadDirV2, containerName, appFileList) + Expect(err).To(Succeed(), "Unable to download V2 app files") + + return testenvInst, appListV1, appListV2 + } + + testenvInst.Log.Info("Skipping Before Suite Setup", "provider", ClusterProvider) + return testenvInst, nil, nil +} + +// SetupGCPAppsSuite initialises the test environment and, when running on GCP, +// downloads the V1 and V2 app sets from GCS. +func SetupGCPAppsSuite(suiteName, testDataBucket, appDirV1, downloadDirV1, appDirV2, downloadDirV2 string) (*TestEnv, []string, []string) { + testenvInst, err := NewDefaultTestEnv(suiteName) + Expect(err).ToNot(HaveOccurred()) + + if ClusterProvider == "gcp" { + appListV1 := BasicApps + appFileList := GetAppFileList(appListV1) + + testenvInst.Log.Info("logging download details", "bucket", testDataBucket, "appDirV1", appDirV1, "downloadDirV1", downloadDirV1, "appFileList", appFileList) + err = DownloadFilesFromGCP(testDataBucket, appDirV1, downloadDirV1, appFileList) + Expect(err).To(Succeed(), "Unable to download V1 app files") + + appListV2 := append(appListV1, NewAppsAddedBetweenPolls...) + appFileList = GetAppFileList(appListV2) + + err = DownloadFilesFromGCP(testDataBucket, appDirV2, downloadDirV2, appFileList) + Expect(err).To(Succeed(), "Unable to download V2 app files") + + return testenvInst, appListV1, appListV2 + } + + testenvInst.Log.Info("Skipping Before Suite Setup", "provider", ClusterProvider) + return testenvInst, nil, nil +} + // SetupLicenseConfigMap downloads the license file from the appropriate cloud provider // and creates a license config map. func SetupLicenseConfigMap(ctx context.Context, testcaseEnvInst *TestCaseEnv) { From 4c9f8e9429e8e6de6bb7f396d19218cac6254b36 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Tue, 24 Mar 2026 10:40:53 +0100 Subject: [PATCH 13/20] CSPL-3775 Remove unused functions --- .../c3/appframework_aws_test.go | 184 ++--------- .../c3/manager_appframework_test.go | 178 ++-------- test/appframework_aws/c3/test_helpers_test.go | 33 ++ .../m4/appframework_aws_test.go | 162 ++-------- .../m4/manager_appframework_test.go | 156 ++------- test/appframework_aws/m4/test_helpers_test.go | 33 ++ .../c3/appframework_azure_test.go | 184 ++--------- .../c3/manager_appframework_azure_test.go | 184 ++--------- test/appframework_az/c3/test_helpers_test.go | 33 ++ .../m4/appframework_azure_test.go | 177 ++-------- .../m4/manager_appframework_azure_test.go | 177 ++-------- test/appframework_az/m4/test_helpers_test.go | 40 +++ .../c3/appframework_gcs_test.go | 64 +--- test/appframework_gcp/c3/test_helpers_test.go | 33 ++ .../m4/appframework_gcs_test.go | 162 ++-------- test/appframework_gcp/m4/test_helpers_test.go | 33 ++ test/custom_resource_crud/crud_test_shared.go | 13 +- test/licensemanager/lm_test_shared.go | 19 +- .../manager_monitoring_console_test.go | 26 +- .../monitoring_console_test.go | 29 +- .../monitoring_console_test_shared.go | 12 +- test/secret/secret_test_shared.go | 91 ++---- test/smartstore/smartstore_test_shared.go | 14 +- test/testenv/cmutil.go | 15 - test/testenv/common_test_patterns.go | 54 ++-- test/testenv/cr_update_helpers.go | 49 --- test/testenv/deployment_scenarios.go | 306 ------------------ test/testenv/mcutil.go | 12 - test/testenv/remote_index_utils.go | 13 - test/testenv/s3utils.go | 5 - test/testenv/search_head_cluster_utils.go | 28 -- test/testenv/test_workflows.go | 97 ------ test/testenv/testcaseenv.go | 5 - test/testenv/util.go | 22 -- test/testenv/verificationutils.go | 18 -- 35 files changed, 510 insertions(+), 2151 deletions(-) create mode 100644 test/appframework_aws/c3/test_helpers_test.go create mode 100644 test/appframework_aws/m4/test_helpers_test.go create mode 100644 test/appframework_az/c3/test_helpers_test.go create mode 100644 test/appframework_az/m4/test_helpers_test.go create mode 100644 test/appframework_gcp/c3/test_helpers_test.go create mode 100644 test/appframework_gcp/m4/test_helpers_test.go delete mode 100644 test/testenv/deployment_scenarios.go diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 1634b050f..6381ffeca 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -165,20 +165,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -246,19 +238,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -386,20 +371,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -455,19 +432,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -565,11 +535,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -841,11 +807,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -890,11 +852,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1030,11 +988,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1094,11 +1048,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1237,11 +1187,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1317,11 +1263,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1415,11 +1357,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1542,11 +1480,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1604,11 +1538,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1754,11 +1684,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1803,11 +1729,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1979,11 +1901,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2055,11 +1973,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2336,11 +2250,7 @@ var _ = Describe("c3appfw test", func() { // Wait for polling interval to pass testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify all apps are installed on indexers appList = append(testenv.BigSingleApp, testenv.ExtraApps...) @@ -2425,11 +2335,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2519,11 +2425,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2604,11 +2506,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2754,11 +2652,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2848,11 +2742,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2941,11 +2831,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3025,11 +2911,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3206,11 +3088,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index 0b59561ed..384cf61ec 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -162,20 +162,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -243,19 +235,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -526,20 +511,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -595,19 +572,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -705,11 +675,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -989,11 +955,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1038,11 +1000,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1178,11 +1136,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1242,11 +1196,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1385,11 +1335,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1465,11 +1411,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1563,11 +1505,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1690,11 +1628,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1752,11 +1686,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1902,11 +1832,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1951,11 +1877,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2127,11 +2049,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2203,11 +2121,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2573,11 +2487,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2667,11 +2577,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2752,11 +2658,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2902,11 +2804,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2996,11 +2894,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3089,11 +2983,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3173,11 +3063,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3354,11 +3240,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/c3/test_helpers_test.go b/test/appframework_aws/c3/test_helpers_test.go new file mode 100644 index 000000000..379908bce --- /dev/null +++ b/test/appframework_aws/c3/test_helpers_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package c3appfw + +import ( + "context" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. +func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. +func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) +} diff --git a/test/appframework_aws/m4/appframework_aws_test.go b/test/appframework_aws/m4/appframework_aws_test.go index 8754480ea..45c71f82c 100644 --- a/test/appframework_aws/m4/appframework_aws_test.go +++ b/test/appframework_aws/m4/appframework_aws_test.go @@ -164,14 +164,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -245,14 +238,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -380,14 +366,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -447,14 +426,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -557,14 +529,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -823,11 +788,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -872,11 +833,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -992,14 +949,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1054,14 +1004,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1217,11 +1160,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1266,11 +1205,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1448,14 +1383,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1528,14 +1456,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1903,14 +1824,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1995,14 +1909,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2079,14 +1986,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2197,11 +2097,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2512,11 +2408,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2598,14 +2490,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2681,14 +2566,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/m4/manager_appframework_test.go b/test/appframework_aws/m4/manager_appframework_test.go index c39a27879..789f9a887 100644 --- a/test/appframework_aws/m4/manager_appframework_test.go +++ b/test/appframework_aws/m4/manager_appframework_test.go @@ -163,14 +163,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -244,14 +237,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -379,14 +365,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -446,14 +425,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -556,14 +528,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -822,11 +787,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -871,11 +832,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -991,14 +948,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1053,14 +1003,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1215,11 +1158,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1264,11 +1203,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1446,14 +1381,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1526,14 +1454,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1901,14 +1822,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1993,14 +1907,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2077,14 +1984,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2195,11 +2095,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2596,14 +2492,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2679,14 +2568,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/m4/test_helpers_test.go b/test/appframework_aws/m4/test_helpers_test.go new file mode 100644 index 000000000..40cf1603a --- /dev/null +++ b/test/appframework_aws/m4/test_helpers_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package m4appfw + +import ( + "context" + + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. +func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} + +// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). +func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index f6d28b21c..98459a8c4 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -163,20 +163,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -237,19 +229,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -377,20 +362,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -447,19 +424,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -557,11 +527,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -815,11 +781,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -865,11 +827,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1002,11 +960,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1052,11 +1006,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1186,11 +1136,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1267,11 +1213,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1413,11 +1355,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1482,11 +1420,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1581,11 +1515,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1708,11 +1638,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1771,11 +1697,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1921,11 +1843,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1971,11 +1889,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2147,11 +2061,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2224,11 +2134,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2597,11 +2503,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2692,11 +2594,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2778,11 +2676,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2931,11 +2825,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3021,11 +2911,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3115,11 +3001,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3199,11 +3081,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index 30e1c82d0..533bc20dc 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -161,20 +161,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -235,19 +227,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -375,20 +360,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -445,19 +422,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -555,11 +525,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -813,11 +779,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -863,11 +825,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1000,11 +958,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1050,11 +1004,7 @@ var _ = Describe("c3appfw test", func() { // // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1185,11 +1135,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1266,11 +1212,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1412,11 +1354,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1482,11 +1420,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1581,11 +1515,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1708,11 +1638,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1771,11 +1697,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1921,11 +1843,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1971,11 +1889,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2147,11 +2061,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2224,11 +2134,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2597,11 +2503,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2692,11 +2594,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2778,11 +2676,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2931,11 +2825,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3021,11 +2911,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3115,11 +3001,7 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3199,11 +3081,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/c3/test_helpers_test.go b/test/appframework_az/c3/test_helpers_test.go new file mode 100644 index 000000000..f1d418225 --- /dev/null +++ b/test/appframework_az/c3/test_helpers_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package azurec3appfw + +import ( + "context" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. +func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. +func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) +} diff --git a/test/appframework_az/m4/appframework_azure_test.go b/test/appframework_az/m4/appframework_azure_test.go index ce3822ec0..1a5afe208 100644 --- a/test/appframework_az/m4/appframework_azure_test.go +++ b/test/appframework_az/m4/appframework_azure_test.go @@ -164,23 +164,12 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -234,14 +223,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -369,14 +351,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -437,14 +412,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -547,14 +515,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -795,11 +756,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -845,11 +802,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -965,14 +918,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1027,14 +973,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1189,11 +1128,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1239,11 +1174,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1421,14 +1352,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1502,14 +1426,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1879,14 +1796,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1972,14 +1882,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2057,14 +1960,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2177,11 +2073,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2398,14 +2290,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2490,11 +2375,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2577,14 +2458,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2660,14 +2534,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/m4/manager_appframework_azure_test.go b/test/appframework_az/m4/manager_appframework_azure_test.go index de2c5db80..405fb820e 100644 --- a/test/appframework_az/m4/manager_appframework_azure_test.go +++ b/test/appframework_az/m4/manager_appframework_azure_test.go @@ -163,23 +163,12 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -233,14 +222,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -368,14 +350,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -436,14 +411,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -546,14 +514,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -794,11 +755,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -844,11 +801,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -964,14 +917,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1026,14 +972,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1188,11 +1127,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1238,11 +1173,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1420,14 +1351,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1501,14 +1425,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1879,14 +1796,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1972,14 +1882,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2057,14 +1960,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2177,11 +2073,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2398,14 +2290,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2490,11 +2375,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2577,14 +2458,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2660,14 +2534,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/m4/test_helpers_test.go b/test/appframework_az/m4/test_helpers_test.go new file mode 100644 index 000000000..9e23a067c --- /dev/null +++ b/test/appframework_az/m4/test_helpers_test.go @@ -0,0 +1,40 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package azurem4appfw + +import ( + "context" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. +func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} + +// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). +func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} + +// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. +func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) +} diff --git a/test/appframework_gcp/c3/appframework_gcs_test.go b/test/appframework_gcp/c3/appframework_gcs_test.go index 6756e5826..e49b34bd9 100644 --- a/test/appframework_gcp/c3/appframework_gcs_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_test.go @@ -165,20 +165,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -246,19 +238,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -386,20 +371,12 @@ var _ = Describe("c3appfw test", func() { // Ensure Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -455,19 +432,12 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -553,11 +523,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -602,11 +568,7 @@ var _ = Describe("c3appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -684,11 +646,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_gcp/c3/test_helpers_test.go b/test/appframework_gcp/c3/test_helpers_test.go new file mode 100644 index 000000000..ea19a251d --- /dev/null +++ b/test/appframework_gcp/c3/test_helpers_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package c3gcpappfw + +import ( + "context" + + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. +func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. +func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) +} diff --git a/test/appframework_gcp/m4/appframework_gcs_test.go b/test/appframework_gcp/m4/appframework_gcs_test.go index 2985c2242..26ccdaed3 100644 --- a/test/appframework_gcp/m4/appframework_gcs_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_test.go @@ -164,14 +164,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -245,14 +238,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -380,14 +366,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -447,14 +426,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -557,14 +529,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -823,11 +788,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -872,11 +833,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -992,14 +949,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1054,14 +1004,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1217,11 +1160,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1266,11 +1205,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1448,14 +1383,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1528,14 +1456,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1903,14 +1824,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1995,14 +1909,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2079,14 +1986,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2197,11 +2097,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2512,11 +2408,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2598,14 +2490,7 @@ var _ = Describe("m4appfw test", func() { // Ensure that the Cluster Master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2681,14 +2566,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure Indexer Cluster configured as Multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_gcp/m4/test_helpers_test.go b/test/appframework_gcp/m4/test_helpers_test.go new file mode 100644 index 000000000..e2e110af9 --- /dev/null +++ b/test/appframework_gcp/m4/test_helpers_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package m4gcpappfw + +import ( + "context" + + "github.com/splunk/splunk-operator/test/testenv" +) + +// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. +func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} + +// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). +func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { + testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) +} diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index f492f5f8d..9e854f0f9 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -253,18 +253,9 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes // Ensure that the cluster-manager goes to Ready phase config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - // Verify telemetry - testcaseEnvInst.TriggerTelemetrySubmission(ctx, deployment) - testcaseEnvInst.VerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) + testcaseEnvInst.TriggerAndVerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) // Deploy Monitoring Console CRD mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index ddcd2181b..bc28da5a2 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -201,14 +201,8 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Wait for Cluster Manager to be in READY status testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Wait for Search Head Cluster to be in READY status - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Wait for Indexers to be in READY status - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) // Deploy and verify Monitoring Console _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) @@ -397,17 +391,8 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn err := config.DeployMultisiteClusterWithSearchHead(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Wait for Cluster Manager to be in READY status testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Wait for Indexers to be in READY status - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Verify Multisite Indexer Cluster status - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Wait for Search Head Cluster to be in READY status - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) // Deploy and verify Monitoring Console _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index 021b82d52..06ac78b18 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -272,18 +272,9 @@ var _ = Describe("Monitoring Console test", func() { // Ensure that the cluster-manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Wait for Cluster Manager to appear in Monitoring Console Config Map err = testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, true, 2*time.Minute) @@ -443,18 +434,9 @@ var _ = Describe("Monitoring Console test", func() { // Ensure that the cluster-manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Check Cluster Manager in Monitoring Console Config Map testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, true) diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index 70c2516ad..f6eac564a 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -71,11 +71,7 @@ var _ = Describe("Monitoring Console test", func() { // Deploy and verify C3 cluster with MC testcaseEnvInst.DeployAndVerifyC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, mcName) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Wait for Cluster Master to appear in Monitoring Console Config Map err := testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true, 2*time.Minute) @@ -168,18 +164,9 @@ var _ = Describe("Monitoring Console test", func() { // Ensure that the cluster-master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify MC configuration for C3 cluster testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) @@ -354,15 +341,7 @@ var _ = Describe("Monitoring Console test", func() { // Ensure that the cluster-master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure indexers go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure indexer clustered is configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index e937f9c00..1f62e47f1 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -96,11 +96,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep // Wait for standalone two to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneTwoName, standaloneTwo) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Check both standalones are configured in MC Config Map standalonePods = append(standalonePods, fmt.Sprintf(testenv.StandalonePod, standaloneTwoName, 0)) @@ -121,11 +117,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep err = deployment.DeleteCR(ctx, standaloneTwo) Expect(err).To(Succeed(), "Unable to delete standalone instance", "Standalone Name", standaloneTwo) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Check standalone one is still configured in MC Config Map standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index 1b2147c41..a321345a6 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -83,6 +83,18 @@ func verifySecretsPropagated(ctx context.Context, deployment *testenv.Deployment testcaseEnvInst.VerifySplunkSecretViaAPI(ctx, deployment, verificationPods, secretData, updated) } +// verifyLMAndStandaloneReady waits for License Manager then Standalone to reach READY status. +func verifyLMAndStandaloneReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig, standalone *enterpriseApi.Standalone) { + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) +} + +// verifyLMAndClusterManagerReady waits for License Manager then Cluster Manager to reach READY status. +func verifyLMAndClusterManagerReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) +} + // generateAndApplySecretUpdate creates randomized secret data and applies it to the namespace-scoped // secret object, returning the updated data map for subsequent verification. func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, namespaceScopedSecretName string) map[string][]byte { @@ -111,11 +123,7 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, } Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) @@ -134,17 +142,9 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Ensure standalone is updating testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) - // Wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } @@ -166,11 +166,7 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, } Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) @@ -190,17 +186,9 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, // Ensure standalone is updating testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretStruct.Data, false) } @@ -254,11 +242,7 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretStruct.Data, false) } @@ -272,17 +256,8 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure that the cluster-manager goes to Ready phase - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) // Wait for ClusterInitialized event to confirm cluster is fully initialized idxcName := deployment.GetName() + "-idxc" @@ -314,11 +289,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) } - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure that the cluster-manager goes to Ready phase - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -335,11 +306,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on IndexerCluster") - // Wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify RF SF is met testcaseEnvInst.Log.Info("Checkin RF SF after secret change") @@ -364,11 +331,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, } Expect(err).To(Succeed(), "Unable to deploy cluster") - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure that the cluster-manager goes to Ready phase - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) // Ensure the indexers of all sites go to Ready phase testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) @@ -416,11 +379,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Ensure search head cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // Wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify RF SF is met testcaseEnvInst.Log.Info("Checkin RF SF after secret change") diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index 8dfb2906a..109efb184 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -194,6 +194,12 @@ func RunS1EphemeralStorageTest(ctx context.Context, deployment *testenv.Deployme testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) } +// verifyM4ClusterAndRFSF verifies cluster manager and multisite cluster are ready and RF/SF is met. +func verifyM4ClusterAndRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig, siteCount int) { + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) + testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) +} + // RunM4MultisiteSmartStoreTest runs the standard M4 multisite SmartStore test workflow func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig) { volName := "test-volume-" + testenv.RandomDNSName(3) @@ -216,9 +222,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo } Expect(err).To(Succeed(), "Unable to deploy cluster") - // Verify multisite cluster is ready and RF/SF is met - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) + verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) // Use multisite workflow helper to verify index, ingest data, roll to warm, and verify on S3 testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexName, 2000) @@ -253,9 +257,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo Expect(err).To(Succeed(), "Failed to add new index to cluster manager") } - // Verify multisite cluster is ready and RF/SF is met - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) + verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) // Verify new bundle is pushed (only for v3) if config.APIVersion == "v3" { diff --git a/test/testenv/cmutil.go b/test/testenv/cmutil.go index a1b71f3ce..ffff90ea5 100644 --- a/test/testenv/cmutil.go +++ b/test/testenv/cmutil.go @@ -194,21 +194,6 @@ func CheckSearchHeadRemoved(ctx context.Context, deployment *Deployment) bool { return searchHeadRemoved } -// RollHotBuckets roll hot buckets in cluster -func RollHotBuckets(ctx context.Context, deployment *Deployment) bool { - podName := fmt.Sprintf("splunk-%s-%s-0", deployment.GetName(), "cluster-manager") - stdin := "/opt/splunk/bin/splunk rolling-restart cluster-peers -auth admin:$(cat /mnt/splunk-secrets/password)" - command := []string{"/bin/sh"} - stdout, stderr, err := deployment.PodExecCommand(ctx, podName, command, stdin, false) - if err != nil { - logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "command", command) - return false - } - logf.Log.Info("Command executed on pod", "pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) - - return strings.Contains(stdout, "Rolling restart of all cluster peers has been initiated.") -} - // ClusterManagerInfoEndpointResponse is represtentation of /services/cluster/manager/info endpoint type ClusterManagerInfoEndpointResponse struct { Entry []struct { diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index 400d346b0..9d7398d0e 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -40,27 +40,6 @@ func (testcaseenv *TestCaseEnv) DeployAndVerifyMonitoringConsole(ctx context.Con return mc } -// DeployAndVerifyC3Cluster deploys a C3 cluster (single site with SHC) and verifies all components are ready -func (testcaseenv *TestCaseEnv) DeployAndVerifyC3Cluster(ctx context.Context, deployment *Deployment, name string, indexerReplicas int, mcRef string) { - err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcRef) - Expect(err).To(Succeed(), "Unable to deploy C3 cluster") - - testcaseenv.VerifyClusterManagerReady(ctx, deployment) - testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) - testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) -} - -// DeployAndVerifyM4Cluster deploys an M4 cluster (multisite with SHC) and verifies all components are ready -func (testcaseenv *TestCaseEnv) DeployAndVerifyM4Cluster(ctx context.Context, deployment *Deployment, name string, indexerReplicas int, siteCount int, mcRef string) { - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) - Expect(err).To(Succeed(), "Unable to deploy M4 cluster") - - testcaseenv.VerifyClusterManagerReady(ctx, deployment) - testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) -} - // VerifyIndexerCPULimits verifies CPU limits on all indexer pods in a single-site cluster func (testcaseenv *TestCaseEnv) VerifyIndexerCPULimits(deployment *Deployment, deploymentName string, indexerCount int, expectedCPULimit string) { for i := 0; i < indexerCount; i++ { @@ -77,20 +56,36 @@ func (testcaseenv *TestCaseEnv) VerifySearchHeadCPULimits(deployment *Deployment } } +// VerifyC3ComponentsReady verifies SHC and single-site indexers are ready (without CM check or RFSF). +func (testcaseenv *TestCaseEnv) VerifyC3ComponentsReady(ctx context.Context, deployment *Deployment) { + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) +} + +// VerifyM4ComponentsReady verifies multisite indexers, multisite status, and SHC are ready (without CM check or RFSF). +func (testcaseenv *TestCaseEnv) VerifyM4ComponentsReady(ctx context.Context, deployment *Deployment, siteCount int) { + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) +} + +// VerifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. +func (testcaseenv *TestCaseEnv) VerifyMCVersionChangedAndReady(ctx context.Context, deployment *Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { + testcaseenv.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) +} + // VerifyClusterReadyAndRFSF is a common verification pattern that checks cluster is ready and RF/SF is met func (testcaseenv *TestCaseEnv) VerifyClusterReadyAndRFSF(ctx context.Context, deployment *Deployment) { testcaseenv.VerifyClusterManagerReady(ctx, deployment) - testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) - testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) + testcaseenv.VerifyC3ComponentsReady(ctx, deployment) testcaseenv.VerifyRFSFMet(ctx, deployment) } // VerifyMultisiteClusterReadyAndRFSF is a common verification pattern for multisite clusters func (testcaseenv *TestCaseEnv) VerifyMultisiteClusterReadyAndRFSF(ctx context.Context, deployment *Deployment, siteCount int) { testcaseenv.VerifyClusterManagerReady(ctx, deployment) - testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifyM4ComponentsReady(ctx, deployment, siteCount) testcaseenv.VerifyRFSFMet(ctx, deployment) } @@ -106,10 +101,3 @@ func (testcaseenv *TestCaseEnv) StandardC3Verification(ctx context.Context, depl testcaseenv.VerifyClusterReadyAndRFSF(ctx, deployment) testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) } - -// StandardM4Verification performs the standard set of verifications for an M4 cluster -// This includes multisite cluster ready, RF/SF met, and monitoring console ready -func (testcaseenv *TestCaseEnv) StandardM4Verification(ctx context.Context, deployment *Deployment, siteCount int, mcName string, mc *enterpriseApi.MonitoringConsole) { - testcaseenv.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) - testcaseenv.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) -} diff --git a/test/testenv/cr_update_helpers.go b/test/testenv/cr_update_helpers.go index c16c88b9d..492b26187 100644 --- a/test/testenv/cr_update_helpers.go +++ b/test/testenv/cr_update_helpers.go @@ -18,52 +18,9 @@ import ( "context" . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" "sigs.k8s.io/controller-runtime/pkg/client" ) -// UpdateResourceLimits updates the resource limits for a given CR object -func UpdateResourceLimits(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string, cpuLimit string, memoryLimit string) error { - err := deployment.GetInstance(ctx, instanceName, obj) - if err != nil { - return err - } - - limits := corev1.ResourceList{} - if cpuLimit != "" { - limits["cpu"] = resource.MustParse(cpuLimit) - } - if memoryLimit != "" { - limits["memory"] = resource.MustParse(memoryLimit) - } - - return deployment.UpdateCR(ctx, obj) -} - -// GetAndDeleteCR is a helper function that gets a CR instance and then deletes it -func GetAndDeleteCR(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string) error { - err := deployment.GetInstance(ctx, instanceName, obj) - Expect(err).To(Succeed(), "Unable to get instance", "Instance Name", instanceName) - - err = deployment.DeleteCR(ctx, obj) - Expect(err).To(Succeed(), "Unable to delete instance", "Instance Name", instanceName) - - return nil -} - -// UpdateCRWithRetry attempts to update a CR with retry logic -func UpdateCRWithRetry(ctx context.Context, deployment *Deployment, obj client.Object, maxRetries int) error { - var err error - for i := 0; i < maxRetries; i++ { - err = deployment.UpdateCR(ctx, obj) - if err == nil { - return nil - } - } - return err -} - // GetInstanceWithExpect is a wrapper around GetInstance that includes Gomega expectations func GetInstanceWithExpect(ctx context.Context, deployment *Deployment, obj client.Object, instanceName string, errorMsg string) { err := deployment.GetInstance(ctx, instanceName, obj) @@ -75,9 +32,3 @@ func UpdateCRWithExpect(ctx context.Context, deployment *Deployment, obj client. err := deployment.UpdateCR(ctx, obj) Expect(err).To(Succeed(), errorMsg) } - -// DeleteCRWithExpect is a wrapper around DeleteCR that includes Gomega expectations -func DeleteCRWithExpect(ctx context.Context, deployment *Deployment, obj client.Object, errorMsg string) { - err := deployment.DeleteCR(ctx, obj) - Expect(err).To(Succeed(), errorMsg) -} diff --git a/test/testenv/deployment_scenarios.go b/test/testenv/deployment_scenarios.go deleted file mode 100644 index cf3904483..000000000 --- a/test/testenv/deployment_scenarios.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package testenv - -import ( - "context" - - . "github.com/onsi/gomega" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" -) - -// DeploymentScenarioResult holds the result of a deployment scenario -type DeploymentScenarioResult struct { - Standalone *enterpriseApi.Standalone - ClusterManager *enterpriseApi.ClusterManager - IndexerCluster *enterpriseApi.IndexerCluster - SearchHeadCluster *enterpriseApi.SearchHeadCluster - MonitoringConsole *enterpriseApi.MonitoringConsole - LicenseManager *enterpriseApi.LicenseManager -} - -// DeployStandardS1 deploys a standard S1 (Standalone) configuration -func (testcaseEnv *TestCaseEnv) DeployStandardS1(ctx context.Context, deployment *Deployment) *enterpriseApi.Standalone { - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Verify standalone goes to ready state - testcaseEnv.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - return standalone -} - -// DeployStandardS1WithLM deploys S1 with License Manager -func (testcaseEnv *TestCaseEnv) DeployStandardS1WithLM(ctx context.Context, deployment *Deployment) (*enterpriseApi.Standalone, *enterpriseApi.LicenseManager) { - // Download License File and create config map - SetupLicenseConfigMap(ctx, testcaseEnv) - - // Create standalone Deployment with License Manager - mcRef := deployment.GetName() - standalone, err := deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") - - // Wait for License Manager to be in READY status - testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) - - // Wait for Standalone to be in READY status - testcaseEnv.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - - // Get License Manager instance - lm := &enterpriseApi.LicenseManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), lm) - Expect(err).To(Succeed(), "Unable to get License Manager instance") - - return standalone, lm -} - -// DeployStandardS1WithMC deploys S1 with Monitoring Console -func (testcaseEnv *TestCaseEnv) DeployStandardS1WithMC(ctx context.Context, deployment *Deployment) (*enterpriseApi.Standalone, *enterpriseApi.MonitoringConsole) { - // Deploy Standalone - standalone := testcaseEnv.DeployStandardS1(ctx, deployment) - - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - return standalone, mc -} - -// DeployStandardC3 deploys a standard C3 (Clustered indexer, search head cluster) configuration -func (testcaseEnv *TestCaseEnv) DeployStandardC3(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), indexerReplicas, true /*shc*/, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnv.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnv.VerifyRFSFMet(ctx, deployment) - - // Get deployed instances - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") - - idxc := &enterpriseApi.IndexerCluster{} - idxcName := deployment.GetName() + "-idxc" - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") - - return &DeploymentScenarioResult{ - ClusterManager: cm, - SearchHeadCluster: shc, - IndexerCluster: idxc, - } -} - -// DeployStandardC3WithLM deploys C3 with License Manager -func (testcaseEnv *TestCaseEnv) DeployStandardC3WithLM(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { - // Download License File and create config map - SetupLicenseConfigMap(ctx, testcaseEnv) - - mcRef := deployment.GetName() - err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), indexerReplicas, true /*shc*/, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure Indexers go to Ready phase - testcaseEnv.VerifySingleSiteIndexersReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnv.VerifyRFSFMet(ctx, deployment) - - // Get deployed instances - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") - - idxc := &enterpriseApi.IndexerCluster{} - idxcName := deployment.GetName() + "-idxc" - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") - - lm := &enterpriseApi.LicenseManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), lm) - Expect(err).To(Succeed(), "Unable to get License Manager instance") - - return &DeploymentScenarioResult{ - ClusterManager: cm, - SearchHeadCluster: shc, - IndexerCluster: idxc, - LicenseManager: lm, - } -} - -// DeployStandardC3WithMC deploys C3 with Monitoring Console -func (testcaseEnv *TestCaseEnv) DeployStandardC3WithMC(ctx context.Context, deployment *Deployment, indexerReplicas int) *DeploymentScenarioResult { - result := testcaseEnv.DeployStandardC3(ctx, deployment, indexerReplicas) - - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - result.MonitoringConsole = mc - return result -} - -// DeployStandardM4 deploys a standard M4 (Multisite indexer cluster, Search head cluster) configuration -func (testcaseEnv *TestCaseEnv) DeployStandardM4(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), indexerReplicas, siteCount, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnv.VerifyRFSFMet(ctx, deployment) - - // Get deployed instances - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") - - return &DeploymentScenarioResult{ - ClusterManager: cm, - SearchHeadCluster: shc, - } -} - -// DeployStandardM4WithLM deploys M4 with License Manager -func (testcaseEnv *TestCaseEnv) DeployStandardM4WithLM(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { - // Download License File and create config map - SetupLicenseConfigMap(ctx, testcaseEnv) - - mcRef := deployment.GetName() - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), indexerReplicas, siteCount, mcRef) - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnv.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnv.VerifyRFSFMet(ctx, deployment) - - // Get deployed instances - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") - - lm := &enterpriseApi.LicenseManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), lm) - Expect(err).To(Succeed(), "Unable to get License Manager instance") - - return &DeploymentScenarioResult{ - ClusterManager: cm, - SearchHeadCluster: shc, - LicenseManager: lm, - } -} - -// DeployStandardM4WithMC deploys M4 with Monitoring Console -func (testcaseEnv *TestCaseEnv) DeployStandardM4WithMC(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { - result := testcaseEnv.DeployStandardM4(ctx, deployment, indexerReplicas, siteCount) - - // Deploy Monitoring Console - mc, err := deployment.DeployMonitoringConsole(ctx, deployment.GetName(), "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnv.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - result.MonitoringConsole = mc - return result -} - -// DeployStandardM1 deploys a standard M1 (Multisite indexer cluster only) configuration -func (testcaseEnv *TestCaseEnv) DeployStandardM1(ctx context.Context, deployment *Deployment, indexerReplicas int, siteCount int) *DeploymentScenarioResult { - err := deployment.DeployMultisiteCluster(ctx, deployment.GetName(), indexerReplicas, siteCount, "") - Expect(err).To(Succeed(), "Unable to deploy cluster") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnv.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure cluster configured as multisite - testcaseEnv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Verify RF SF is met - testcaseEnv.VerifyRFSFMet(ctx, deployment) - - // Get deployed instances - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") - - return &DeploymentScenarioResult{ - ClusterManager: cm, - } -} diff --git a/test/testenv/mcutil.go b/test/testenv/mcutil.go index 36250ae96..db3378444 100644 --- a/test/testenv/mcutil.go +++ b/test/testenv/mcutil.go @@ -104,18 +104,6 @@ func GetConfiguredPeers(ns string, mcName string) []string { return peerList } -// DeleteMCPod delete monitoring console deployment -func DeleteMCPod(ns string) { - mcSts := fmt.Sprintf(MonitoringConsoleSts, ns) - output, err := exec.Command("kubectl", "delete", "sts", "-n", ns, mcSts).Output() - if err != nil { - cmd := fmt.Sprintf("kubectl delete sts -n %s %s", ns, mcSts) - logf.Log.Error(err, "Failed to execute command", "command", cmd) - } else { - logf.Log.Info("Monitoring Console Stateful Set deleted", "Statefulset", mcSts, "stdout", output) - } -} - // CheckPodNameOnMC Check given pod is configured on Monitoring console pod func CheckPodNameOnMC(ns string, mcName string, podName string) bool { // Get Peers configured on Monitoring Console diff --git a/test/testenv/remote_index_utils.go b/test/testenv/remote_index_utils.go index 551a377d0..e093e5008 100644 --- a/test/testenv/remote_index_utils.go +++ b/test/testenv/remote_index_utils.go @@ -60,19 +60,6 @@ func GetIndexOnPod(ctx context.Context, deployment *Deployment, podName string, return indexFound, indexData } -// RestartSplunk Restart splunk inside the container -func RestartSplunk(ctx context.Context, deployment *Deployment, podName string) bool { - stdin := "/opt/splunk/bin/splunk restart -auth admin:$(cat /mnt/splunk-secrets/password)" - command := []string{"/bin/sh"} - stdout, stderr, err := deployment.PodExecCommand(ctx, podName, command, stdin, false) - if err != nil { - logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "command", command) - return false - } - logf.Log.Info("Command executed on pod", "pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) - return true -} - // RollHotToWarm rolls hot buckets to warm for a given index and pod func RollHotToWarm(ctx context.Context, deployment *Deployment, podName string, indexName string) bool { stdin := "/opt/splunk/bin/splunk _internal call /data/indexes/" + indexName + "/roll-hot-buckets admin:$(cat /mnt/splunk-secrets/password)" diff --git a/test/testenv/s3utils.go b/test/testenv/s3utils.go index 445e395f1..e9559bf5b 100644 --- a/test/testenv/s3utils.go +++ b/test/testenv/s3utils.go @@ -32,11 +32,6 @@ var ( s3deleteWaitTime = 60 ) -// GetSmartStoreIndexesBucet returns smartstore test bucket name -func GetSmartStoreIndexesBucet() string { - return testIndexesS3Bucket -} - // GetDefaultS3Region returns default AWS Region func GetDefaultS3Region() string { return s3Region diff --git a/test/testenv/search_head_cluster_utils.go b/test/testenv/search_head_cluster_utils.go index 012064501..90c847afb 100644 --- a/test/testenv/search_head_cluster_utils.go +++ b/test/testenv/search_head_cluster_utils.go @@ -18,39 +18,11 @@ package testenv import ( "context" "fmt" - "os/exec" "strings" logf "sigs.k8s.io/controller-runtime/pkg/log" ) -// DeleteSHC delete Search Head Cluster in given namespace -func DeleteSHC(ns string) { - output, err := exec.Command("kubectl", "delete", "shc", "-n", ns, "--all").Output() - if err != nil { - cmd := fmt.Sprintf("kubectl delete shc -n %s --all", ns) - logf.Log.Error(err, "Failed to execute command", "command", cmd) - } else { - logf.Log.Info("SHC deleted", "Namespace", ns, "stdout", output) - } -} - -// SHCInNamespace returns true if SHC is present in namespace -func SHCInNamespace(ns string) bool { - output, err := exec.Command("kubectl", "get", "searchheadcluster", "-n", ns).Output() - deleted := true - if err != nil { - cmd := fmt.Sprintf("kubectl get shc -n %s", ns) - logf.Log.Error(err, "Failed to execute command", "command", cmd) - return deleted - } - logf.Log.Info("Output of command", "Output", string(output)) - if strings.Contains(string(output), "No resources found in default namespace") { - deleted = false - } - return deleted -} - // DeployerAppChecksum Get the checksum for each app on the deployer func DeployerAppChecksum(ctx context.Context, deployment *Deployment) map[string]string { appChecksum := make(map[string]string) diff --git a/test/testenv/test_workflows.go b/test/testenv/test_workflows.go index 581c52cf2..2b095f605 100644 --- a/test/testenv/test_workflows.go +++ b/test/testenv/test_workflows.go @@ -42,34 +42,6 @@ func RunStandaloneDeploymentWorkflow(ctx context.Context, deployment *Deployment return &WorkflowResult{Standalone: standalone} } -// RunStandaloneWithLMWorkflow deploys standalone with license manager and verifies both are ready -func RunStandaloneWithLMWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, lmName string) *WorkflowResult { - lm, err := deployment.DeployLicenseManager(ctx, lmName) - Expect(err).To(Succeed(), "Unable to deploy License Manager") - - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - - standalone, err := deployment.DeployStandalone(ctx, name, lmName, "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) - - return &WorkflowResult{Standalone: standalone, LicenseManager: lm} -} - -// RunStandaloneWithMCWorkflow deploys standalone with monitoring console and verifies both are ready -func RunStandaloneWithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, mcName string) *WorkflowResult { - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") - - standalone, err := deployment.DeployStandalone(ctx, name, "", mcName) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) - - return &WorkflowResult{Standalone: standalone, MonitoringConsole: mc} -} - // RunC3DeploymentWorkflow deploys a C3 cluster (CM + IDXC + SHC) and verifies all components are ready func RunC3DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, mcRef string) *WorkflowResult { err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcRef) @@ -83,22 +55,6 @@ func RunC3DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca return &WorkflowResult{} } -// RunC3WithMCWorkflow deploys a C3 cluster with monitoring console and verifies all components -func RunC3WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, mcName string) *WorkflowResult { - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") - - err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy C3 cluster") - - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) - - return &WorkflowResult{MonitoringConsole: mc} -} - // RunM4DeploymentWorkflow deploys a M4 multisite cluster and verifies all components are ready func RunM4DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int, mcRef string) *WorkflowResult { err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) @@ -113,23 +69,6 @@ func RunM4DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca return &WorkflowResult{} } -// RunM4WithMCWorkflow deploys a M4 multisite cluster with monitoring console -func RunM4WithMCWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int, mcName string) *WorkflowResult { - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcName, "") - - err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcName) - Expect(err).To(Succeed(), "Unable to deploy M4 cluster") - - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) - - return &WorkflowResult{MonitoringConsole: mc} -} - // RunM1DeploymentWorkflow deploys a M1 multisite indexer cluster (no SHC) and verifies components func RunM1DeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string, indexerReplicas int, siteCount int) *WorkflowResult { err := deployment.DeployMultisiteCluster(ctx, name, indexerReplicas, siteCount, "") @@ -204,39 +143,3 @@ func RunDeleteC3Workflow(ctx context.Context, deployment *Deployment, testcaseEn err = deployment.DeleteCR(ctx, cm) Expect(err).To(Succeed(), "Unable to delete Cluster Manager") } - -// RunIngestAndSearchWorkflow ingests data and performs a search on a pod -func RunIngestAndSearchWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, podName string, indexName string, searchQuery string) { - logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) - CreateMockLogfile(logFile, 100) - IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - - searchResults, err := PerformSearchSync(ctx, podName, searchQuery, deployment) - Expect(err).To(Succeed(), "Failed to perform search") - testcaseEnvInst.Log.Info("Search completed", "results", searchResults) -} - -// RunMonitoringConsoleDeploymentWorkflow deploys a Monitoring Console instance and verifies it is ready -func RunMonitoringConsoleDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, name, "") - return &WorkflowResult{MonitoringConsole: mc} -} - -// RunLicenseManagerDeploymentWorkflow deploys a License Manager instance and verifies it is ready -func RunLicenseManagerDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { - lm, err := deployment.DeployLicenseManager(ctx, name) - Expect(err).To(Succeed(), "Unable to deploy License Manager") - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) - return &WorkflowResult{LicenseManager: lm} -} - -// RunCompleteDataIngestionWorkflow performs complete data ingestion workflow: ingest, verify, roll to warm, verify on S3 -func RunCompleteDataIngestionWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, podName string, indexName string, logLineCount int) { - logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) - CreateMockLogfile(logFile, logLineCount) - IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) - - RollHotToWarm(ctx, deployment, podName, indexName) - - testcaseEnvInst.VerifyIndexExistsOnS3(ctx, deployment, podName, indexName) -} diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index 4e0ccb3c4..a22981b67 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -118,11 +118,6 @@ func (testenv *TestCaseEnv) GetSplunkImage() string { return testenv.splunkImage } -// IsOperatorInstalledClusterWide returns if operator is installed clusterwide -func (testenv *TestCaseEnv) IsOperatorInstalledClusterWide() string { - return testenv.clusterWideOperator -} - func (testenv *TestCaseEnv) setup() error { testenv.Log.Info("testenv initializing.\n") diff --git a/test/testenv/util.go b/test/testenv/util.go index 90460849b..ae902f995 100644 --- a/test/testenv/util.go +++ b/test/testenv/util.go @@ -23,8 +23,6 @@ import ( "os" "os/exec" "path" - "reflect" - "sort" "strings" "time" @@ -1115,16 +1113,6 @@ func GetDirsOrFilesInPath(ctx context.Context, deployment *Deployment, podName s return strings.Fields(stdout), err } -// CompareStringSlices checks if two string slices are matching -func CompareStringSlices(stringOne []string, stringTwo []string) bool { - if len(stringOne) != len(stringTwo) { - return false - } - sort.Strings(stringOne) - sort.Strings(stringTwo) - return reflect.DeepEqual(stringOne, stringTwo) -} - // CheckStringInSlice check if string is present in a slice func CheckStringInSlice(stringSlice []string, compString string) bool { logf.Log.Info("Checking for string in slice", "String", compString, "String Slice", stringSlice) @@ -1170,16 +1158,6 @@ func GetPodUIDs(ns string) map[string]string { return splunkPodUIDs } -// DeletePod Delete pod in the namespace -func DeletePod(ns string, podName string) error { - _, err := exec.Command("kubectl", "delete", "pod", "-n", ns, podName).Output() - if err != nil { - logf.Log.Error(err, "Failed to delete operator pod ", "PodName", podName, "Namespace", ns) - return err - } - return nil -} - // DeleteOperatorPod Delete Operator Pod in the namespace func DeleteOperatorPod(testcaseEnvInst *TestCaseEnv) error { var podName string diff --git a/test/testenv/verificationutils.go b/test/testenv/verificationutils.go index 4b3bc1331..2393ffd88 100644 --- a/test/testenv/verificationutils.go +++ b/test/testenv/verificationutils.go @@ -316,15 +316,6 @@ func (testenv *TestCaseEnv) VerifyNoDisconnectedSHPresentOnCM(ctx context.Contex }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(true)) } -// VerifyNoSHCInNamespace verify no SHC is present in namespace -func (testenv *TestCaseEnv) VerifyNoSHCInNamespace(deployment *Deployment) { - gomega.Eventually(func() bool { - shcStatus := SHCInNamespace(testenv.GetName()) - testenv.Log.Info("Verifying no Search Head Cluster is present in namespace", "Status", shcStatus) - return shcStatus - }, deployment.GetTimeout(), ShortPollInterval).Should(gomega.Equal(false)) -} - // VerifyLicenseManagerReady verify LM is in ready status and does not flip flop func (testenv *TestCaseEnv) VerifyLicenseManagerReady(ctx context.Context, deployment *Deployment) { LicenseManager := &enterpriseApi.LicenseManager{} @@ -439,15 +430,6 @@ func (testenv *TestCaseEnv) VerifyIndexExistsOnS3(ctx context.Context, deploymen }, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(true)) } -// VerifyRollingRestartFinished verify no rolling restart is active -func (testenv *TestCaseEnv) VerifyRollingRestartFinished(ctx context.Context, deployment *Deployment) { - gomega.Eventually(func() bool { - rollingRestartStatus := CheckRollingRestartStatus(ctx, deployment) - testenv.Log.Info("Rolling Restart Status", "active", rollingRestartStatus) - return rollingRestartStatus - }, deployment.GetTimeout(), ShortPollInterval).Should(gomega.Equal(true)) -} - // VerifyConfOnPod Verify give conf and value on config file on pod func (testenv *TestCaseEnv) VerifyConfOnPod(deployment *Deployment, podName string, confFilePath string, config string, value string) { gomega.Consistently(func() bool { From 4d0ab80ee4468d5bcb188d12f07315519d77d9a9 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Tue, 24 Mar 2026 12:34:27 +0100 Subject: [PATCH 14/20] CSPL-3775 Replcaing duplicates among different tests --- test/custom_resource_crud/crud_test_shared.go | 39 +------------ .../custom_resource_crud_c3_test.go | 4 +- .../custom_resource_crud_m4_test.go | 2 +- .../manager_custom_resource_crud_c3_test.go | 4 +- .../manager_custom_resource_crud_m4_test.go | 2 +- test/licensemanager/lm_test_shared.go | 14 ----- test/secret/manager_secret_c3_test.go | 2 +- test/secret/manager_secret_m4_test.go | 2 +- test/secret/manager_secret_s1_test.go | 6 +- test/secret/secret_c3_test.go | 2 +- test/secret/secret_m4_test.go | 2 +- test/secret/secret_s1_test.go | 6 +- test/secret/secret_test_shared.go | 57 +++---------------- test/smartstore/manager_smartstore_test.go | 2 +- test/smartstore/smartstore_test.go | 2 +- test/smartstore/smartstore_test_shared.go | 30 +--------- test/testenv/common_test_patterns.go | 34 +++++++++++ 17 files changed, 65 insertions(+), 145 deletions(-) diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index 9e854f0f9..dd0d55761 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -27,39 +27,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" ) -// CRUDTestConfig holds configuration for CRUD tests to support both v3 and v4 API versions -type CRUDTestConfig struct { - LicenseManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - APIVersion string -} - -// NewCRUDTestConfigV3 creates configuration for v3 API (LicenseMaster/ClusterMaster) -func NewCRUDTestConfigV3() *CRUDTestConfig { - return &CRUDTestConfig{ - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterMasterReady(ctx, deployment) - }, - APIVersion: "v3", - } -} - -// NewCRUDTestConfigV4 creates configuration for v4 API (LicenseManager/ClusterManager) -func NewCRUDTestConfigV4() *CRUDTestConfig { - return &CRUDTestConfig{ - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - }, - APIVersion: "v4", - } -} - // RunS1CPUUpdateTest runs the standard S1 CPU limit update test workflow func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, defaultCPULimits string, newCPULimits string) { // Deploy and verify Standalone @@ -97,7 +64,7 @@ func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes } // RunC3CPUUpdateTest runs the standard C3 CPU limit update test workflow -func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, defaultCPULimits string, newCPULimits string) { +func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, defaultCPULimits string, newCPULimits string) { // Deploy Single site Cluster and Search Head Clusters mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) @@ -155,7 +122,7 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes } // RunC3PVCDeletionTest runs the standard C3 PVC deletion test workflow -func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, verificationTimeout time.Duration) { +func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, verificationTimeout time.Duration) { // Deploy Single site Cluster and Search Head Clusters mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) @@ -236,7 +203,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t } // RunM4CPUUpdateTest runs the standard M4 CPU limit update test workflow -func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *CRUDTestConfig, defaultCPULimits string, newCPULimits string) { +func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, defaultCPULimits string, newCPULimits string) { // Deploy Multisite Cluster and Search Head Clusters mcRef := deployment.GetName() prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go index c74899f4d..fc8d3c9db 100644 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/custom_resource_crud_c3_test.go @@ -45,14 +45,14 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - config := NewCRUDTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - config := NewCRUDTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) }) }) diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go index acd34165c..6f79989b0 100644 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/custom_resource_crud_m4_test.go @@ -41,7 +41,7 @@ var _ = Describe("Crcrud test for SVA M4", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("mastercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - config := NewCRUDTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go index efcbabde2..416537e47 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go @@ -51,7 +51,7 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - config := NewCRUDTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) @@ -109,7 +109,7 @@ var _ = Describe("Crcrud test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - config := NewCRUDTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) }) }) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go index e36c4153d..30c894940 100644 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go @@ -41,7 +41,7 @@ var _ = Describe("Crcrud test for SVA M4", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("managercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - config := NewCRUDTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index bc28da5a2..19ca32da5 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -31,8 +31,6 @@ import ( type LicenseTestConfig struct { DeployStandaloneWithLM func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) - LicenseManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) DeployMultisiteClusterWithSearchHead func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas, siteCount int, mcRef string) error DeployLicenseManagerWithGivenSpec func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) LicenseManagerPodName string @@ -44,12 +42,6 @@ func NewLicenseMasterConfig() *LicenseTestConfig { DeployStandaloneWithLM: func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) { return deployment.DeployStandaloneWithLMaster(ctx, name, mcRef) }, - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterMasterReady(ctx, deployment) - }, DeployMultisiteClusterWithSearchHead: func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas int, siteCount int, mcRef string) error { return deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) }, @@ -66,12 +58,6 @@ func NewLicenseManagerConfig() *LicenseTestConfig { DeployStandaloneWithLM: func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) { return deployment.DeployStandaloneWithLM(ctx, name, mcRef) }, - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - }, DeployMultisiteClusterWithSearchHead: func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas int, siteCount int, mcRef string) error { return deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) }, diff --git a/test/secret/manager_secret_c3_test.go b/test/secret/manager_secret_c3_test.go index 804c011f5..6acbb2abb 100644 --- a/test/secret/manager_secret_c3_test.go +++ b/test/secret/manager_secret_c3_test.go @@ -37,7 +37,7 @@ var _ = Describe("Secret Test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managersecret, smoke, c3: secret update on indexers and search head cluster", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/manager_secret_m4_test.go b/test/secret/manager_secret_m4_test.go index 341514109..970d01f05 100644 --- a/test/secret/manager_secret_m4_test.go +++ b/test/secret/manager_secret_m4_test.go @@ -38,7 +38,7 @@ var _ = Describe("Secret Test for M4 SVA", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("managersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/manager_secret_s1_test.go b/test/secret/manager_secret_s1_test.go index 4bd72e302..15b280076 100644 --- a/test/secret/manager_secret_s1_test.go +++ b/test/secret/manager_secret_s1_test.go @@ -37,21 +37,21 @@ var _ = Describe("Secret Test for SVA S1", func() { Context("Standalone deployment (S1) with LM and MC", func() { It("managersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1) with LM amd MC", func() { It("managersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1)", func() { It("managersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/secret_c3_test.go b/test/secret/secret_c3_test.go index a789a3666..b48219af9 100644 --- a/test/secret/secret_c3_test.go +++ b/test/secret/secret_c3_test.go @@ -37,7 +37,7 @@ var _ = Describe("Secret Test for SVA C3", func() { Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastersecret, smoke, c3: secret update on indexers and search head cluster", func() { - config := NewSecretTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/secret_m4_test.go b/test/secret/secret_m4_test.go index 1763e7430..158286c04 100644 --- a/test/secret/secret_m4_test.go +++ b/test/secret/secret_m4_test.go @@ -39,7 +39,7 @@ var _ = Describe("Secret Test for M4 SVA", func() { Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { It("mastersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - config := NewSecretTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/secret_s1_test.go b/test/secret/secret_s1_test.go index 9a6339ee3..d31e81029 100644 --- a/test/secret/secret_s1_test.go +++ b/test/secret/secret_s1_test.go @@ -37,21 +37,21 @@ var _ = Describe("Secret Test for SVA S1", func() { Context("Standalone deployment (S1) with LM and MC", func() { It("mastersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1) with LM amd MC", func() { It("mastersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) }) }) Context("Standalone deployment (S1)", func() { It("mastersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - config := NewSecretTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index a321345a6..de1e35e4b 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -25,39 +25,6 @@ import ( corev1 "k8s.io/api/core/v1" ) -// SecretTestConfig holds configuration for secret tests to support both v3 and v4 API versions -type SecretTestConfig struct { - LicenseManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - APIVersion string -} - -// NewSecretTestConfigV3 creates configuration for v3 API (LicenseMaster/ClusterMaster) -func NewSecretTestConfigV3() *SecretTestConfig { - return &SecretTestConfig{ - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterMasterReady(ctx, deployment) - }, - APIVersion: "v3", - } -} - -// NewSecretTestConfigV4 creates configuration for v4 API (LicenseManager/ClusterManager) -func NewSecretTestConfigV4() *SecretTestConfig { - return &SecretTestConfig{ - LicenseManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) - }, - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - }, - APIVersion: "v4", - } -} - // verifySecretsPropagated checks that the given secret data has been propagated to all // versioned secret objects, pods, server config, input config, and via the API. func verifySecretsPropagated(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, secretData map[string][]byte, updated bool) { @@ -84,13 +51,13 @@ func verifySecretsPropagated(ctx context.Context, deployment *testenv.Deployment } // verifyLMAndStandaloneReady waits for License Manager then Standalone to reach READY status. -func verifyLMAndStandaloneReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig, standalone *enterpriseApi.Standalone) { +func verifyLMAndStandaloneReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, standalone *enterpriseApi.Standalone) { config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) } // verifyLMAndClusterManagerReady waits for License Manager then Cluster Manager to reach READY status. -func verifyLMAndClusterManagerReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func verifyLMAndClusterManagerReady(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) } @@ -107,7 +74,7 @@ func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deplo } // RunS1SecretUpdateTest runs the standard S1 secret update test workflow -func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Download License File and create config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) @@ -150,7 +117,7 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, } // RunS1SecretDeleteTest runs the standard S1 secret delete test workflow -func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Download License File and create config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) @@ -194,7 +161,7 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, } // RunS1SecretDeleteWithMCRefTest runs the S1 secret delete test with MC reference workflow -func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Create standalone Deployment with MonitoringConsoleRef var standalone *enterpriseApi.Standalone var err error @@ -248,7 +215,7 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep } // RunC3SecretUpdateTest runs the standard C3 secret update test workflow -func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Download License File and create config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) @@ -316,7 +283,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, } // RunM4SecretUpdateTest runs the standard M4 secret update test workflow -func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SecretTestConfig) { +func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Download License File and create config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) @@ -332,15 +299,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Unable to deploy cluster") verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Ensure cluster configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) diff --git a/test/smartstore/manager_smartstore_test.go b/test/smartstore/manager_smartstore_test.go index 1c0c34611..e6d03c867 100644 --- a/test/smartstore/manager_smartstore_test.go +++ b/test/smartstore/manager_smartstore_test.go @@ -37,7 +37,7 @@ var _ = Describe("Smartstore test", func() { Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { It("managersmartstore, smoke: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - config := NewSmartStoreTestConfigV4() + config := testenv.NewClusterReadinessConfigV4() RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index 7afa5a2e9..91cfd4a51 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -38,7 +38,7 @@ var _ = Describe("Smartstore test", func() { Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { It("mastersmartstore, m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - config := NewSmartStoreTestConfigV3() + config := testenv.NewClusterReadinessConfigV3() RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index 109efb184..f7dd4609f 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -26,32 +26,6 @@ import ( . "github.com/onsi/gomega" ) -// SmartStoreTestConfig holds configuration for SmartStore tests to support both v3 and v4 API versions -type SmartStoreTestConfig struct { - ClusterManagerReady func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) - APIVersion string -} - -// NewSmartStoreTestConfigV3 creates configuration for v3 API (ClusterMaster) -func NewSmartStoreTestConfigV3() *SmartStoreTestConfig { - return &SmartStoreTestConfig{ - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterMasterReady(ctx, deployment) - }, - APIVersion: "v3", - } -} - -// NewSmartStoreTestConfigV4 creates configuration for v4 API (ClusterManager) -func NewSmartStoreTestConfigV4() *SmartStoreTestConfig { - return &SmartStoreTestConfig{ - ClusterManagerReady: func(ctx context.Context, deployment *testenv.Deployment, testcaseEnv *testenv.TestCaseEnv) { - testcaseEnv.VerifyClusterManagerReady(ctx, deployment) - }, - APIVersion: "v4", - } -} - // RunS1MultipleIndexesTest runs the standard S1 multiple indexes SmartStore test workflow func RunS1MultipleIndexesTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, waitTimeout time.Duration) { volName := "test-volume-" + testenv.RandomDNSName(3) @@ -195,13 +169,13 @@ func RunS1EphemeralStorageTest(ctx context.Context, deployment *testenv.Deployme } // verifyM4ClusterAndRFSF verifies cluster manager and multisite cluster are ready and RF/SF is met. -func verifyM4ClusterAndRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig, siteCount int) { +func verifyM4ClusterAndRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, siteCount int) { config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) } // RunM4MultisiteSmartStoreTest runs the standard M4 multisite SmartStore test workflow -func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *SmartStoreTestConfig) { +func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { volName := "test-volume-" + testenv.RandomDNSName(3) indexName := "test-index-" + testenv.RandomDNSName(3) diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index 9d7398d0e..f2abb94de 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -22,6 +22,40 @@ import ( enterpriseApi "github.com/splunk/splunk-operator/api/v4" ) +// ClusterReadinessConfig holds v3/v4 API version callbacks for cluster and license manager +// readiness verification. Shared across test packages to avoid per-package duplication. +type ClusterReadinessConfig struct { + LicenseManagerReady func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) + ClusterManagerReady func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) + APIVersion string +} + +// NewClusterReadinessConfigV3 creates a ClusterReadinessConfig for v3 API (LicenseMaster/ClusterMaster) +func NewClusterReadinessConfigV3() *ClusterReadinessConfig { + return &ClusterReadinessConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + testcaseEnv.VerifyLicenseMasterReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + testcaseEnv.VerifyClusterMasterReady(ctx, deployment) + }, + APIVersion: "v3", + } +} + +// NewClusterReadinessConfigV4 creates a ClusterReadinessConfig for v4 API (LicenseManager/ClusterManager) +func NewClusterReadinessConfigV4() *ClusterReadinessConfig { + return &ClusterReadinessConfig{ + LicenseManagerReady: func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + testcaseEnv.VerifyLicenseManagerReady(ctx, deployment) + }, + ClusterManagerReady: func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + testcaseEnv.VerifyClusterManagerReady(ctx, deployment) + }, + APIVersion: "v4", + } +} + // DeployAndVerifyStandalone deploys a standalone instance and verifies it reaches ready state func (testcaseenv *TestCaseEnv) DeployAndVerifyStandalone(ctx context.Context, deployment *Deployment, name string, mcRef string, licenseManagerRef string) *enterpriseApi.Standalone { standalone, err := deployment.DeployStandalone(ctx, name, mcRef, licenseManagerRef) From b55f225f0dc525d7a4c53282778caa447fcefbc7 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Tue, 24 Mar 2026 16:05:43 +0100 Subject: [PATCH 15/20] CSPL-3775 Eliminating duplicated v3/v4 branching logic --- test/custom_resource_crud/crud_test_shared.go | 26 +--- test/licensemanager/lm_test_shared.go | 128 ++++++++---------- .../manager_monitoring_console_test.go | 15 +- .../monitoring_console_test.go | 10 +- .../monitoring_console_test_shared.go | 27 ++-- test/secret/secret_test_shared.go | 65 ++------- test/smartstore/smartstore_test_shared.go | 30 +--- test/testenv/common_test_patterns.go | 102 ++++++++++++++ 8 files changed, 185 insertions(+), 218 deletions(-) diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index dd0d55761..e2dfd70d1 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -18,7 +18,6 @@ import ( "fmt" "time" - enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" @@ -145,10 +144,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, true, verificationTimeout) // Verify Cluster Manager PVCs (etc and var) exists - clusterManagerType := "cluster-master" - if config.APIVersion == "v4" { - clusterManagerType = "cluster-manager" - } + clusterManagerType := config.ClusterManagerPVCType() testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, true, verificationTimeout) // Delete the Search Head Cluster @@ -166,19 +162,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t Expect(err).To(Succeed(), "Unable to delete IDXC instance", "IDXC Name", idxc) // Delete the Cluster Manager (v3 or v4) - if config.APIVersion == "v3" { - cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to GET Cluster Master instance", "Cluster Master Name", cm) - err = deployment.DeleteCR(ctx, cm) - Expect(err).To(Succeed(), "Unable to delete Cluster Master instance", "Cluster Master Name", cm) - } else { - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Unable to GET Cluster Manager instance", "Cluster Manager Name", cm) - err = deployment.DeleteCR(ctx, cm) - Expect(err).To(Succeed(), "Unable to delete Cluster Manager instance", "Cluster Manager Name", cm) - } + config.DeleteClusterManager(ctx, deployment) // Delete Monitoring Console err = deployment.GetInstance(ctx, mcRef, mc) @@ -210,11 +194,7 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes siteCount := 3 var err error - if config.APIVersion == "v3" { - err = deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) - } else { - err = deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcRef) - } + err = config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") // Ensure that the cluster-manager goes to Ready phase diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 19ca32da5..97d7624a4 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -30,42 +30,67 @@ import ( ) type LicenseTestConfig struct { - DeployStandaloneWithLM func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) - DeployMultisiteClusterWithSearchHead func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas, siteCount int, mcRef string) error - DeployLicenseManagerWithGivenSpec func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) - LicenseManagerPodName string - LicenseManagerSpecType string + *testenv.ClusterReadinessConfig + DeployLicenseManagerWithGivenSpec func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) + BuildLMAppFrameworkSpec func(testcaseEnvInst *testenv.TestCaseEnv, appFrameworkSpec enterpriseApi.AppFrameworkSpec) interface{} + LicenseManagerPodName string } func NewLicenseMasterConfig() *LicenseTestConfig { return &LicenseTestConfig{ - DeployStandaloneWithLM: func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) { - return deployment.DeployStandaloneWithLMaster(ctx, name, mcRef) - }, - DeployMultisiteClusterWithSearchHead: func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas int, siteCount int, mcRef string) error { - return deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) - }, + ClusterReadinessConfig: testenv.NewClusterReadinessConfigV3(), DeployLicenseManagerWithGivenSpec: func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) { return deployment.DeployLicenseMasterWithGivenSpec(ctx, name, spec.(enterpriseApiV3.LicenseMasterSpec)) }, - LicenseManagerPodName: testenv.LicenseMasterPod, - LicenseManagerSpecType: "v3", + BuildLMAppFrameworkSpec: func(testcaseEnvInst *testenv.TestCaseEnv, appFrameworkSpec enterpriseApi.AppFrameworkSpec) interface{} { + return enterpriseApiV3.LicenseMasterSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Volumes: []corev1.Volume{{ + Name: "licenses", + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: testcaseEnvInst.GetLMConfigMap(), + }, + }, + }, + }}, + LicenseURL: "/mnt/licenses/enterprise.lic", + Spec: enterpriseApi.Spec{ImagePullPolicy: "Always", Image: testcaseEnvInst.GetSplunkImage()}, + }, + AppFrameworkConfig: appFrameworkSpec, + } + }, + LicenseManagerPodName: testenv.LicenseMasterPod, } } func NewLicenseManagerConfig() *LicenseTestConfig { return &LicenseTestConfig{ - DeployStandaloneWithLM: func(ctx context.Context, deployment *testenv.Deployment, name string, mcRef string) (*enterpriseApi.Standalone, error) { - return deployment.DeployStandaloneWithLM(ctx, name, mcRef) - }, - DeployMultisiteClusterWithSearchHead: func(ctx context.Context, deployment *testenv.Deployment, name string, indexerReplicas int, siteCount int, mcRef string) error { - return deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) - }, + ClusterReadinessConfig: testenv.NewClusterReadinessConfigV4(), DeployLicenseManagerWithGivenSpec: func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) { return deployment.DeployLicenseManagerWithGivenSpec(ctx, name, spec.(enterpriseApi.LicenseManagerSpec)) }, - LicenseManagerPodName: testenv.LicenseManagerPod, - LicenseManagerSpecType: "v4", + BuildLMAppFrameworkSpec: func(testcaseEnvInst *testenv.TestCaseEnv, appFrameworkSpec enterpriseApi.AppFrameworkSpec) interface{} { + return enterpriseApi.LicenseManagerSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Volumes: []corev1.Volume{{ + Name: "licenses", + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: testcaseEnvInst.GetLMConfigMap(), + }, + }, + }, + }}, + LicenseURL: "/mnt/licenses/enterprise.lic", + Spec: enterpriseApi.Spec{ImagePullPolicy: "Always", Image: testcaseEnvInst.GetSplunkImage()}, + }, + AppFrameworkConfig: appFrameworkSpec, + } + }, + LicenseManagerPodName: testenv.LicenseManagerPod, } } @@ -152,7 +177,7 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") // Wait for License Manager/Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -187,7 +212,7 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) // Deploy and verify Monitoring Console @@ -267,54 +292,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment AppSources: appSourceSpec, } - var spec interface{} - if config.LicenseManagerSpecType == "v3" { - spec = enterpriseApiV3.LicenseMasterSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Volumes: []corev1.Volume{ - { - Name: "licenses", - VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: testcaseEnvInst.GetLMConfigMap(), - }, - }, - }, - }, - }, - LicenseURL: "/mnt/licenses/enterprise.lic", - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "Always", - Image: testcaseEnvInst.GetSplunkImage(), - }, - }, - AppFrameworkConfig: appFrameworkSpec, - } - } else { - spec = enterpriseApi.LicenseManagerSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Volumes: []corev1.Volume{ - { - Name: "licenses", - VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: testcaseEnvInst.GetLMConfigMap(), - }, - }, - }, - }, - }, - LicenseURL: "/mnt/licenses/enterprise.lic", - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "Always", - Image: testcaseEnvInst.GetSplunkImage(), - }, - }, - AppFrameworkConfig: appFrameworkSpec, - } - } + spec := config.BuildLMAppFrameworkSpec(testcaseEnvInst, appFrameworkSpec) // Deploy the License Manager/Master with App Framework var err error @@ -322,7 +300,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment Expect(err).To(Succeed(), "Unable to deploy LM with App framework") // Wait for License Manager/Master to be in READY status - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) // Verify apps are copied at the correct location on License Manager/Master (/etc/apps/) podName := []string{fmt.Sprintf(config.LicenseManagerPodName, deployment.GetName(), 0)} @@ -351,7 +329,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment Expect(err).To(Succeed(), "Timed out waiting for LicenseManager to reach Ready phase") // Verify LM stays in ready state - testcaseEnvInst.VerifyLicenseManagerReady(ctx, deployment) + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) // Verify apps are copied at the correct location on License Manager/Master (/etc/apps/) testcaseEnvInst.VerifyAppsCopied(ctx, deployment, testenvInstance.GetName(), podName, appListV2, true, enterpriseApi.ScopeLocal) @@ -374,10 +352,10 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn // Deploy Multisite Cluster with License Manager/Master and Search Head siteCount := 3 mcRef := deployment.GetName() - err := config.DeployMultisiteClusterWithSearchHead(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) + err := config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) // Deploy and verify Monitoring Console diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/manager_monitoring_console_test.go index 06ac78b18..861997705 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/manager_monitoring_console_test.go @@ -61,10 +61,7 @@ var _ = Describe("Monitoring Console test", func() { */ // Deploy Monitoring Console CRD - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") // Create Standalone Spec and apply standaloneOneName := deployment.GetName() @@ -262,10 +259,7 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") @@ -424,10 +418,7 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index f6eac564a..8cb6e42a1 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -63,10 +63,7 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") // Deploy and verify C3 cluster with MC testcaseEnvInst.DeployAndVerifyC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, mcName) @@ -154,10 +151,7 @@ var _ = Describe("Monitoring Console test", func() { mcName := deployment.GetName() // Deploy Monitoring Console Pod - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index 1f62e47f1..065a4a224 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -57,11 +57,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -102,11 +98,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep standalonePods = append(standalonePods, fmt.Sprintf(testenv.StandalonePod, standaloneTwoName, 0)) testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list after adding new standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -123,19 +115,16 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) testcaseEnvInst.Log.Info("Checking for Standalone One Pod in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check Standalone One Pod in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // Check Standalone Two NOT configured in MC Config Map standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneTwoName, 1, false, 0) testcaseEnvInst.Log.Info("Checking for Standalone Two Pod NOT in MC Config Map after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, false) + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, false) +} - // Check Standalone Pod TWO NOT configured in MC Peer List - testcaseEnvInst.Log.Info("Check Standalone Two Pod NOT in MC Peer list after deleting second standalone") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, false, false) +func verifyStandaloneInMC(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, pods []string, mcName string, shouldExist bool) { + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, pods, "SPLUNK_STANDALONE_URL", mcName, shouldExist) + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, pods, mcName, shouldExist, false) } diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index de1e35e4b..54aad0998 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -83,20 +83,13 @@ func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, var standalone *enterpriseApi.Standalone var err error - if config.APIVersion == "v3" { - standalone, err = deployment.DeployStandaloneWithLMaster(ctx, deployment.GetName(), mcRef) - } else { - standalone, err = deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) - } + standalone, err = config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get Current Secrets Struct namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) @@ -126,20 +119,13 @@ func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, var standalone *enterpriseApi.Standalone var err error - if config.APIVersion == "v3" { - standalone, err = deployment.DeployStandaloneWithLMaster(ctx, deployment.GetName(), mcRef) - } else { - standalone, err = deployment.DeployStandaloneWithLM(ctx, deployment.GetName(), mcRef) - } + standalone, err = config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) // Get Current Secrets Struct namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) @@ -232,10 +218,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) // Verify RF SF is met testcaseEnvInst.Log.Info("Checkin RF SF before secret change") @@ -249,12 +232,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Update Secret Value on Secret Object updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) - // Ensure that Cluster Manager goes to update phase - if config.APIVersion == "v3" { - testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - } else { - testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - } + config.VerifyClusterManagerPhaseUpdating(ctx, deployment, testcaseEnvInst) verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) @@ -291,21 +269,14 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, mcName := deployment.GetName() var err error - if config.APIVersion == "v3" { - err = deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) - } else { - err = deployment.DeployMultisiteClusterWithSearchHead(ctx, deployment.GetName(), 1, siteCount, mcName) - } + err = config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcName) Expect(err).To(Succeed(), "Unable to deploy cluster") verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) // Verify RF SF is met testcaseEnvInst.Log.Info("Checkin RF SF before secret change") @@ -319,24 +290,10 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, // Update Secret Value on Secret Object updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) - // Ensure that Cluster Manager goes to update phase - if config.APIVersion == "v3" { - testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - } else { - testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - } - - // Ensure that the cluster-manager goes to Ready phase - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - - // Wait for License Manager to be in READY status - config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - - // Ensure the indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) + config.VerifyClusterManagerPhaseUpdating(ctx, deployment, testcaseEnvInst) - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index f7dd4609f..68cbdb70f 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -18,7 +18,6 @@ import ( "fmt" "time" - enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" @@ -189,11 +188,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo siteCount := 3 var err error - if config.APIVersion == "v3" { - err = deployment.DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) - } else { - err = deployment.DeployMultisiteClusterWithSearchHeadAndIndexes(ctx, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) - } + err = config.DeployMultisiteClusterWithIndexes(ctx, deployment, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) Expect(err).To(Succeed(), "Unable to deploy cluster") verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) @@ -202,12 +197,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexName, 2000) // Get old bundle hash before adding new index - var oldBundleHash string - if config.APIVersion == "v3" { - oldBundleHash = testenv.GetClusterManagerBundleHash(ctx, deployment, "ClusterMaster") - } else { - oldBundleHash = testenv.GetClusterManagerBundleHash(ctx, deployment, "ClusterManager") - } + oldBundleHash := config.GetBundleHash(ctx, deployment) testcaseEnvInst.Log.Info("Adding new index to Cluster Manager CR") indexNameTwo := "test-index-" + testenv.RandomDNSName(3) @@ -215,21 +205,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo newIndex := []enterpriseApi.IndexSpec{testenv.GenerateIndexSpec(indexNameTwo, volName)} // Update CR with new index based on API version - if config.APIVersion == "v3" { - cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") - cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster master") - } else { - cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") - cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster manager") - } + config.AppendSmartStoreIndex(ctx, deployment, newIndex) verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index f2abb94de..57db3fc67 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -19,6 +19,7 @@ import ( "fmt" . "github.com/onsi/gomega" + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" ) @@ -56,6 +57,107 @@ func NewClusterReadinessConfigV4() *ClusterReadinessConfig { } } +// DeployStandaloneWithLM deploys a standalone with the appropriate License Manager type for +// the API version: LicenseMaster (v3) or LicenseManager (v4). +func (c *ClusterReadinessConfig) DeployStandaloneWithLM(ctx context.Context, deployment *Deployment, name, mcRef string) (*enterpriseApi.Standalone, error) { + if c.APIVersion == "v3" { + return deployment.DeployStandaloneWithLMaster(ctx, name, mcRef) + } + return deployment.DeployStandaloneWithLM(ctx, name, mcRef) +} + +// DeployMultisiteCluster deploys a multisite cluster with the appropriate Cluster Manager type +// for the API version: ClusterMaster (v3) or ClusterManager (v4). +func (c *ClusterReadinessConfig) DeployMultisiteCluster(ctx context.Context, deployment *Deployment, name string, indexerReplicas, siteCount int, mcRef string) error { + if c.APIVersion == "v3" { + return deployment.DeployMultisiteClusterMasterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) + } + return deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) +} + +// VerifyClusterManagerPhaseUpdating asserts the Cluster Manager (or ClusterMaster for v3) +// has entered the Updating phase. +func (c *ClusterReadinessConfig) VerifyClusterManagerPhaseUpdating(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + if c.APIVersion == "v3" { + testcaseEnv.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } else { + testcaseEnv.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + } +} + +// ClusterManagerPVCType returns the PVC label fragment for the Cluster Manager: +// "cluster-master" for v3, "cluster-manager" for v4. +func (c *ClusterReadinessConfig) ClusterManagerPVCType() string { + if c.APIVersion == "v3" { + return "cluster-master" + } + return "cluster-manager" +} + +// DeleteClusterManager fetches and deletes the Cluster Manager CR for the appropriate API version. +func (c *ClusterReadinessConfig) DeleteClusterManager(ctx context.Context, deployment *Deployment) { + name := deployment.GetName() + if c.APIVersion == "v3" { + cm := &enterpriseApiV3.ClusterMaster{} + err := deployment.GetInstance(ctx, name, cm) + Expect(err).To(Succeed(), "Unable to GET Cluster Master instance", "Cluster Master Name", cm) + err = deployment.DeleteCR(ctx, cm) + Expect(err).To(Succeed(), "Unable to delete Cluster Master instance", "Cluster Master Name", cm) + } else { + cm := &enterpriseApi.ClusterManager{} + err := deployment.GetInstance(ctx, name, cm) + Expect(err).To(Succeed(), "Unable to GET Cluster Manager instance", "Cluster Manager Name", cm) + err = deployment.DeleteCR(ctx, cm) + Expect(err).To(Succeed(), "Unable to delete Cluster Manager instance", "Cluster Manager Name", cm) + } +} + +// DeployMultisiteClusterWithIndexes deploys a multisite cluster with SmartStore indexes using +// the appropriate Cluster Manager type for the API version. +func (c *ClusterReadinessConfig) DeployMultisiteClusterWithIndexes(ctx context.Context, deployment *Deployment, name string, indexerReplicas, siteCount int, secretName string, smartStoreSpec enterpriseApi.SmartStoreSpec) error { + if c.APIVersion == "v3" { + return deployment.DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx, name, indexerReplicas, siteCount, secretName, smartStoreSpec) + } + return deployment.DeployMultisiteClusterWithSearchHeadAndIndexes(ctx, name, indexerReplicas, siteCount, secretName, smartStoreSpec) +} + +// GetBundleHash returns the current bundle hash for the Cluster Manager (or ClusterMaster for v3). +func (c *ClusterReadinessConfig) GetBundleHash(ctx context.Context, deployment *Deployment) string { + if c.APIVersion == "v3" { + return GetClusterManagerBundleHash(ctx, deployment, "ClusterMaster") + } + return GetClusterManagerBundleHash(ctx, deployment, "ClusterManager") +} + +// AppendSmartStoreIndex appends a new SmartStore index to the Cluster Manager CR +// for the appropriate API version. +func (c *ClusterReadinessConfig) AppendSmartStoreIndex(ctx context.Context, deployment *Deployment, newIndex []enterpriseApi.IndexSpec) { + name := deployment.GetName() + if c.APIVersion == "v3" { + cm := &enterpriseApiV3.ClusterMaster{} + err := deployment.GetInstance(ctx, name, cm) + Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") + cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) + err = deployment.UpdateCR(ctx, cm) + Expect(err).To(Succeed(), "Failed to add new index to cluster master") + } else { + cm := &enterpriseApi.ClusterManager{} + err := deployment.GetInstance(ctx, name, cm) + Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) + err = deployment.UpdateCR(ctx, cm) + Expect(err).To(Succeed(), "Failed to add new index to cluster manager") + } +} + +// DeployMCAndGetVersion deploys and verifies a Monitoring Console, then returns both the MC +// instance and its current resource version. +func (testcaseenv *TestCaseEnv) DeployMCAndGetVersion(ctx context.Context, deployment *Deployment, name string, lmRef string) (*enterpriseApi.MonitoringConsole, string) { + mc := testcaseenv.DeployAndVerifyMonitoringConsole(ctx, deployment, name, lmRef) + resourceVersion := testcaseenv.GetResourceVersion(ctx, deployment, mc) + return mc, resourceVersion +} + // DeployAndVerifyStandalone deploys a standalone instance and verifies it reaches ready state func (testcaseenv *TestCaseEnv) DeployAndVerifyStandalone(ctx context.Context, deployment *Deployment, name string, mcRef string, licenseManagerRef string) *enterpriseApi.Standalone { standalone, err := deployment.DeployStandalone(ctx, name, mcRef, licenseManagerRef) From 62a3623b12cf8edb9c67c1b1e54c372d63046aaf Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Wed, 25 Mar 2026 11:37:11 +0100 Subject: [PATCH 16/20] CSPL-3775 Each test case delegates to a shared Run*Test function, keeping the test file as a thin dispatch layer --- test/custom_resource_crud/crud_test_shared.go | 78 ++- .../custom_resource_crud_c3_test.go | 59 --- .../custom_resource_crud_m4_test.go | 48 -- .../custom_resource_crud_s1_test.go | 47 -- .../custom_resource_crud_test.go | 132 +++++ .../manager_custom_resource_crud_c3_test.go | 116 ----- .../manager_custom_resource_crud_m4_test.go | 48 -- .../index_and_ingestion_separation_test.go | 59 +-- ...manager_lm_c3_test.go => lm_appfw_test.go} | 8 +- test/licensemanager/lm_s1_test.go | 45 -- .../{manager_lm_m4_test.go => lm_test.go} | 14 +- test/licensemanager/lm_test_shared.go | 58 +-- .../{lm_c3_test.go => lm_appfw_test.go} | 9 +- test/licensemaster/lm_s1_test.go | 47 -- .../{lm_m4_test.go => lm_test.go} | 13 +- ..._monitoring_console_test.go => mc_test.go} | 450 +++++++++++------- .../monitoring_console_test.go | 408 ---------------- .../monitoring_console_test_shared.go | 142 ++++++ test/secret/manager_secret_c3_test.go | 44 -- test/secret/manager_secret_m4_test.go | 45 -- test/secret/manager_secret_s1_test.go | 58 --- test/secret/secret_c3_test.go | 44 -- test/secret/secret_m4_test.go | 46 -- test/secret/secret_s1_test.go | 58 --- test/secret/secret_test.go | 117 +++++ test/secret/secret_test_shared.go | 34 +- test/smartstore/manager_smartstore_test.go | 44 -- test/smartstore/smartstore_test.go | 69 ++- 28 files changed, 871 insertions(+), 1469 deletions(-) delete mode 100644 test/custom_resource_crud/custom_resource_crud_c3_test.go delete mode 100644 test/custom_resource_crud/custom_resource_crud_m4_test.go delete mode 100644 test/custom_resource_crud/custom_resource_crud_s1_test.go create mode 100644 test/custom_resource_crud/custom_resource_crud_test.go delete mode 100644 test/custom_resource_crud/manager_custom_resource_crud_c3_test.go delete mode 100644 test/custom_resource_crud/manager_custom_resource_crud_m4_test.go rename test/licensemanager/{manager_lm_c3_test.go => lm_appfw_test.go} (79%) delete mode 100644 test/licensemanager/lm_s1_test.go rename test/licensemanager/{manager_lm_m4_test.go => lm_test.go} (72%) rename test/licensemaster/{lm_c3_test.go => lm_appfw_test.go} (80%) delete mode 100644 test/licensemaster/lm_s1_test.go rename test/licensemaster/{lm_m4_test.go => lm_test.go} (72%) rename test/monitoring_console/{manager_monitoring_console_test.go => mc_test.go} (66%) delete mode 100644 test/monitoring_console/monitoring_console_test.go delete mode 100644 test/secret/manager_secret_c3_test.go delete mode 100644 test/secret/manager_secret_m4_test.go delete mode 100644 test/secret/manager_secret_s1_test.go delete mode 100644 test/secret/secret_c3_test.go delete mode 100644 test/secret/secret_m4_test.go delete mode 100644 test/secret/secret_s1_test.go create mode 100644 test/secret/secret_test.go delete mode 100644 test/smartstore/manager_smartstore_test.go diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index e2dfd70d1..462696759 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -134,18 +134,8 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, "") - // Verify Search Heads PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, true, verificationTimeout) - - // Verify Deployer PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, true, verificationTimeout) - - // Verify Indexers PVCs (etc and var) exists - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, true, verificationTimeout) - - // Verify Cluster Manager PVCs (etc and var) exists clusterManagerType := config.ClusterManagerPVCType() - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, true, verificationTimeout) + verifyC3ClusterPVCs(testcaseEnvInst, deployment, clusterManagerType, true, verificationTimeout) // Delete the Search Head Cluster shc := &enterpriseApi.SearchHeadCluster{} @@ -170,20 +160,66 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t err = deployment.DeleteCR(ctx, mc) Expect(err).To(Succeed(), "Unable to delete Monitoring Console instance", "Monitoring Console Name", mcRef) - // Verify Search Heads PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, false, verificationTimeout) + verifyC3ClusterPVCs(testcaseEnvInst, deployment, clusterManagerType, false, verificationTimeout) - // Verify Deployer PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, false, verificationTimeout) + // Verify Monitoring Console PVCs (etc and var) have been deleted + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) +} - // Verify Indexers PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, false, verificationTimeout) +func verifyC3ClusterPVCs(testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, clusterManagerType string, exists bool, timeout time.Duration) { + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, exists, timeout) + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, exists, timeout) + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "idxc-indexer", 3, exists, timeout) + testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, exists, timeout) +} - // Verify Cluster Manager PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, clusterManagerType, 1, false, verificationTimeout) +// RunSHCDeployerResourceSpecTest deploys a Search Head Cluster, verifies default CPU limits, +// updates the deployer resource spec, and verifies the deployer is reconfigured while search heads retain defaults. +func RunSHCDeployerResourceSpecTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, defaultCPULimits string) { + shcName := fmt.Sprintf("%s-shc", deployment.GetName()) + _, err := deployment.DeploySearchHeadCluster(ctx, shcName, "", "", "", "") + if err != nil { + Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster", "shc", shcName) + } - // Verify Monitoring Console PVCs (etc and var) have been deleted - testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) + // Verify CPU limits on Search Heads and deployer before updating CR + searchHeadCount := 3 + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) + + DeployerPodName := fmt.Sprintf(testenv.DeployerPod, deployment.GetName()) + testcaseEnvInst.VerifyCPULimits(deployment, DeployerPodName, defaultCPULimits) + + shc := &enterpriseApi.SearchHeadCluster{} + testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Unable to fetch Search Head Cluster deployment") + + // Assign new resources for deployer pod only + newCPULimits := "4" + newCPURequests := "2" + newMemoryLimits := "14Gi" + newMemoryRequests := "12Gi" + + depResSpec := corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + "cpu": resource.MustParse(newCPURequests), + "memory": resource.MustParse(newMemoryRequests), + }, + Limits: corev1.ResourceList{ + "cpu": resource.MustParse(newCPULimits), + "memory": resource.MustParse(newMemoryLimits), + }, + } + shc.Spec.DeployerResourceSpec = depResSpec + + testenv.UpdateCRWithExpect(ctx, deployment, shc, "Unable to deploy Search Head Cluster with updated CR") + + // Verify Search Head go to ready state + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify CPU limits on Search Heads - Should be same as before + testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) + + // Verify modified deployer spec + testcaseEnvInst.VerifyResourceConstraints(deployment, DeployerPodName, depResSpec) } // RunM4CPUUpdateTest runs the standard M4 CPU limit update test workflow diff --git a/test/custom_resource_crud/custom_resource_crud_c3_test.go b/test/custom_resource_crud/custom_resource_crud_c3_test.go deleted file mode 100644 index fc8d3c9db..000000000 --- a/test/custom_resource_crud/custom_resource_crud_c3_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package crcrud - -import ( - "context" - "time" - - . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Crcrud test for SVA C3", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var defaultCPULimits string - var newCPULimits string - var verificationTimeout time.Duration - - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - defaultCPULimits = DefaultCPULimits - newCPULimits = UpdatedCPULimits - verificationTimeout = DefaultVerificationTimeout - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("mastercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - config := testenv.NewClusterReadinessConfigV3() - RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) - }) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("mastercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - config := testenv.NewClusterReadinessConfigV3() - RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) - }) - }) -}) diff --git a/test/custom_resource_crud/custom_resource_crud_m4_test.go b/test/custom_resource_crud/custom_resource_crud_m4_test.go deleted file mode 100644 index 6f79989b0..000000000 --- a/test/custom_resource_crud/custom_resource_crud_m4_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package crcrud - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Crcrud test for SVA M4", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var defaultCPULimits string - var newCPULimits string - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - defaultCPULimits = DefaultCPULimits - newCPULimits = UpdatedCPULimits - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { - It("mastercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - config := testenv.NewClusterReadinessConfigV3() - RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) - }) - }) -}) diff --git a/test/custom_resource_crud/custom_resource_crud_s1_test.go b/test/custom_resource_crud/custom_resource_crud_s1_test.go deleted file mode 100644 index d3f968bcd..000000000 --- a/test/custom_resource_crud/custom_resource_crud_s1_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package crcrud - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Crcrud test for SVA S1", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var defaultCPULimits string - var newCPULimits string - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - defaultCPULimits = DefaultCPULimits - newCPULimits = UpdatedCPULimits - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone deployment (S1)", func() { - It("managercrcrud, integration, s1: can deploy a standalone instance, change its CR, update the instance", func() { - RunS1CPUUpdateTest(ctx, deployment, testcaseEnvInst, defaultCPULimits, newCPULimits) - }) - }) -}) diff --git a/test/custom_resource_crud/custom_resource_crud_test.go b/test/custom_resource_crud/custom_resource_crud_test.go new file mode 100644 index 000000000..766a89b1b --- /dev/null +++ b/test/custom_resource_crud/custom_resource_crud_test.go @@ -0,0 +1,132 @@ +// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package crcrud + +import ( + "context" + "time" + + . "github.com/onsi/ginkgo/v2" + "github.com/splunk/splunk-operator/test/testenv" +) + +var _ = Describe("Crcrud test", func() { + + var testcaseEnvInst *testenv.TestCaseEnv + var deployment *testenv.Deployment + var defaultCPULimits string + var newCPULimits string + var verificationTimeout time.Duration + + ctx := context.TODO() + + // S1 test — single variant (manager, V4) + Context("Standalone deployment (S1)", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It("managercrcrud, integration, s1: can deploy a standalone instance, change its CR, update the instance", func() { + RunS1CPUUpdateTest(ctx, deployment, testcaseEnvInst, defaultCPULimits, newCPULimits) + }) + }) + + // C3 tests — V3 (master) and V4 (manager) variants + c3CrudConfigs := []struct { + namePrefix string + label string + newConfig func() *testenv.ClusterReadinessConfig + }{ + {"master", "mastercrcrud", testenv.NewClusterReadinessConfigV3}, + {"", "managercrcrud", testenv.NewClusterReadinessConfigV4}, + } + + for _, tc := range c3CrudConfigs { + tc := tc + Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + BeforeEach(func() { + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits + verificationTimeout = DefaultVerificationTimeout + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(tc.label+", integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { + config := tc.newConfig() + RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) + }) + + It(tc.label+", integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { + config := tc.newConfig() + RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) + }) + }) + } + + // CSPL-3256 - SHC deployer resource spec test (IDXC is irrelevant for this test case) + Context("Search Head Cluster", func() { + BeforeEach(func() { + defaultCPULimits = DefaultCPULimits + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It("managercrcrud, integration, shc: can deploy Search Head Cluster with Deployer resource spec configured", func() { + RunSHCDeployerResourceSpecTest(ctx, deployment, testcaseEnvInst, defaultCPULimits) + }) + }) + + // M4 tests — V3 (master) and V4 (manager) variants + m4CrudConfigs := []struct { + namePrefix string + label string + newConfig func() *testenv.ClusterReadinessConfig + }{ + {"master", "mastercrcrud", testenv.NewClusterReadinessConfigV3}, + {"", "managercrcrud", testenv.NewClusterReadinessConfigV4}, + } + + for _, tc := range m4CrudConfigs { + tc := tc + Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { + BeforeEach(func() { + defaultCPULimits = DefaultCPULimits + newCPULimits = UpdatedCPULimits + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(tc.label+", integration, m4: can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { + config := tc.newConfig() + RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) + }) + }) + } +}) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go b/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go deleted file mode 100644 index 416537e47..000000000 --- a/test/custom_resource_crud/manager_custom_resource_crud_c3_test.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package crcrud - -import ( - "context" - "fmt" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Crcrud test for SVA C3", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var defaultCPULimits string - var newCPULimits string - var verificationTimeout time.Duration - - ctx := context.TODO() - - BeforeEach(func() { - defaultCPULimits = DefaultCPULimits - newCPULimits = UpdatedCPULimits - verificationTimeout = DefaultVerificationTimeout - - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("managercrcrud, integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { - config := testenv.NewClusterReadinessConfigV4() - RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) - }) - }) - - Context("Search Head Cluster", func() { - // CSPL-3256 - Adding the SHC only test case under c3 as IDXC is irrelevant for this test case - It("managercrcrud, integration, shc: can deploy Search Head Cluster with Deployer resource spec configured", func() { - shcName := fmt.Sprintf("%s-shc", deployment.GetName()) - _, err := deployment.DeploySearchHeadCluster(ctx, shcName, "", "", "", "") - if err != nil { - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster", "Shc", shcName) - } - - // Verify CPU limits on Search Heads and deployer before updating CR - searchHeadCount := 3 - testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) - - DeployerPodName := fmt.Sprintf(testenv.DeployerPod, deployment.GetName()) - testcaseEnvInst.VerifyCPULimits(deployment, DeployerPodName, defaultCPULimits) - - shc := &enterpriseApi.SearchHeadCluster{} - testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Unable to fetch Search Head Cluster deployment") - - // Assign new resources for deployer pod only - newCPULimits = "4" - newCPURequests := "2" - newMemoryLimits := "14Gi" - newMemoryRequests := "12Gi" - - depResSpec := corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - "cpu": resource.MustParse(newCPURequests), - "memory": resource.MustParse(newMemoryRequests), - }, - Limits: corev1.ResourceList{ - "cpu": resource.MustParse(newCPULimits), - "memory": resource.MustParse(newMemoryLimits), - }, - } - shc.Spec.DeployerResourceSpec = depResSpec - - testenv.UpdateCRWithExpect(ctx, deployment, shc, "Unable to deploy Search Head Cluster with updated CR") - - // Verify Search Head go to ready state - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify CPU limits on Search Heads - Should be same as before - searchHeadCount = 3 - testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) - - // Verify modified deployer spec - testcaseEnvInst.VerifyResourceConstraints(deployment, DeployerPodName, depResSpec) - }) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("managercrcrud, integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - config := testenv.NewClusterReadinessConfigV4() - RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) - }) - }) -}) diff --git a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go b/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go deleted file mode 100644 index 30c894940..000000000 --- a/test/custom_resource_crud/manager_custom_resource_crud_m4_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package crcrud - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Crcrud test for SVA M4", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var defaultCPULimits string - var newCPULimits string - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - defaultCPULimits = DefaultCPULimits - newCPULimits = UpdatedCPULimits - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { - It("managercrcrud, integration, m4: can deploy can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { - config := testenv.NewClusterReadinessConfigV4() - RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) - }) - }) -}) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index a78fdd467..b3e047524 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -65,33 +65,7 @@ var _ = Describe("indingsep test", func() { setupIngestorStack(ctx, deployment, testcaseEnvInst, queue, objectStorage, cmSpec) - // Delete the Indexer Cluster - idxc := &enterpriseApi.IndexerCluster{} - err := deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) - Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance", "Indexer Cluster Name", idxc) - err = deployment.DeleteCR(ctx, idxc) - Expect(err).To(Succeed(), "Unable to delete Indexer Cluster instance", "Indexer Cluster Name", idxc) - - // Delete the Ingestor Cluster - ingest := &enterpriseApi.IngestorCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) - Expect(err).To(Succeed(), "Unable to get Ingestor Cluster instance", "Ingestor Cluster Name", ingest) - err = deployment.DeleteCR(ctx, ingest) - Expect(err).To(Succeed(), "Unable to delete Ingestor Cluster instance", "Ingestor Cluster Name", ingest) - - // Delete the Queue - q := &enterpriseApi.Queue{} - err = deployment.GetInstance(ctx, "queue", q) - Expect(err).To(Succeed(), "Unable to get Queue instance", "Queue Name", q) - err = deployment.DeleteCR(ctx, q) - Expect(err).To(Succeed(), "Unable to delete Queue", "Queue Name", q) - - // Delete the ObjectStorage - objStorage := &enterpriseApi.ObjectStorage{} - err = deployment.GetInstance(ctx, "os", objStorage) - Expect(err).To(Succeed(), "Unable to get ObjectStorage instance", "ObjectStorage Name", objStorage) - err = deployment.DeleteCR(ctx, objStorage) - Expect(err).To(Succeed(), "Unable to delete ObjectStorage", "ObjectStorage Name", objStorage) + deleteIngestorStack(ctx, deployment) }) }) @@ -312,3 +286,34 @@ func setupIngestorStack(ctx context.Context, deployment *testenv.Deployment, tes testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) } + +// deleteIngestorStack tears down the full Queue/ObjectStorage/IngestorCluster/IndexerCluster stack. +func deleteIngestorStack(ctx context.Context, deployment *testenv.Deployment) { + // Delete the Indexer Cluster + idxc := &enterpriseApi.IndexerCluster{} + err := deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) + Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance", "Indexer Cluster Name", idxc) + err = deployment.DeleteCR(ctx, idxc) + Expect(err).To(Succeed(), "Unable to delete Indexer Cluster instance", "Indexer Cluster Name", idxc) + + // Delete the Ingestor Cluster + ingest := &enterpriseApi.IngestorCluster{} + err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) + Expect(err).To(Succeed(), "Unable to get Ingestor Cluster instance", "Ingestor Cluster Name", ingest) + err = deployment.DeleteCR(ctx, ingest) + Expect(err).To(Succeed(), "Unable to delete Ingestor Cluster instance", "Ingestor Cluster Name", ingest) + + // Delete the Queue + q := &enterpriseApi.Queue{} + err = deployment.GetInstance(ctx, "queue", q) + Expect(err).To(Succeed(), "Unable to get Queue instance", "Queue Name", q) + err = deployment.DeleteCR(ctx, q) + Expect(err).To(Succeed(), "Unable to delete Queue", "Queue Name", q) + + // Delete the ObjectStorage + objStorage := &enterpriseApi.ObjectStorage{} + err = deployment.GetInstance(ctx, "os", objStorage) + Expect(err).To(Succeed(), "Unable to get ObjectStorage instance", "ObjectStorage Name", objStorage) + err = deployment.DeleteCR(ctx, objStorage) + Expect(err).To(Succeed(), "Unable to delete ObjectStorage", "ObjectStorage Name", objStorage) +} diff --git a/test/licensemanager/manager_lm_c3_test.go b/test/licensemanager/lm_appfw_test.go similarity index 79% rename from test/licensemanager/manager_lm_c3_test.go rename to test/licensemanager/lm_appfw_test.go index 027434849..547603f9f 100644 --- a/test/licensemanager/manager_lm_c3_test.go +++ b/test/licensemanager/lm_appfw_test.go @@ -20,7 +20,7 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("Licensemanager test", func() { +var _ = Describe("Licensemanager App Framework test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -37,12 +37,6 @@ var _ = Describe("Licensemanager test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Manager", func() { - It("licensemanager, integration, c3: Splunk Operator can configure License Manager with Indexers and Search Heads in C3 SVA", func() { - RunLMC3Test(ctx, deployment, testcaseEnvInst, config) - }) - }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Manager", func() { It("licensemanager, integration, c3: Splunk Operator can configure a C3 SVA and have apps installed locally on LM", func() { RunLMC3AppFrameworkTest(ctx, deployment, testcaseEnvInst, testenvInstance, config) diff --git a/test/licensemanager/lm_s1_test.go b/test/licensemanager/lm_s1_test.go deleted file mode 100644 index 6969505cb..000000000 --- a/test/licensemanager/lm_s1_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package licensemanager - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Licensemanager test", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var config *LicenseTestConfig - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - - config = NewLicenseManagerConfig() - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone deployment (S1) with License Manager", func() { - It("licensemanager, smoke, s1: Splunk Operator can configure License Manager with Standalone in S1 SVA", func() { - RunLMS1Test(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/licensemanager/manager_lm_m4_test.go b/test/licensemanager/lm_test.go similarity index 72% rename from test/licensemanager/manager_lm_m4_test.go rename to test/licensemanager/lm_test.go index 117bea76d..88200fb8c 100644 --- a/test/licensemanager/manager_lm_m4_test.go +++ b/test/licensemanager/lm_test.go @@ -17,7 +17,6 @@ import ( "context" . "github.com/onsi/ginkgo/v2" - "github.com/splunk/splunk-operator/test/testenv" ) @@ -38,10 +37,21 @@ var _ = Describe("Licensemanager test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) + Context("Standalone deployment (S1) with License Manager", func() { + It("licensemanager, smoke, s1: Splunk Operator can configure License Manager with Standalone in S1 SVA", func() { + RunLMS1Test(ctx, deployment, testcaseEnvInst, config) + }) + }) + + Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Manager", func() { + It("licensemanager, integration, c3: Splunk Operator can configure License Manager with Indexers and Search Heads in C3 SVA", func() { + RunLMC3Test(ctx, deployment, testcaseEnvInst, config) + }) + }) + Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster) with License Manager", func() { It("licensemanager, integration, m4: Splunk Operator can configure License Manager with indexers and search head in M4 SVA", func() { RunLMM4Test(ctx, deployment, testcaseEnvInst, config) }) }) - }) diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 97d7624a4..96869f1ca 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -94,30 +94,6 @@ func NewLicenseManagerConfig() *LicenseTestConfig { } } -func downloadLicenseAndCreateConfigMap(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv) { - downloadDir := "licenseFolder" - - var err error - var licenseFilePath string - - switch testenv.ClusterProvider { - case "eks": - licenseFilePath, err = testenv.DownloadLicenseFromS3Bucket() - Expect(err).To(Succeed(), "Unable to download license file from S3") - case "azure": - licenseFilePath, err = testenv.DownloadLicenseFromAzure(ctx, downloadDir) - Expect(err).To(Succeed(), "Unable to download license file from Azure") - case "gcp": - licenseFilePath, err = testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from GCP") - default: - fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) - } - - testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) -} - func downloadAppFiles(ctx context.Context, testDataS3Bucket, azureDataContainer, appDir, downloadDir string, appFileList []string, version string) { switch testenv.ClusterProvider { case "eks": @@ -169,7 +145,7 @@ func deleteUploadedFiles(ctx context.Context, testS3Bucket string, uploadedApps func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { // Download License File - downloadLicenseAndCreateConfigMap(ctx, testcaseEnvInst) + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create standalone Deployment with License Manager/Master mcRef := deployment.GetName() @@ -205,7 +181,7 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { // Download License File - downloadLicenseAndCreateConfigMap(ctx, testcaseEnvInst) + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Deploy Single site Cluster with License Manager/Master mcRef := deployment.GetName() @@ -215,19 +191,13 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - // Deploy and verify Monitoring Console - _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) // Verify License Manager/Master is configured on indexers and search heads testenv.VerifyLMConfiguredOnIndexers(ctx, deployment, deployment.GetName(), 3) testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) - // Verify License Manager/Master is configured on Monitoring Console - monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, monitoringConsolePodName) + verifyLMConfiguredOnMC(ctx, deployment) } func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, testenvInstance *testenv.TestEnv, config *LicenseTestConfig) { @@ -260,7 +230,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment uploadedApps = append(uploadedApps, uploadedFiles...) // Download License File - downloadLicenseAndCreateConfigMap(ctx, testcaseEnvInst) + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create App framework Spec volumeName := "lm-test-volume-" + testenv.RandomDNSName(3) @@ -347,7 +317,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { // Download License File - downloadLicenseAndCreateConfigMap(ctx, testcaseEnvInst) + testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Deploy Multisite Cluster with License Manager/Master and Search Head siteCount := 3 @@ -358,17 +328,21 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - // Deploy and verify Monitoring Console - _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) // Verify License Manager/Master is configured on indexers and search heads testenv.VerifyLMConfiguredOnMultisiteIndexers(ctx, deployment, deployment.GetName(), siteCount) testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) - // Verify License Manager/Master is configured on Monitoring Console + verifyLMConfiguredOnMC(ctx, deployment) +} + +func deployMCAndVerifyRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, mcRef string) { + _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) +} + +func verifyLMConfiguredOnMC(ctx context.Context, deployment *testenv.Deployment) { monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) testenv.VerifyLMConfiguredOnPod(ctx, deployment, monitoringConsolePodName) } diff --git a/test/licensemaster/lm_c3_test.go b/test/licensemaster/lm_appfw_test.go similarity index 80% rename from test/licensemaster/lm_c3_test.go rename to test/licensemaster/lm_appfw_test.go index 89f9107cd..123054338 100644 --- a/test/licensemaster/lm_c3_test.go +++ b/test/licensemaster/lm_appfw_test.go @@ -17,11 +17,12 @@ import ( "context" . "github.com/onsi/ginkgo/v2" + "github.com/splunk/splunk-operator/test/licensemanager" "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("licensemaster test", func() { +var _ = Describe("Licensemaster App Framework test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -38,12 +39,6 @@ var _ = Describe("licensemaster test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Master", func() { - It("licensemaster, integration, c3: Splunk Operator can configure License Master with Indexers and Search Heads in C3 SVA", func() { - licensemanager.RunLMC3Test(ctx, deployment, testcaseEnvInst, config) - }) - }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Master", func() { It("licensemaster, integration, c3: Splunk Operator can configure a C3 SVA and have apps installed locally on LM", func() { licensemanager.RunLMC3AppFrameworkTest(ctx, deployment, testcaseEnvInst, testenvInstance, config) diff --git a/test/licensemaster/lm_s1_test.go b/test/licensemaster/lm_s1_test.go deleted file mode 100644 index b3cf5fc0c..000000000 --- a/test/licensemaster/lm_s1_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package licensemaster - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/licensemanager" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Licensemaster test", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - var config *licensemanager.LicenseTestConfig - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - config = licensemanager.NewLicenseMasterConfig() - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone deployment (S1) with License Master", func() { - It("licensemaster, smoke, s1: Splunk Operator can configure License Master with Standalone in S1 SVA", func() { - licensemanager.RunLMS1Test(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/licensemaster/lm_m4_test.go b/test/licensemaster/lm_test.go similarity index 72% rename from test/licensemaster/lm_m4_test.go rename to test/licensemaster/lm_test.go index 1b2059c95..c0d4911fb 100644 --- a/test/licensemaster/lm_m4_test.go +++ b/test/licensemaster/lm_test.go @@ -39,10 +39,21 @@ var _ = Describe("Licensemaster test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) + Context("Standalone deployment (S1) with License Master", func() { + It("licensemaster, smoke, s1: Splunk Operator can configure License Master with Standalone in S1 SVA", func() { + licensemanager.RunLMS1Test(ctx, deployment, testcaseEnvInst, config) + }) + }) + + Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Master", func() { + It("licensemaster, integration, c3: Splunk Operator can configure License Master with Indexers and Search Heads in C3 SVA", func() { + licensemanager.RunLMC3Test(ctx, deployment, testcaseEnvInst, config) + }) + }) + Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster) with License Master", func() { It("licensemaster, integration, m4: Splunk Operator can configure License Master with indexers and search head in M4 SVA", func() { licensemanager.RunLMM4Test(ctx, deployment, testcaseEnvInst, config) }) }) - }) diff --git a/test/monitoring_console/manager_monitoring_console_test.go b/test/monitoring_console/mc_test.go similarity index 66% rename from test/monitoring_console/manager_monitoring_console_test.go rename to test/monitoring_console/mc_test.go index 861997705..1471788ac 100644 --- a/test/monitoring_console/manager_monitoring_console_test.go +++ b/test/monitoring_console/mc_test.go @@ -18,17 +18,290 @@ import ( "fmt" "time" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" - corev1 "k8s.io/api/core/v1" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" + splcommon "github.com/splunk/splunk-operator/pkg/splunk/common" "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("Monitoring Console test", func() { +// Master (V3) Monitoring Console tests +var _ = Describe("Monitoring Console test (master)", func() { + + var testcaseEnvInst *testenv.TestCaseEnv + var deployment *testenv.Deployment + ctx := context.TODO() + + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + It("mastermc, smoke: MC can configure SHC, indexer instances after scale up and standalone in a namespace", func() { + /* + Test Steps + 1. Deploy Single Site Indexer Cluster + 2. Deploy Monitoring Console + 3. Wait for Monitoring Console status to go back to READY + 4. Verify SH are configured in MC Config Map + 5. VerifyMonitoring Console Pod has Search Heads in Peer strings + 6. Verify Monitoring Console Pod has peers(indexers) in Peer string + 7. Scale SH Cluster + 8. Scale Indexer Count + 9. Add a standalone + 10. Verify Standalone is configured in MC Config Map and Peer String + 11. Verify SH are configured in MC Config Map and Peers String + 12. Verify Indexers are configured in Peer String + */ + + defaultSHReplicas := 3 + defaultIndexerReplicas := 3 + mcName := deployment.GetName() + + // Deploy and verify Monitoring Console + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") + + // Deploy and verify C3 cluster with MC + testcaseEnvInst.DeployAndVerifyC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, mcName) + + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) + + // Wait for Cluster Master to appear in Monitoring Console Config Map + err := testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true, 2*time.Minute) + Expect(err).To(Succeed(), "Timed out waiting for Cluster Master in MC ConfigMap") + + // Verify MC configuration for C3 cluster + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) + + // Scale Search Head Cluster + scaledSHReplicas := defaultSHReplicas + 1 + testcaseEnvInst.Log.Info("Scaling up Search Head Cluster", "Current Replicas", defaultSHReplicas, "New Replicas", scaledSHReplicas) + testcaseEnvInst.ScaleSearchHeadCluster(ctx, deployment, deployment.GetName(), scaledSHReplicas) + + // Scale indexers + scaledIndexerReplicas := defaultIndexerReplicas + 1 + testcaseEnvInst.Log.Info("Scaling up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) + testcaseEnvInst.ScaleIndexerCluster(ctx, deployment, deployment.GetName(), scaledIndexerReplicas) + + // get revision number of the resource + resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) + + // Deploy Standalone with MC reference + testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) + + // Ensure Indexer cluster go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Ensure Search Head Cluster go to Ready Phase + // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) + + // Wait for MC to go to PENDING Phase + //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhasePending) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Verify Standalone configured on Monitoring Console + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, deployment.GetName(), mcName, true) + + // Verify MC configuration after scale up + testcaseEnvInst.Log.Info("Verify MC configuration after Scale Up") + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, scaledSHReplicas, scaledIndexerReplicas, true) + }) + }) + + Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { + /* + Test Steps + 1. Deploy Single Site Indexer Cluster + 2. Deploy Monitoring Console + 3. Wait for Monitoring Console status to go back to READY + 4. Verify SH are configured in MC Config Map + 5. Verify SH are configured in peer strings on MC Pod + 6. Verify Monitoring Console Pod has peers in Peer string on MC Pod + --------------- RECONFIG CLUSTER MANAGER WITH NEW MC -------------------------- + 13. Reconfigure CM with Second MC + 14. Verify CM in config map of Second MC + 15. Create Second MC Pod + 16. Verify Indexers in second MC Pod + 17. Verify SHC not in second MC + 18. Verify SHC still present in first MC d + 19. Veirfy CM and Indexers not in first MC Pod + ---------------- RECONFIG SHC WITH NEW MC + 20. Configure SHC with Second MC + 21. Verify CM, DEPLOYER, Search Heads in config map of seconds MC + 22. Verify SHC in second MC pod + 23. Verify Indexers in Second MC Pod + 24. Verify CM and Deployer not in first MC CONFIG MAP + 24. Verify SHC, Indexers not in first MC Pod + */ + + defaultSHReplicas := 3 + defaultIndexerReplicas := 3 + mcName := deployment.GetName() + + // Deploy Monitoring Console Pod + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") + + err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) + Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") + + // Ensure that the cluster-master goes to Ready phase + testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) + + // Verify MC configuration for C3 cluster + testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // Generate pod name slices for later verification + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) + indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) + + // ################# Update Monitoring Console In Cluster Master CR ################################## + + mcTwoName := deployment.GetName() + "-two" + cm := &enterpriseApiV3.ClusterMaster{} + err = deployment.GetInstance(ctx, deployment.GetName(), cm) + Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + + // get revision number of the resource + resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) + + cm.Spec.MonitoringConsoleRef.Name = mcTwoName + err = deployment.UpdateCR(ctx, cm) + + Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") + + // wait for custom resource resource version to change + testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) + + // Ensure Cluster Master Goes to Updating Phase + //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + + // Ensure that the cluster-master goes to Ready phase + testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + + // Ensure indexers go to Ready phase + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Deploy and verify Monitoring Console Two + mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") + + // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### + masterParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"} + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, true) + + // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, false) + + // ################# Update Monitoring Console In SHC CR ################################## + + // Update SHC to use 2nd Monitoring Console + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) + + // Ensure Search Head Cluster go to Ready Phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + // Verify MC is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + + // ############################ VERIFICATOIN FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### + VerifyMCTwoAfterSHCReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, 0) + + // ############################ VERIFICATOIN FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### + VerifyMCOneAfterSHCReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, 0) + }) + }) + + Context("Multisite Clustered deployment (M4 - 3 Site clustered indexer, search head cluster)", func() { + It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { + /* + Test Steps + 1. Deploy Multisite Indexer Cluster + 2. Deploy Monitoring Console + 3. Wait for Monitoring Console status to go back to READY + 4. Verify SH are configured in MC Config Map + 5. Verify SH are configured in peer strings on MC Pod + 6. Verify Indexers are configured in MC Config Map + 7. Verify Monitoring Console Pod has peers in Peer string on MC Pod + ############ CLUSTER MANAGER MC RECONFIG ################################# + 8. Configure Cluster Master to use 2nd Monitoring Console + 9. Verify Cluster Master is configured Config Maps of Second MC + 10. Deploy 2nd MC pod + 11. Verify Indexers in 2nd MC Pod + 12. Verify SHC not in 2nd MC CM + 13. Verify SHC not in 2nd MC Pod + 14. Verify Cluster Master not 1st MC Config Map + 15. Verify Indexers not in 1st MC Pod + */ + defaultSHReplicas := 3 + defaultIndexerReplicas := 1 + siteCount := 3 + mcName := deployment.GetName() + err := deployment.DeployMultisiteClusterMasterWithMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, siteCount, mcName, true) + Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with SHC") + + // Ensure that the cluster-master goes to Ready phase + testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) + + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") + + // Verify MC configuration for M4 cluster + testcaseEnvInst.VerifyMCConfigForM4Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, siteCount, true) + + // Generate pod name slices for later verification + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) + indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), defaultIndexerReplicas, true, siteCount) + + // ############ CLUSTER MANAGER MC RECONFIG ################################# + mcTwoName := deployment.GetName() + "-two" + // Update Cluster Manager to use 2nd Monitoring Console + cm := &enterpriseApiV3.ClusterMaster{} + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) + + // Ensure Cluster Master Goes to Updating Phase + //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) + + // Ensure that the cluster-master goes to Ready phase + testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + + // Deploy and verify Monitoring Console Two + mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") + + // Verify Monitoring Console TWO is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + + masterParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"} + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, false) + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, true) + + }) + }) +}) + +// Manager (V4) Monitoring Console tests +var _ = Describe("Monitoring Console test (manager)", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -66,18 +339,7 @@ var _ = Describe("Monitoring Console test", func() { // Create Standalone Spec and apply standaloneOneName := deployment.GetName() mcName := deployment.GetName() - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } + spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -163,18 +425,7 @@ var _ = Describe("Monitoring Console test", func() { standaloneName := deployment.GetName() mcName := deployment.GetName() - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } + spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -329,18 +580,7 @@ var _ = Describe("Monitoring Console test", func() { resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) // Deploy Standalone Pod - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } + spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -481,46 +721,11 @@ var _ = Describe("Monitoring Console test", func() { testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### - - // Check Cluster Manager in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager in Monitoring Console Two Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcTwoName, true) - - // Check Monitoring console Two is configured with all Indexer in Name Space - testcaseEnvInst.Log.Info("Verify Indexers in Monitoring Console Pod TWO Config String after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) - - // Check Deployer NOT in Monitoring Console TWO Config Map - testcaseEnvInst.Log.Info("Verify DEPLOYER NOT on Monitoring Console TWO Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, false) - - // Check Monitoring Console TWO is NOT configured with Search Head in namespace - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console TWO Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, false) - - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console TWO Pod after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, false, false) + managerParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterManagerServiceName, CMURLKey: splcommon.ClusterManagerURL} + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, true) // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### - - // Verify Monitoring Console One Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Cluster Manager Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager NOT in Monitoring Console One Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, false) - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Verify Indexers NOT in Monitoring Console One Pod Config String after Cluster Manager Reconfig") - // testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) - - // Check Monitoring Console One is still configured with Search Head in namespace - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console One Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Pod after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, false) // ################# Update Monitoring Console In SHC CR ################################## @@ -542,53 +747,10 @@ var _ = Describe("Monitoring Console test", func() { // testenv.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo, testcaseEnvInst) // ############################ VERIFICATION FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### - - // Check Cluster Manager in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcTwoName, true) - - // Check Deployer in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Deployer on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, true) - - // Verify all Search Head Members are configured on Monitoring Console Two - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, true) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Pod after SHC Reconfig") - err = testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, true, false, 5*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for search heads in MC two config after SHC reconfig") - - // Check Monitoring console Two is configured with all Indexer in Name Space - testcaseEnvInst.Log.Info("Checking for Indexer Pod on MC TWO after SHC Reconfig") - err = testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true, 5*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for indexers in MC two config after SHC reconfig") + VerifyMCTwoAfterSHCReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, 5*time.Minute) // ############################ VERIFICATION FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### - - // Verify MC ONE is Ready and stays in ready state before running verfications - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) - - // Check Cluster Manager Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager NOT in Monitoring Console One Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, false) - - // Check DEPLOYER Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify DEPLOYER NOT in Monitoring Console One Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, false) - - // Verify all Search Head Members are Not configured on Monitoring Console One - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console ONE Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, false) - - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console ONE Pod after Search Head Reconfig") - err = testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, shPods, mcName, false, false, 5*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for search heads to be removed from MC one config after SHC reconfig") - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Checking for Indexer Pod NOT on MC One after SHC Reconfig") - // testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) + VerifyMCOneAfterSHCReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, 5*time.Minute) }) }) @@ -680,43 +842,9 @@ var _ = Describe("Monitoring Console test", func() { // Deploy Monitoring Console Pod testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - // Check Cluster Manager in Monitoring Console Config Map - testcaseEnvInst.Log.Info("Checking for Cluster Manager on MC TWO CONFIG MAP after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcTwoName, true) - - // Check Monitoring Console TWO is configured with all Indexers in Name Space - testcaseEnvInst.Log.Info("Checking for Indexer Pods on MC TWO POD after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) - - // Check Monitoring console Two is NOT configured with all search head instances in namespace - testcaseEnvInst.Log.Info("Checking for Search Head NOT CONFIGURED on MC TWO Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, false) - - testcaseEnvInst.Log.Info("Checking for Search Head NOT CONFIGURED on MC TWO Pod after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, false, false) - - // Verify Monitoring Console One is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Cluster Manager NOT configured on Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Checking for Cluster Manager NOT in MC One Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, false) - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Checking for Indexer Pods Not on MC one POD after Cluster Manager RECONFIG") - //testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) - - // Check Deployer in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Checking for Deployer in MC One Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Check Monitoring console One is configured with all search head instances in namespace - testcaseEnvInst.Log.Info("Checking for Search Head on MC ONE Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC ONE Pod after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) + managerParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterManagerServiceName, CMURLKey: splcommon.ClusterManagerURL} + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, false) + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, true) }) }) diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go deleted file mode 100644 index 8cb6e42a1..000000000 --- a/test/monitoring_console/monitoring_console_test.go +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package monitoringconsoletest - -import ( - "context" - "fmt" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Monitoring Console test", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("mastermc, smoke: MC can configure SHC, indexer instances after scale up and standalone in a namespace", func() { - /* - Test Steps - 1. Deploy Single Site Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. VerifyMonitoring Console Pod has Search Heads in Peer strings - 6. Verify Monitoring Console Pod has peers(indexers) in Peer string - 7. Scale SH Cluster - 8. Scale Indexer Count - 9. Add a standalone - 10. Verify Standalone is configured in MC Config Map and Peer String - 11. Verify SH are configured in MC Config Map and Peers String - 12. Verify Indexers are configured in Peer String - */ - - defaultSHReplicas := 3 - defaultIndexerReplicas := 3 - mcName := deployment.GetName() - - // Deploy and verify Monitoring Console - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") - - // Deploy and verify C3 cluster with MC - testcaseEnvInst.DeployAndVerifyC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, mcName) - - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - // Wait for Cluster Master to appear in Monitoring Console Config Map - err := testcaseEnvInst.WaitForPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, true, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for Cluster Master in MC ConfigMap") - - // Verify MC configuration for C3 cluster - testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) - - // Scale Search Head Cluster - scaledSHReplicas := defaultSHReplicas + 1 - testcaseEnvInst.Log.Info("Scaling up Search Head Cluster", "Current Replicas", defaultSHReplicas, "New Replicas", scaledSHReplicas) - testcaseEnvInst.ScaleSearchHeadCluster(ctx, deployment, deployment.GetName(), scaledSHReplicas) - - // Scale indexers - scaledIndexerReplicas := defaultIndexerReplicas + 1 - testcaseEnvInst.Log.Info("Scaling up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) - testcaseEnvInst.ScaleIndexerCluster(ctx, deployment, deployment.GetName(), scaledIndexerReplicas) - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - - // Deploy Standalone with MC reference - testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) - - // Ensure Indexer cluster go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Ensure Search Head Cluster go to Ready Phase - // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Wait for MC to go to PENDING Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhasePending) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify Standalone configured on Monitoring Console - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") - testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, deployment.GetName(), mcName, true) - - // Verify MC configuration after scale up - testcaseEnvInst.Log.Info("Verify MC configuration after Scale Up") - testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, scaledSHReplicas, scaledIndexerReplicas, true) - }) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { - /* - Test Steps - 1. Deploy Single Site Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Monitoring Console Pod has peers in Peer string on MC Pod - --------------- RECONFIG CLUSTER MANAGER WITH NEW MC -------------------------- - 13. Reconfigure CM with Second MC - 14. Verify CM in config map of Second MC - 15. Create Second MC Pod - 16. Verify Indexers in second MC Pod - 17. Verify SHC not in second MC - 18. Verify SHC still present in first MC d - 19. Veirfy CM and Indexers not in first MC Pod - ---------------- RECONFIG SHC WITH NEW MC - 20. Configure SHC with Second MC - 21. Verify CM, DEPLOYER, Search Heads in config map of seconds MC - 22. Verify SHC in second MC pod - 23. Verify Indexers in Second MC Pod - 24. Verify CM and Deployer not in first MC CONFIG MAP - 24. Verify SHC, Indexers not in first MC Pod - */ - - defaultSHReplicas := 3 - defaultIndexerReplicas := 3 - mcName := deployment.GetName() - - // Deploy Monitoring Console Pod - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") - - err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - // Verify MC configuration for C3 cluster - testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Generate pod name slices for later verification - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) - - // ################# Update Monitoring Console In Cluster Master CR ################################## - - mcTwoName := deployment.GetName() + "-two" - cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) - - cm.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, cm) - - Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - - // Ensure Cluster Master Goes to Updating Phase - //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Deploy and verify Monitoring Console Two - mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### - - // Check Cluster Master in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager in Monitoring Console Two Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcTwoName, true) - - // Check Monitoring console Two is configured with all Indexer in Name Space - testcaseEnvInst.Log.Info("Verify Indexers in Monitoring Console Pod TWO Config String after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) - - // Check Deployer NOT in Monitoring Console TWO Config Map - testcaseEnvInst.Log.Info("Verify DEPLOYER NOT on Monitoring Console TWO Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, false) - - // Check Monitoring Console TWO is NOT configured with Search Head in namespace - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console TWO Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, false) - - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console TWO Pod after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, false, false) - - // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### - - // Verify Monitoring Console One Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Cluster Master Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager NOT in Monitoring Console One Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, false) - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Verify Indexers NOT in Monitoring Console One Pod Config String after Cluster Master Reconfig") - // testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) - - // Check Monitoring Console One is still configured with Search Head in namespace - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console One Config Map after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Pod after Cluster Manager Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - // ################# Update Monitoring Console In SHC CR ################################## - - // Update SHC to use 2nd Monitoring Console - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) - - // Ensure Search Head Cluster go to Ready Phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) - - // ############################ VERIFICATOIN FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### - - // Check Cluster Master in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcTwoName, true) - - // Check Deployer in Monitoring Console Two Config Map - testcaseEnvInst.Log.Info("Verify Deployer on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, true) - - // Verify all Search Head Members are configured on Monitoring Console Two - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Two Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, true) - - testcaseEnvInst.Log.Info("Verify Search Head Pods on Monitoring Console Pod after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, true, false) - - // Check Monitoring console Two is configured with all Indexer in Name Space - testcaseEnvInst.Log.Info("Checking for Indexer Pod on MC TWO after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) - - // ############################ VERIFICATOIN FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### - - // Verify MC ONE is Ready and stays in ready state before running verfications - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) - - // Check Cluster Master Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify Cluster Manager NOT in Monitoring Console One Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, false) - - // Check DEPLOYER Not in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Verify DEPLOYER NOT in Monitoring Console One Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, false) - - // Verify all Search Head Members are Not configured on Monitoring Console One - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console ONE Config Map after SHC Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, false) - - testcaseEnvInst.Log.Info("Verify Search Head Pods NOT on Monitoring Console ONE Pod after Search Head Reconfig") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, false, false) - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Checking for Indexer Pod NOT on MC One after SHC Reconfig") - // testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) - }) - }) - - Context("Multisite Clustered deployment (M4 - 3 Site clustered indexer, search head cluster)", func() { - It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { - /* - Test Steps - 1. Deploy Multisite Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Indexers are configured in MC Config Map - 7. Verify Monitoring Console Pod has peers in Peer string on MC Pod - ############ CLUSTER MANAGER MC RECONFIG ################################# - 8. Configure Cluster Master to use 2nd Monitoring Console - 9. Verify Cluster Master is configured Config Maps of Second MC - 10. Deploy 2nd MC pod - 11. Verify Indexers in 2nd MC Pod - 12. Verify SHC not in 2nd MC CM - 13. Verify SHC not in 2nd MC Pod - 14. Verify Cluster Master not 1st MC Config Map - 15. Verify Indexers not in 1st MC Pod - */ - defaultSHReplicas := 3 - defaultIndexerReplicas := 1 - siteCount := 3 - mcName := deployment.GetName() - err := deployment.DeployMultisiteClusterMasterWithMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, siteCount, mcName, true) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with SHC") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - - // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // Verify MC configuration for M4 cluster - testcaseEnvInst.VerifyMCConfigForM4Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, siteCount, true) - - // Generate pod name slices for later verification - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), defaultIndexerReplicas, true, siteCount) - - // ############ CLUSTER MANAGER MC RECONFIG ################################# - mcTwoName := deployment.GetName() + "-two" - // Update Cluster Manager to use 2nd Monitoring Console - cm := &enterpriseApiV3.ClusterMaster{} - testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) - - // Ensure Cluster Master Goes to Updating Phase - //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Deploy and verify Monitoring Console Two - mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - // Verify Monitoring Console TWO is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) - - // Check Cluster Master in Monitoring Console Config Map - testcaseEnvInst.Log.Info("Checking for Cluster Manager on MC TWO CONFIG MAP after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcTwoName, true) - - // Check Monitoring Console TWO is configured with all Indexers in Name Space - testcaseEnvInst.Log.Info("Checking for Indexer Pods on MC TWO POD after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) - - // Check Monitoring console Two is NOT configured with all search head instances in namespace - testcaseEnvInst.Log.Info("Checking for Search Head NOT CONFIGURED on MC TWO Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, false) - - testcaseEnvInst.Log.Info("Checking for Search Head NOT CONFIGURED on MC TWO Pod after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, false, false) - - // Verify Monitoring Console One is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Check Cluster Master NOT configured on Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Checking for Cluster Manager NOT in MC One Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterMasterServiceName, deployment.GetName())}, "SPLUNK_CLUSTER_MASTER_URL", mcName, false) - - // Check Monitoring console One is Not configured with all Indexer in Name Space - // CSPL-619 - // testcaseEnvInst.Log.Info("Checking for Indexer Pods Not on MC one POD after Cluster Master RECONFIG") - //testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, false, true) - - // Check Deployer in Monitoring Console One Config Map - testcaseEnvInst.Log.Info("Checking for Deployer in MC One Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Check Monitoring console One is configured with all search head instances in namespace - testcaseEnvInst.Log.Info("Checking for Search Head on MC ONE Config Map after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC ONE Pod after Cluster Manager RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - }) - }) -}) diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index 065a4a224..dbda0306f 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -16,6 +16,7 @@ package monitoringconsoletest import ( "context" "fmt" + "time" . "github.com/onsi/gomega" @@ -128,3 +129,144 @@ func verifyStandaloneInMC(ctx context.Context, deployment *testenv.Deployment, t testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, pods, "SPLUNK_STANDALONE_URL", mcName, shouldExist) testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, pods, mcName, shouldExist, false) } + +// MCReconfigParams holds the service name and URL parameters that differ between +// V3 (master) and V4 (manager) monitoring console tests. +type MCReconfigParams struct { + CMServiceNameFmt string // format string for CM service name (e.g., testenv.ClusterMasterServiceName) + CMURLKey string // config map URL key (e.g., "SPLUNK_CLUSTER_MASTER_URL" or splcommon.ClusterManagerURL) +} + +// newStandaloneSpecWithMCRef creates a StandaloneSpec with a MonitoringConsoleRef. +func newStandaloneSpecWithMCRef(image string, mcName string) enterpriseApi.StandaloneSpec { + return enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: image, + }, + Volumes: []corev1.Volume{}, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } +} + +// VerifyMCTwoAfterCMReconfig verifies that MC Two is correctly configured after the Cluster Manager +// has been reconfigured to point to it: CM and indexers should be present, SH should be absent. +// If checkDeployerAbsent is true, also verifies deployer is absent on MC Two (used in C3 tests). +func VerifyMCTwoAfterCMReconfig(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, + params MCReconfigParams, mcTwoName string, shPods, indexerPods []string, checkDeployerAbsent bool) { + + testcaseEnvInst.Log.Info("Verify CM in MC Two Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, params.CMURLKey, mcTwoName, true) + + testcaseEnvInst.Log.Info("Verify Indexers in MC Two Config String after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) + + if checkDeployerAbsent { + testcaseEnvInst.Log.Info("Verify Deployer NOT in MC Two Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, false) + } + + testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC Two Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, false) + + testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC Two Config String after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, false, false) +} + +// VerifyMCOneAfterCMReconfig verifies that MC One is correctly configured after the Cluster Manager +// has been reconfigured away from it: CM should be absent, SH should still be present. +// If checkDeployerPresent is true, also verifies deployer is still present on MC One (used in M4 tests). +func VerifyMCOneAfterCMReconfig(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, + params MCReconfigParams, mcName string, mc *enterpriseApi.MonitoringConsole, shPods []string, checkDeployerPresent bool) { + + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + testcaseEnvInst.Log.Info("Verify CM NOT in MC One Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, params.CMURLKey, mcName, false) + + // CSPL-619: Indexer verification on MC One is commented out in all test variants + + if checkDeployerPresent { + testcaseEnvInst.Log.Info("Verify Deployer still in MC One Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) + } + + testcaseEnvInst.Log.Info("Verify SH Pods still in MC One Config Map after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) + + testcaseEnvInst.Log.Info("Verify SH Pods still in MC One Config String after CM Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) +} + +// VerifyMCTwoAfterSHCReconfig verifies that MC Two has all components (CM, deployer, SH, indexers) +// after the SHC has been reconfigured to point to it. +// If timeout > 0, uses WaitForPodsInMCConfigString; otherwise uses direct VerifyPodsInMCConfigString. +func VerifyMCTwoAfterSHCReconfig(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, + params MCReconfigParams, mcTwoName string, shPods, indexerPods []string, timeout time.Duration) { + + testcaseEnvInst.Log.Info("Verify CM in MC Two Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, params.CMURLKey, mcTwoName, true) + + testcaseEnvInst.Log.Info("Verify Deployer in MC Two Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcTwoName, true) + + testcaseEnvInst.Log.Info("Verify SH Pods in MC Two Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcTwoName, true) + + if timeout > 0 { + testcaseEnvInst.Log.Info("Verify SH Pods in MC Two Config String after SHC Reconfig (with wait)") + err := testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, true, false, timeout) + Expect(err).To(Succeed(), "Timed out waiting for search heads in MC two config after SHC reconfig") + + testcaseEnvInst.Log.Info("Verify Indexers in MC Two Config String after SHC Reconfig (with wait)") + err = testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true, timeout) + Expect(err).To(Succeed(), "Timed out waiting for indexers in MC two config after SHC reconfig") + } else { + testcaseEnvInst.Log.Info("Verify SH Pods in MC Two Config String after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcTwoName, true, false) + + testcaseEnvInst.Log.Info("Verify Indexers in MC Two Config String after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcTwoName, true, true) + } +} + +// VerifyMCOneAfterSHCReconfig verifies that MC One has lost all components (CM, deployer, SH) +// after the SHC has been reconfigured away from it. +// If timeout > 0, uses WaitForPodsInMCConfigString; otherwise uses direct VerifyPodsInMCConfigString. +func VerifyMCOneAfterSHCReconfig(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, + params MCReconfigParams, mcName string, mc *enterpriseApi.MonitoringConsole, shPods []string, timeout time.Duration) { + + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcName, mc) + + testcaseEnvInst.Log.Info("Verify CM NOT in MC One Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, params.CMURLKey, mcName, false) + + testcaseEnvInst.Log.Info("Verify Deployer NOT in MC One Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, false) + + testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC One Config Map after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, false) + + if timeout > 0 { + testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC One Config String after SHC Reconfig (with wait)") + err := testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, shPods, mcName, false, false, timeout) + Expect(err).To(Succeed(), "Timed out waiting for search heads to be removed from MC one config after SHC reconfig") + } else { + testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC One Config String after SHC Reconfig") + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, false, false) + } + + // CSPL-619: Indexer verification on MC One is commented out in all test variants +} diff --git a/test/secret/manager_secret_c3_test.go b/test/secret/manager_secret_c3_test.go deleted file mode 100644 index 6acbb2abb..000000000 --- a/test/secret/manager_secret_c3_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for SVA C3", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("managersecret, smoke, c3: secret update on indexers and search head cluster", func() { - config := testenv.NewClusterReadinessConfigV4() - RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/manager_secret_m4_test.go b/test/secret/manager_secret_m4_test.go deleted file mode 100644 index 970d01f05..000000000 --- a/test/secret/manager_secret_m4_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for M4 SVA", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - ctx := context.TODO() - - BeforeEach(func() { - testenv.SpecifiedTestTimeout = 40000 - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { - It("managersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - config := testenv.NewClusterReadinessConfigV4() - RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/manager_secret_s1_test.go b/test/secret/manager_secret_s1_test.go deleted file mode 100644 index 15b280076..000000000 --- a/test/secret/manager_secret_s1_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for SVA S1", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - ctx := context.TODO() - var deployment *testenv.Deployment - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone deployment (S1) with LM and MC", func() { - It("managersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) - - Context("Standalone deployment (S1) with LM amd MC", func() { - It("managersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) - }) - }) - - Context("Standalone deployment (S1)", func() { - It("managersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/secret_c3_test.go b/test/secret/secret_c3_test.go deleted file mode 100644 index b48219af9..000000000 --- a/test/secret/secret_c3_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for SVA C3", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { - It("mastersecret, smoke, c3: secret update on indexers and search head cluster", func() { - config := testenv.NewClusterReadinessConfigV3() - RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/secret_m4_test.go b/test/secret/secret_m4_test.go deleted file mode 100644 index 158286c04..000000000 --- a/test/secret/secret_m4_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for M4 SVA", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - var deployment *testenv.Deployment - ctx := context.TODO() - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - - testenv.SpecifiedTestTimeout = 40000 - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { - It("mastersecret, integration, m4: secret update on multisite indexers and search head cluster", func() { - config := testenv.NewClusterReadinessConfigV3() - RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/secret_s1_test.go b/test/secret/secret_s1_test.go deleted file mode 100644 index d31e81029..000000000 --- a/test/secret/secret_s1_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package secret - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Secret Test for SVA S1", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - ctx := context.TODO() - var deployment *testenv.Deployment - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone deployment (S1) with LM and MC", func() { - It("mastersecret, integration, s1: Secret update on a standalone instance with LM and MC", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) - }) - }) - - Context("Standalone deployment (S1) with LM amd MC", func() { - It("mastersecret, integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) - }) - }) - - Context("Standalone deployment (S1)", func() { - It("mastersecret, smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { - config := testenv.NewClusterReadinessConfigV4() - RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/secret/secret_test.go b/test/secret/secret_test.go new file mode 100644 index 000000000..c075d3be5 --- /dev/null +++ b/test/secret/secret_test.go @@ -0,0 +1,117 @@ +// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package secret + +import ( + "context" + + . "github.com/onsi/ginkgo/v2" + + "github.com/splunk/splunk-operator/test/testenv" +) + +var _ = Describe("Secret Test", func() { + + var testcaseEnvInst *testenv.TestCaseEnv + var deployment *testenv.Deployment + ctx := context.TODO() + + // S1 tests — both label variants use identical V4 config + s1SecretLabels := []string{"mastersecret", "managersecret"} + + for _, label := range s1SecretLabels { + label := label + Context("Standalone deployment (S1) with LM and MC", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(label+", integration, s1: Secret update on a standalone instance with LM and MC", func() { + config := testenv.NewClusterReadinessConfigV4() + RunS1SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) + }) + + It(label+", integration, s1: Secret Object is recreated on delete and new secrets are applied to Splunk Pods", func() { + config := testenv.NewClusterReadinessConfigV4() + RunS1SecretDeleteTest(ctx, deployment, testcaseEnvInst, config) + }) + + It(label+", smoke, s1: Secret Object data is repopulated in secret object on passing empty Data map and new secrets are applied to Splunk Pods", func() { + config := testenv.NewClusterReadinessConfigV4() + RunS1SecretDeleteWithMCRefTest(ctx, deployment, testcaseEnvInst, config) + }) + }) + } + + // C3 tests — V3 (master) and V4 (manager) variants + c3SecretConfigs := []struct { + namePrefix string + label string + newConfig func() *testenv.ClusterReadinessConfig + }{ + {"master", "mastersecret", testenv.NewClusterReadinessConfigV3}, + {"", "managersecret", testenv.NewClusterReadinessConfigV4}, + } + + for _, tc := range c3SecretConfigs { + tc := tc + Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(tc.label+", smoke, c3: secret update on indexers and search head cluster", func() { + config := tc.newConfig() + RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) + }) + }) + } + + // M4 tests — V3 (master) and V4 (manager) variants + m4SecretConfigs := []struct { + namePrefix string + label string + newConfig func() *testenv.ClusterReadinessConfig + }{ + {"master", "mastersecret", testenv.NewClusterReadinessConfigV3}, + {"", "managersecret", testenv.NewClusterReadinessConfigV4}, + } + + for _, tc := range m4SecretConfigs { + tc := tc + Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { + BeforeEach(func() { + testenv.SpecifiedTestTimeout = 40000 + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(tc.label+", integration, m4: secret update on multisite indexers and search head cluster", func() { + config := tc.newConfig() + RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) + }) + }) + } +}) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index 54aad0998..b4265e6fd 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -217,17 +217,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err = testcaseEnvInst.WaitForClusterInitialized(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") - // Deploy and verify Monitoring Console - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") + mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) // Update Secret Value on Secret Object updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) @@ -260,6 +250,16 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } +func deployMCAndVerifyInitialSecret(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) (*enterpriseApi.MonitoringConsole, string, string) { + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) + testcaseEnvInst.Log.Info("Checkin RF SF before secret change") + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) + _, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + Expect(err).To(Succeed(), "Unable to get secret struct") + return mc, resourceVersion, namespaceScopedSecretName +} + // RunM4SecretUpdateTest runs the standard M4 secret update test workflow func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Download License File and create config map @@ -275,17 +275,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - // Deploy and verify Monitoring Console - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) - Expect(err).To(Succeed(), "Unable to get secret struct") + mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) // Update Secret Value on Secret Object updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) diff --git a/test/smartstore/manager_smartstore_test.go b/test/smartstore/manager_smartstore_test.go deleted file mode 100644 index e6d03c867..000000000 --- a/test/smartstore/manager_smartstore_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package smartstore - -import ( - "context" - "time" - - . "github.com/onsi/ginkgo/v2" - - "github.com/splunk/splunk-operator/test/testenv" -) - -var _ = Describe("Smartstore test", func() { - - var testcaseEnvInst *testenv.TestCaseEnv - ctx := context.TODO() - var deployment *testenv.Deployment - - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "") - }) - - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) - - Context("Standalone Deployment (S1)", func() { - It("managersmartstore, integration: Can configure multiple indexes through app", func() { - RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, 5*time.Minute) - }) - }) - - Context("Standalone Deployment (S1)", func() { - It("managersmartstore, integration: Can configure indexes which use default volumes through app", func() { - RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) - }) - }) - - Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { - It("managersmartstore, smoke: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - config := testenv.NewClusterReadinessConfigV4() - RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) - }) - }) -}) diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index 91cfd4a51..b3534c58d 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -16,41 +16,66 @@ var _ = Describe("Smartstore test", func() { ctx := context.TODO() var deployment *testenv.Deployment - BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") - }) + smartstoreConfigs := []struct { + namePrefix string + label string + s1IndexesTimeout time.Duration + newConfig func() *testenv.ClusterReadinessConfig + }{ + {"master", "mastersmartstore", 2 * time.Minute, testenv.NewClusterReadinessConfigV3}, + {"", "managersmartstore", 5 * time.Minute, testenv.NewClusterReadinessConfigV4}, + } - AfterEach(func() { - testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) - }) + for _, tc := range smartstoreConfigs { + tc := tc + Context("Standalone Deployment (S1)", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) - Context("Standalone Deployment (S1)", func() { - It("mastersmartstore, integration: Can configure multiple indexes through app", func() { - RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, 2*time.Minute) - }) - }) + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) - Context("Standalone Deployment (S1)", func() { - It("mastersmartstore, integration: Can configure indexes which use default volumes through app", func() { - RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) + It(tc.label+", integration: Can configure multiple indexes through app", func() { + RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, tc.s1IndexesTimeout) + }) + + It(tc.label+", integration: Can configure indexes which use default volumes through app", func() { + RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) + }) }) - }) - Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { - It("mastersmartstore, m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - config := testenv.NewClusterReadinessConfigV3() - RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) + Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(tc.label+", m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { + config := tc.newConfig() + RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) + }) }) - }) + } Context("Standalone deployment (S1) with App Framework", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, "master") + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Etc storage", func() { storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageEtcEph", StorageCapacity: "1Gi", EphemeralStorage: true} RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, true) }) - }) - Context("Standalone deployment (S1) with App Framework", func() { It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Var storage", func() { storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageVarEph", StorageCapacity: "1Gi", EphemeralStorage: true} RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, false) From 463617285c7f97db48a383951a649ee48d24f7a5 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Wed, 25 Mar 2026 14:28:51 +0100 Subject: [PATCH 17/20] CSPL-3775 Standardize test code by fixing typos in log messages/comments, removing duplicate helpers, replacing inline logic with shared utilities --- ...AL2023-build-test-push-workflow-AL2023.yml | 2 +- .../arm-AL2023-int-test-workflow.yml | 2 +- .../arm-RHEL-build-test-push-workflow.yml | 2 +- .../workflows/arm-RHEL-int-test-workflow.yml | 2 +- .../arm-Ubuntu-build-test-push-workflow.yml | 2 +- .../arm-Ubuntu-int-test-workflow.yml | 2 +- .../workflows/build-test-push-workflow.yml | 2 +- .../distroless-build-test-push-workflow.yml | 2 +- .../distroless-int-test-workflow.yml | 2 +- .github/workflows/int-test-workflow.yml | 2 +- .../workflows/manual-int-test-workflow.yml | 2 +- .../namespace-scope-int-workflow.yml | 2 +- .../workflows/nightly-int-test-workflow.yml | 2 +- test/custom_resource_crud/crud_test_shared.go | 4 +- test/delete_cr/deletecr_suite_test.go | 1 - test/delete_cr/deletecr_test.go | 6 +- ...dex_and_ingestion_separation_suite_test.go | 4 +- .../index_and_ingestion_separation_test.go | 22 +--- test/ingest_search/ingest_search_test.go | 2 - ...d_test.go => ingest_search_test_shared.go} | 0 ...e_test.go => licensemanager_suite_test.go} | 2 +- test/licensemanager/lm_test_shared.go | 22 +--- test/monitoring_console/mc_test.go | 111 +++++------------- .../monitoring_console_suite_test.go | 1 - .../monitoring_console_test_shared.go | 33 +----- test/secret/secret_test_shared.go | 32 ++--- test/smartstore/smartstore_test.go | 19 ++- test/smartstore/smartstore_test_shared.go | 4 +- test/smoke/cluster_manager_sites_response.go | 38 ------ test/testenv/cmutil.go | 2 +- test/testenv/common_test_patterns.go | 39 ++++++ test/testenv/lmutil.go | 4 +- test/testenv/mcutil.go | 2 +- test/testenv/secretutil.go | 4 +- 34 files changed, 135 insertions(+), 243 deletions(-) rename test/ingest_search/{ingest_search_shared_test.go => ingest_search_test_shared.go} (100%) rename test/licensemanager/{manager_suite_test.go => licensemanager_suite_test.go} (95%) delete mode 100644 test/smoke/cluster_manager_sites_response.go diff --git a/.github/workflows/arm-AL2023-build-test-push-workflow-AL2023.yml b/.github/workflows/arm-AL2023-build-test-push-workflow-AL2023.yml index ee756236f..226830c31 100644 --- a/.github/workflows/arm-AL2023-build-test-push-workflow-AL2023.yml +++ b/.github/workflows/arm-AL2023-build-test-push-workflow-AL2023.yml @@ -136,7 +136,7 @@ jobs: appframeworksS1, managersecret, managermc, - indingsep, + indexingestionsep, licensemanager, ] runs-on: ubuntu-latest diff --git a/.github/workflows/arm-AL2023-int-test-workflow.yml b/.github/workflows/arm-AL2023-int-test-workflow.yml index 39986ebca..a65cf941f 100644 --- a/.github/workflows/arm-AL2023-int-test-workflow.yml +++ b/.github/workflows/arm-AL2023-int-test-workflow.yml @@ -69,7 +69,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image-arm-al2023 diff --git a/.github/workflows/arm-RHEL-build-test-push-workflow.yml b/.github/workflows/arm-RHEL-build-test-push-workflow.yml index 07848683c..f86a5e632 100644 --- a/.github/workflows/arm-RHEL-build-test-push-workflow.yml +++ b/.github/workflows/arm-RHEL-build-test-push-workflow.yml @@ -69,7 +69,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image-arm-rhel diff --git a/.github/workflows/arm-RHEL-int-test-workflow.yml b/.github/workflows/arm-RHEL-int-test-workflow.yml index 83c7e8fb9..d2a127ca8 100644 --- a/.github/workflows/arm-RHEL-int-test-workflow.yml +++ b/.github/workflows/arm-RHEL-int-test-workflow.yml @@ -69,7 +69,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image-arm-rhel diff --git a/.github/workflows/arm-Ubuntu-build-test-push-workflow.yml b/.github/workflows/arm-Ubuntu-build-test-push-workflow.yml index a22bd10c4..5c6179c20 100644 --- a/.github/workflows/arm-Ubuntu-build-test-push-workflow.yml +++ b/.github/workflows/arm-Ubuntu-build-test-push-workflow.yml @@ -136,7 +136,7 @@ jobs: appframeworksS1, managersecret, managermc, - indingsep, + indexingestionsep, licensemanager, ] runs-on: ubuntu-latest diff --git a/.github/workflows/arm-Ubuntu-int-test-workflow.yml b/.github/workflows/arm-Ubuntu-int-test-workflow.yml index b3f133abe..8d138f5bb 100644 --- a/.github/workflows/arm-Ubuntu-int-test-workflow.yml +++ b/.github/workflows/arm-Ubuntu-int-test-workflow.yml @@ -69,7 +69,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image-arm-ubuntu diff --git a/.github/workflows/build-test-push-workflow.yml b/.github/workflows/build-test-push-workflow.yml index 01e655adb..dda66569a 100644 --- a/.github/workflows/build-test-push-workflow.yml +++ b/.github/workflows/build-test-push-workflow.yml @@ -200,7 +200,7 @@ jobs: managerappframeworkm4, managersecret, managermc, - indingsep, + indexingestionsep, licensemanager, ] runs-on: ubuntu-latest diff --git a/.github/workflows/distroless-build-test-push-workflow.yml b/.github/workflows/distroless-build-test-push-workflow.yml index 8aa6172f7..63d9bee33 100644 --- a/.github/workflows/distroless-build-test-push-workflow.yml +++ b/.github/workflows/distroless-build-test-push-workflow.yml @@ -195,7 +195,7 @@ jobs: managerappframeworkm4, managersecret, managermc, - indingsep, + indexingestionsep, licensemanager, ] runs-on: ubuntu-latest diff --git a/.github/workflows/distroless-int-test-workflow.yml b/.github/workflows/distroless-int-test-workflow.yml index 01a024247..5f16a8472 100644 --- a/.github/workflows/distroless-int-test-workflow.yml +++ b/.github/workflows/distroless-int-test-workflow.yml @@ -73,7 +73,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image-distroless diff --git a/.github/workflows/int-test-workflow.yml b/.github/workflows/int-test-workflow.yml index 001a34cee..c545b69eb 100644 --- a/.github/workflows/int-test-workflow.yml +++ b/.github/workflows/int-test-workflow.yml @@ -70,7 +70,7 @@ jobs: managercrcrud, licensemanager, managerdeletecr, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image diff --git a/.github/workflows/manual-int-test-workflow.yml b/.github/workflows/manual-int-test-workflow.yml index 96629316e..0e3e5d357 100644 --- a/.github/workflows/manual-int-test-workflow.yml +++ b/.github/workflows/manual-int-test-workflow.yml @@ -29,7 +29,7 @@ jobs: managerscaling, managercrcrud, licensemanager, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest env: diff --git a/.github/workflows/namespace-scope-int-workflow.yml b/.github/workflows/namespace-scope-int-workflow.yml index fc3d3554f..640f74dc6 100644 --- a/.github/workflows/namespace-scope-int-workflow.yml +++ b/.github/workflows/namespace-scope-int-workflow.yml @@ -25,7 +25,7 @@ jobs: managerscaling, managercrcrud, licensemanager, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest env: diff --git a/.github/workflows/nightly-int-test-workflow.yml b/.github/workflows/nightly-int-test-workflow.yml index 3f886dd9a..184927f04 100644 --- a/.github/workflows/nightly-int-test-workflow.yml +++ b/.github/workflows/nightly-int-test-workflow.yml @@ -66,7 +66,7 @@ jobs: managerscaling, managercrcrud, licensemanager, - indingsep, + indexingestionsep, ] runs-on: ubuntu-latest needs: build-operator-image diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index 462696759..0309d0117 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -18,10 +18,10 @@ import ( "fmt" "time" + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" - - . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) diff --git a/test/delete_cr/deletecr_suite_test.go b/test/delete_cr/deletecr_suite_test.go index c7d161a56..100ac34fc 100644 --- a/test/delete_cr/deletecr_suite_test.go +++ b/test/delete_cr/deletecr_suite_test.go @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package deletecr import ( diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index 637723a17..92e65c0ce 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -1,18 +1,16 @@ // Copyright (c) 2018-2022 Splunk Inc. All rights reserved. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package deletecr import ( @@ -20,7 +18,7 @@ import ( . "github.com/onsi/ginkgo/v2" - testenv "github.com/splunk/splunk-operator/test/testenv" + "github.com/splunk/splunk-operator/test/testenv" ) var _ = Describe("DeleteCR test", func() { diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go index 4a49795c6..3a57cf228 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -package indingsep +package indexingestionsep import ( "os" @@ -27,7 +27,7 @@ import ( var ( testenvInstance *testenv.TestEnv - testSuiteName = "indingsep-" + testenv.RandomDNSName(3) + testSuiteName = "indexingestionsep-" + testenv.RandomDNSName(3) queue = enterpriseApi.QueueSpec{ Provider: "sqs", diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index b3e047524..2b1b1b4e3 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -package indingsep +package indexingestionsep import ( "context" @@ -25,18 +25,15 @@ import ( . "github.com/onsi/gomega" enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/pkg/splunk/enterprise" "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("indingsep test", func() { +var _ = Describe("Index and Ingestion Separation test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment - var cmSpec enterpriseApi.ClusterManagerSpec - ctx := context.TODO() BeforeEach(func() { @@ -57,7 +54,7 @@ var _ = Describe("indingsep test", func() { }) Context("Ingestor and Indexer deployment", func() { - It("indingsep, smoke, indingsep: Splunk Operator can deploy Ingestors and Indexers", func() { + It("indexingestionsep, smoke: Splunk Operator can deploy Ingestors and Indexers", func() { // TODO: Remove secret reference and uncomment serviceAccountName part once IRSA fixed for Splunk and EKS 1.34+ // Create Service Account // testcaseEnvInst.Log.Info("Create Service Account") @@ -70,7 +67,7 @@ var _ = Describe("indingsep test", func() { }) Context("Ingestor and Indexer deployment", func() { - It("indingsep, smoke, indingsep: Splunk Operator can deploy Ingestors and Indexers with additional configurations", func() { + It("indexingestionsep, smoke: Splunk Operator can deploy Ingestors and Indexers with additional configurations", func() { // TODO: Remove secret reference and uncomment serviceAccountName part once IRSA fixed for Splunk and EKS 1.34+ // Create Service Account // testcaseEnvInst.Log.Info("Create Service Account") @@ -171,19 +168,12 @@ var _ = Describe("indingsep test", func() { testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") // Verify probe configuration - testcaseEnvInst.Log.Info("Get config map for probes") - ConfigMapName := enterprise.GetProbeConfigMapName(testcaseEnvInst.GetName()) - _, err = testenv.GetConfigMap(ctx, deployment, testcaseEnvInst.GetName(), ConfigMapName) - Expect(err).To(Succeed(), "Unable to get config map for probes", "ConfigMap", ConfigMapName) - testcaseEnvInst.Log.Info("Verify probe configurations on Ingestor pods") - scriptsNames := []string{enterprise.GetLivenessScriptName(), enterprise.GetReadinessScriptName(), enterprise.GetStartupScriptName()} - allPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - testcaseEnvInst.VerifyFilesInDirectoryOnPod(ctx, deployment, allPods, scriptsNames, enterprise.GetProbeMountDirectory(), false, true) + testcaseEnvInst.VerifyProbeConfigAndScripts(ctx, deployment, true) }) }) Context("Ingestor and Indexer deployment", func() { - It("indingsep, integration, indingsep: Splunk Operator can deploy Ingestors and Indexers with correct setup", func() { + It("indexingestionsep, integration: Splunk Operator can deploy Ingestors and Indexers with correct setup", func() { // TODO: Remove secret reference and uncomment serviceAccountName part once IRSA fixed for Splunk and EKS 1.34+ // Create Service Account // testcaseEnvInst.Log.Info("Create Service Account") diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index 37de50115..2d5a21978 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -39,9 +39,7 @@ var _ = Describe("Ingest and Search Test", func() { It("ingest_search, integration, s1: can search internal logs for standalone instance", func() { RunS1InternalLogSearchTest(ctx, deployment, testcaseEnvInst) }) - }) - Context("Standalone deployment (S1)", func() { It("ingest_search, integration, s1: can ingest custom data to new index and search", func() { RunS1IngestAndSearchTest(ctx, deployment, testcaseEnvInst) }) diff --git a/test/ingest_search/ingest_search_shared_test.go b/test/ingest_search/ingest_search_test_shared.go similarity index 100% rename from test/ingest_search/ingest_search_shared_test.go rename to test/ingest_search/ingest_search_test_shared.go diff --git a/test/licensemanager/manager_suite_test.go b/test/licensemanager/licensemanager_suite_test.go similarity index 95% rename from test/licensemanager/manager_suite_test.go rename to test/licensemanager/licensemanager_suite_test.go index e5468e792..8a58bf6da 100644 --- a/test/licensemanager/manager_suite_test.go +++ b/test/licensemanager/licensemanager_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 96869f1ca..69eabf821 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -20,12 +20,11 @@ import ( "path/filepath" "time" + . "github.com/onsi/gomega" + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/pkg/splunk/enterprise" "github.com/splunk/splunk-operator/test/testenv" - - . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" ) @@ -162,13 +161,7 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) // ############ Verify livenessProbe and readinessProbe config object and scripts############ - testcaseEnvInst.Log.Info("Get config map for livenessProbe and readinessProbe") - ConfigMapName := enterprise.GetProbeConfigMapName(testcaseEnvInst.GetName()) - _, err = testenv.GetConfigMap(ctx, deployment, testcaseEnvInst.GetName(), ConfigMapName) - Expect(err).To(Succeed(), "Unable to get config map for livenessProbe and readinessProbe", "ConfigMap name", ConfigMapName) - scriptsNames := []string{enterprise.GetLivenessScriptName(), enterprise.GetReadinessScriptName()} - allPods := testenv.DumpGetPods(testcaseEnvInst.GetName()) - testcaseEnvInst.VerifyFilesInDirectoryOnPod(ctx, deployment, allPods, scriptsNames, enterprise.GetProbeMountDirectory(), false, true) + testcaseEnvInst.VerifyProbeConfigAndScripts(ctx, deployment, false) // Verify License Manager/Master is configured on standalone instance standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) @@ -197,7 +190,7 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn testenv.VerifyLMConfiguredOnIndexers(ctx, deployment, deployment.GetName(), 3) testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) - verifyLMConfiguredOnMC(ctx, deployment) + testenv.VerifyLMConfiguredOnMC(ctx, deployment) } func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, testenvInstance *testenv.TestEnv, config *LicenseTestConfig) { @@ -334,15 +327,10 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn testenv.VerifyLMConfiguredOnMultisiteIndexers(ctx, deployment, deployment.GetName(), siteCount) testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) - verifyLMConfiguredOnMC(ctx, deployment) + testenv.VerifyLMConfiguredOnMC(ctx, deployment) } func deployMCAndVerifyRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, mcRef string) { _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) testcaseEnvInst.VerifyRFSFMet(ctx, deployment) } - -func verifyLMConfiguredOnMC(ctx context.Context, deployment *testenv.Deployment) { - monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, monitoringConsolePodName) -} diff --git a/test/monitoring_console/mc_test.go b/test/monitoring_console/mc_test.go index 1471788ac..4d42c4f08 100644 --- a/test/monitoring_console/mc_test.go +++ b/test/monitoring_console/mc_test.go @@ -137,11 +137,11 @@ var _ = Describe("Monitoring Console test (master)", func() { 15. Create Second MC Pod 16. Verify Indexers in second MC Pod 17. Verify SHC not in second MC - 18. Verify SHC still present in first MC d - 19. Veirfy CM and Indexers not in first MC Pod + 18. Verify SHC still present in first MC + 19. Verify CM and Indexers not in first MC Pod ---------------- RECONFIG SHC WITH NEW MC 20. Configure SHC with Second MC - 21. Verify CM, DEPLOYER, Search Heads in config map of seconds MC + 21. Verify CM, DEPLOYER, Search Heads in config map of second MC 22. Verify SHC in second MC pod 23. Verify Indexers in Second MC Pod 24. Verify CM and Deployer not in first MC CONFIG MAP @@ -339,7 +339,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Create Standalone Spec and apply standaloneOneName := deployment.GetName() mcName := deployment.GetName() - spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) + spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -353,15 +353,10 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Verify MC is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Check Standalone is configure in MC Config Map + // Check Standalone is configured in MC standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) - - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // ######################### RECONFIGURE STANDALONE WITH SECOND MC ####################################### @@ -378,24 +373,16 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Deploy 2nd MC Pod testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - // Check Standalone is configure in MC Config Map - testcaseEnvInst.Log.Info("Checking for Standalone Pod on SECOND MC Config Map after Standalone RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcTwoName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in SECOND MC Peer list after Standalone RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcTwoName, true, false) + // Check Standalone is configured in MC Two + testcaseEnvInst.Log.Info("Checking for Standalone on SECOND MC after Standalone RECONFIG") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcTwoName, true) // Verify Monitoring Console One is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Check Standalone is not configured in MC ONE Config Map - testcaseEnvInst.Log.Info("Checking for Standalone Pod NOT ON FIRST MC Config Map after Standalone RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, false) - - // Check Standalone Pod Not in MC ONE Peer List - testcaseEnvInst.Log.Info("Check standalone NOT ON FIRST MC Peer list after Standalone RECONFIG") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, false, false) + // Check Standalone is NOT configured in MC One + testcaseEnvInst.Log.Info("Checking for Standalone NOT ON FIRST MC after Standalone RECONFIG") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, false) }) }) @@ -425,7 +412,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { standaloneName := deployment.GetName() mcName := deployment.GetName() - spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) + spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -436,14 +423,10 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Deploy MC and wait for MC to be READY mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - // Check Standalone is configure in MC Config Map + // Check Standalone is configured in MC standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 1, false, 0) - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -477,13 +460,9 @@ var _ = Describe("Monitoring Console test (manager)", func() { standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 2, false, 0) - // Check Standalone is configure in MC Config Map - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, standalonePods, "SPLUNK_STANDALONE_URL", mcName, true) - - // Check Standalone Pod in MC Peer List - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, standalonePods, mcName, true, false) + // Check both Standalone pods are configured in MC after scale up + testcaseEnvInst.Log.Info("Checking for Standalone Pods on MC after scale up") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) }) }) @@ -543,44 +522,18 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Scale Search Head Cluster scaledSHReplicas := defaultSHReplicas + 1 testcaseEnvInst.Log.Info("Scaling up Search Head Cluster", "Current Replicas", defaultSHReplicas, "New Replicas", scaledSHReplicas) - shcName := deployment.GetName() + "-shc" - - // Get instance of current SHC CR with latest config - shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") - - // Update Replicas of SHC - shc.Spec.Replicas = int32(scaledSHReplicas) - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Failed to scale Search Head Cluster") - - // Ensure Search Head cluster scales up and go to ScalingUp phase - testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp) + testcaseEnvInst.ScaleSearchHeadCluster(ctx, deployment, deployment.GetName(), scaledSHReplicas) // Scale indexers scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scaling up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) - idxcName := deployment.GetName() + "-idxc" - - // Get instance of current Indexer CR with latest config - idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") - - // Update Replicas of Indexer Cluster - idxc.Spec.Replicas = int32(scaledIndexerReplicas) - err = deployment.UpdateCR(ctx, idxc) - Expect(err).To(Succeed(), "Failed to scale Indxer Cluster") - - // Ensure Indxer cluster scales up and go to ScalingUp phase - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp, idxcName) + testcaseEnvInst.ScaleIndexerCluster(ctx, deployment, deployment.GetName(), scaledIndexerReplicas) // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) // Deploy Standalone Pod - spec := newStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) + spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -604,11 +557,9 @@ var _ = Describe("Monitoring Console test (manager)", func() { testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) // Check Standalone configured on Monitoring Console - testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)}, "SPLUNK_STANDALONE_URL", mcName, true) - - testcaseEnvInst.Log.Info("Check standalone instance in MC Peer list") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)}, mcName, true, false) + standalonePods := []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)} + testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") + verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) // Verify all Search Head Members are configured on Monitoring Console shPods = testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), scaledSHReplicas, false, 0) @@ -642,11 +593,11 @@ var _ = Describe("Monitoring Console test (manager)", func() { 15. Create Second MC Pod 16. Verify Indexers in second MC Pod 17. Verify SHC not in second MC - 18. Verify SHC still present in first MC d - 19. Veirfy CM and Indexers not in first MC Pod + 18. Verify SHC still present in first MC + 19. Verify CM and Indexers not in first MC Pod ---------------- RECONFIG SHC WITH NEW MC 20. Configure SHC with Second MC - 21. Verify CM, DEPLOYER, Search Heads in config map of seconds MC + 21. Verify CM, DEPLOYER, Search Heads in config map of second MC 22. Verify SHC in second MC pod 23. Verify Indexers in Second MC Pod 24. Verify CM and Deployer not in first MC CONFIG MAP @@ -735,10 +686,10 @@ var _ = Describe("Monitoring Console test (manager)", func() { err = deployment.GetInstance(ctx, shcName, shc) Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") - // Update SHC to use 2nd Montioring Console + // Update SHC to use 2nd Monitoring Console shc.Spec.MonitoringConsoleRef.Name = mcTwoName err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Failed to get update Monitoring Console in Search Head Cluster CRD") + Expect(err).To(Succeed(), "Failed to update Monitoring Console in Search Head Cluster CRD") // Ensure Search Head Cluster go to Ready Phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) diff --git a/test/monitoring_console/monitoring_console_suite_test.go b/test/monitoring_console/monitoring_console_suite_test.go index 8d8cdb992..274e507f4 100644 --- a/test/monitoring_console/monitoring_console_suite_test.go +++ b/test/monitoring_console/monitoring_console_suite_test.go @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package monitoringconsoletest import ( diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index dbda0306f..100647fd2 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -33,18 +33,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep mcName := deployment.GetName() // Deploy standalone one with MCRef - spec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } + spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") @@ -88,7 +77,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep }, } standaloneTwo, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneTwoName, standaloneTwoSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") + Expect(err).To(Succeed(), "Unable to deploy standalone instance") // Wait for standalone two to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneTwoName, standaloneTwo) @@ -105,7 +94,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) // Delete standalone two and ensure MC is updated - testcaseEnvInst.Log.Info("Deleting second standalone deployment to namespace", "Standalone Name", standaloneTwoName) + testcaseEnvInst.Log.Info("Deleting second standalone deployment from namespace", "Standalone Name", standaloneTwoName) deployment.GetInstance(ctx, standaloneTwoName, standaloneTwo) err = deployment.DeleteCR(ctx, standaloneTwo) Expect(err).To(Succeed(), "Unable to delete standalone instance", "Standalone Name", standaloneTwo) @@ -137,22 +126,6 @@ type MCReconfigParams struct { CMURLKey string // config map URL key (e.g., "SPLUNK_CLUSTER_MASTER_URL" or splcommon.ClusterManagerURL) } -// newStandaloneSpecWithMCRef creates a StandaloneSpec with a MonitoringConsoleRef. -func newStandaloneSpecWithMCRef(image string, mcName string) enterpriseApi.StandaloneSpec { - return enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: image, - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } -} - // VerifyMCTwoAfterCMReconfig verifies that MC Two is correctly configured after the Cluster Manager // has been reconfigured to point to it: CM and indexers should be present, SH should be absent. // If checkDeployerAbsent is true, also verifies deployer is absent on MC Two (used in C3 tests). diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index b4265e6fd..6041cb28f 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -18,11 +18,10 @@ import ( "fmt" "time" + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" - - . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" ) // verifySecretsPropagated checks that the given secret data has been propagated to all @@ -65,7 +64,7 @@ func verifyLMAndClusterManagerReady(ctx context.Context, deployment *testenv.Dep // generateAndApplySecretUpdate creates randomized secret data and applies it to the namespace-scoped // secret object, returning the updated data map for subsequent verification. func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, namespaceScopedSecretName string) map[string][]byte { - modifiedHecToken := testenv.GetRandomeHECToken() + modifiedHecToken := testenv.GetRandomHECToken() modifiedValue := testenv.RandomDNSName(10) updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) err := testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) @@ -153,18 +152,7 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep var err error mcName := deployment.GetName() - standaloneSpec := enterpriseApi.StandaloneSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - MonitoringConsoleRef: corev1.ObjectReference{ - Name: mcName, - }, - }, - } + standaloneSpec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standalone, err = deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) Expect(err).To(Succeed(), "Unable to deploy standalone instance with MonitoringConsoleRef") @@ -212,11 +200,6 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) - // Wait for ClusterInitialized event to confirm cluster is fully initialized - idxcName := deployment.GetName() + "-idxc" - err = testcaseEnvInst.WaitForClusterInitialized(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for ClusterInitialized event on IndexerCluster") - mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) // Update Secret Value on Secret Object @@ -238,13 +221,14 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) // Wait for PasswordSyncCompleted event on IndexerCluster + idxcName := deployment.GetName() + "-idxc" err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on IndexerCluster") testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") + testcaseEnvInst.Log.Info("Checking RF SF after secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) @@ -252,7 +236,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, func deployMCAndVerifyInitialSecret(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) (*enterpriseApi.MonitoringConsole, string, string) { mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) - testcaseEnvInst.Log.Info("Checkin RF SF before secret change") + testcaseEnvInst.Log.Info("Checking RF SF before secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) _, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) @@ -288,7 +272,7 @@ func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify RF SF is met - testcaseEnvInst.Log.Info("Checkin RF SF after secret change") + testcaseEnvInst.Log.Info("Checking RF SF after secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index b3534c58d..daa4dfc7a 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -1,3 +1,16 @@ +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package smartstore import ( @@ -13,8 +26,8 @@ import ( var _ = Describe("Smartstore test", func() { var testcaseEnvInst *testenv.TestCaseEnv - ctx := context.TODO() var deployment *testenv.Deployment + ctx := context.TODO() smartstoreConfigs := []struct { namePrefix string @@ -71,12 +84,12 @@ var _ = Describe("Smartstore test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Etc storage", func() { + It("integration, s1, smartstore: can deploy a Standalone instance with Ephemeral Etc storage", func() { storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageEtcEph", StorageCapacity: "1Gi", EphemeralStorage: true} RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, true) }) - It("integration, s1, smartstore: can deploy a Standalone instance with Epehemeral Var storage", func() { + It("integration, s1, smartstore: can deploy a Standalone instance with Ephemeral Var storage", func() { storageConfig := enterpriseApi.StorageClassSpec{StorageClassName: "TestStorageVarEph", StorageCapacity: "1Gi", EphemeralStorage: true} RunS1EphemeralStorageTest(ctx, deployment, testcaseEnvInst, storageConfig, false) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index 68cbdb70f..ee501a7b2 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -18,11 +18,11 @@ import ( "fmt" "time" + . "github.com/onsi/gomega" + enterpriseApi "github.com/splunk/splunk-operator/api/v4" "github.com/splunk/splunk-operator/test/testenv" corev1 "k8s.io/api/core/v1" - - . "github.com/onsi/gomega" ) // RunS1MultipleIndexesTest runs the standard S1 multiple indexes SmartStore test workflow diff --git a/test/smoke/cluster_manager_sites_response.go b/test/smoke/cluster_manager_sites_response.go deleted file mode 100644 index f9bcdee60..000000000 --- a/test/smoke/cluster_manager_sites_response.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. - -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package smoke - -// ClusterManagerSitesResponse is a representation of the sites managed by a Splunk cluster-manager -// Endpoint: /services/cluster/manager/sites -type ClusterManagerSitesResponse struct { - Entries []ClusterManagerSitesEntry `json:"entry"` -} - -// ClusterManagerSitesEntry represents a site of an indexer cluster with its metadata -type ClusterManagerSitesEntry struct { - Name string `json:"name"` - Content ClusterManagerSitesContent `json:"content"` -} - -// ClusterManagerSitesContent represents detailed information about a site -type ClusterManagerSitesContent struct { - Peers map[string]ClusterManagerSitesPeer `json:"peers"` -} - -// ClusterManagerSitesPeer reprensents an indexer peer member of a site -type ClusterManagerSitesPeer struct { - ServerName string `json:"server_name"` -} diff --git a/test/testenv/cmutil.go b/test/testenv/cmutil.go index ffff90ea5..68e0bb499 100644 --- a/test/testenv/cmutil.go +++ b/test/testenv/cmutil.go @@ -44,7 +44,7 @@ type ClusterManagerSitesContent struct { Peers map[string]ClusterManagerSitesPeer `json:"peers"` } -// ClusterManagerSitesPeer reprensents an indexer peer member of a site +// ClusterManagerSitesPeer represents an indexer peer member of a site type ClusterManagerSitesPeer struct { ServerName string `json:"server_name"` } diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index 57db3fc67..35e561eda 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -21,6 +21,8 @@ import ( . "github.com/onsi/gomega" enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" + "github.com/splunk/splunk-operator/pkg/splunk/enterprise" + corev1 "k8s.io/api/core/v1" ) // ClusterReadinessConfig holds v3/v4 API version callbacks for cluster and license manager @@ -231,6 +233,43 @@ func (testcaseenv *TestCaseEnv) TriggerAndVerifyTelemetry(ctx context.Context, d testcaseenv.VerifyTelemetry(ctx, deployment, prevSubmissionTime) } +// VerifyProbeConfigAndScripts verifies probe config map exists and probe scripts are present on all pods. +// If includeStartup is true, the startup probe script is also checked. +func (testcaseenv *TestCaseEnv) VerifyProbeConfigAndScripts(ctx context.Context, deployment *Deployment, includeStartup bool) { + testcaseenv.Log.Info("Get config map for livenessProbe and readinessProbe") + configMapName := enterprise.GetProbeConfigMapName(testcaseenv.GetName()) + _, err := GetConfigMap(ctx, deployment, testcaseenv.GetName(), configMapName) + Expect(err).To(Succeed(), "Unable to get config map for livenessProbe and readinessProbe", "ConfigMap name", configMapName) + scriptsNames := []string{enterprise.GetLivenessScriptName(), enterprise.GetReadinessScriptName()} + if includeStartup { + scriptsNames = append(scriptsNames, enterprise.GetStartupScriptName()) + } + allPods := DumpGetPods(testcaseenv.GetName()) + testcaseenv.VerifyFilesInDirectoryOnPod(ctx, deployment, allPods, scriptsNames, enterprise.GetProbeMountDirectory(), false, true) +} + +// NewStandaloneSpecWithMCRef creates a StandaloneSpec with a MonitoringConsoleRef set to the given MC name. +func NewStandaloneSpecWithMCRef(image string, mcName string) enterpriseApi.StandaloneSpec { + return enterpriseApi.StandaloneSpec{ + CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ + Spec: enterpriseApi.Spec{ + ImagePullPolicy: "IfNotPresent", + Image: image, + }, + Volumes: []corev1.Volume{}, + MonitoringConsoleRef: corev1.ObjectReference{ + Name: mcName, + }, + }, + } +} + +// VerifyLMConfiguredOnMC verifies that the License Manager is configured on the Monitoring Console pod. +func VerifyLMConfiguredOnMC(ctx context.Context, deployment *Deployment) { + monitoringConsolePodName := fmt.Sprintf(MonitoringConsolePod, deployment.GetName()) + VerifyLMConfiguredOnPod(ctx, deployment, monitoringConsolePodName) +} + // StandardC3Verification performs the standard set of verifications for a C3 cluster // This includes cluster ready, RF/SF met, and monitoring console ready func (testcaseenv *TestCaseEnv) StandardC3Verification(ctx context.Context, deployment *Deployment, mcName string, mc *enterpriseApi.MonitoringConsole) { diff --git a/test/testenv/lmutil.go b/test/testenv/lmutil.go index 9f7aa5dd7..326129786 100644 --- a/test/testenv/lmutil.go +++ b/test/testenv/lmutil.go @@ -1,18 +1,16 @@ // Copyright (c) 2018-2022 Splunk Inc. All rights reserved. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package testenv import ( diff --git a/test/testenv/mcutil.go b/test/testenv/mcutil.go index db3378444..10bbaa0b9 100644 --- a/test/testenv/mcutil.go +++ b/test/testenv/mcutil.go @@ -75,7 +75,7 @@ func CheckMCPodReady(ns string) bool { return stsReady && podReady } -// GetConfiguredPeers get list of Peers Configured on Montioring Console +// GetConfiguredPeers get list of Peers Configured on Monitoring Console func GetConfiguredPeers(ns string, mcName string) []string { podName := fmt.Sprintf(MonitoringConsolePod, mcName) var peerList []string diff --git a/test/testenv/secretutil.go b/test/testenv/secretutil.go index 1b9ee9ff1..a2f2e09a6 100644 --- a/test/testenv/secretutil.go +++ b/test/testenv/secretutil.go @@ -89,8 +89,8 @@ func GetMountedKey(ctx context.Context, deployment *Deployment, podName string, return stdout } -// GetRandomeHECToken generates a random HEC token -func GetRandomeHECToken() string { +// GetRandomHECToken generates a random HEC token +func GetRandomHECToken() string { return fmt.Sprintf("%s-%s-%s-%s-%s", strings.ToUpper(RandomDNSName(8)), strings.ToUpper(RandomDNSName(4)), strings.ToUpper(RandomDNSName(4)), strings.ToUpper(RandomDNSName(4)), strings.ToUpper(RandomDNSName(12))) } From 24fb0b56652df30c2fe36221d6bd4f5be2fc6863 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Wed, 25 Mar 2026 16:19:28 +0100 Subject: [PATCH 18/20] CSPL-3775 Consistency improvements --- .../custom_resource_crud_suite_test.go | 2 +- .../custom_resource_crud_test.go | 2 +- test/delete_cr/deletecr_suite_test.go | 2 +- test/delete_cr/deletecr_test.go | 2 +- test/example/example1_test.go | 2 +- test/example/example2_test.go | 2 +- test/example/example_suite_test.go | 2 +- .../index_and_ingestion_separation_test.go | 4 --- .../ingest_search/ingest_search_suite_test.go | 2 +- test/ingest_search/ingest_search_test.go | 2 +- test/licensemanager/lm_appfw_test.go | 2 +- test/licensemanager/lm_test.go | 2 +- test/licensemaster/lm_appfw_test.go | 2 +- test/licensemaster/lm_suite_test.go | 2 +- test/licensemaster/lm_test.go | 2 +- test/monitoring_console/mc_test.go | 28 +------------------ .../monitoring_console_suite_test.go | 2 +- test/secret/secret_suite_test.go | 2 +- test/secret/secret_test.go | 2 +- test/smartstore/smartstore_suite_test.go | 2 +- test/smoke/smoke_suite_test.go | 2 +- test/smoke/smoke_test.go | 2 +- test/testenv/cmutil.go | 2 +- test/testenv/deployment.go | 2 +- test/testenv/ingest_utils.go | 2 +- test/testenv/lmutil.go | 2 +- test/testenv/mcutil.go | 2 +- test/testenv/search_head_cluster_utils.go | 2 +- test/testenv/search_utils.go | 2 +- test/testenv/secretutil.go | 2 +- test/testenv/testcaseenv.go | 2 +- test/testenv/testenv.go | 2 +- test/testenv/util.go | 2 +- test/testenv/verificationutils.go | 4 +-- 34 files changed, 34 insertions(+), 64 deletions(-) diff --git a/test/custom_resource_crud/custom_resource_crud_suite_test.go b/test/custom_resource_crud/custom_resource_crud_suite_test.go index e97331116..ce753a736 100644 --- a/test/custom_resource_crud/custom_resource_crud_suite_test.go +++ b/test/custom_resource_crud/custom_resource_crud_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/custom_resource_crud/custom_resource_crud_test.go b/test/custom_resource_crud/custom_resource_crud_test.go index 766a89b1b..c64dbbc75 100644 --- a/test/custom_resource_crud/custom_resource_crud_test.go +++ b/test/custom_resource_crud/custom_resource_crud_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/delete_cr/deletecr_suite_test.go b/test/delete_cr/deletecr_suite_test.go index 100ac34fc..83d4a3c11 100644 --- a/test/delete_cr/deletecr_suite_test.go +++ b/test/delete_cr/deletecr_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index 92e65c0ce..b64a7a02e 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/example/example1_test.go b/test/example/example1_test.go index 1ea0ffc95..37e214084 100644 --- a/test/example/example1_test.go +++ b/test/example/example1_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/example/example2_test.go b/test/example/example2_test.go index b692860f6..9ca6b9959 100644 --- a/test/example/example2_test.go +++ b/test/example/example2_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/example/example_suite_test.go b/test/example/example_suite_test.go index 183ff9af1..2e5710526 100644 --- a/test/example/example_suite_test.go +++ b/test/example/example_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 2b1b1b4e3..1e8a5ba31 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -64,9 +64,7 @@ var _ = Describe("Index and Ingestion Separation test", func() { deleteIngestorStack(ctx, deployment) }) - }) - Context("Ingestor and Indexer deployment", func() { It("indexingestionsep, smoke: Splunk Operator can deploy Ingestors and Indexers with additional configurations", func() { // TODO: Remove secret reference and uncomment serviceAccountName part once IRSA fixed for Splunk and EKS 1.34+ // Create Service Account @@ -170,9 +168,7 @@ var _ = Describe("Index and Ingestion Separation test", func() { // Verify probe configuration testcaseEnvInst.VerifyProbeConfigAndScripts(ctx, deployment, true) }) - }) - Context("Ingestor and Indexer deployment", func() { It("indexingestionsep, integration: Splunk Operator can deploy Ingestors and Indexers with correct setup", func() { // TODO: Remove secret reference and uncomment serviceAccountName part once IRSA fixed for Splunk and EKS 1.34+ // Create Service Account diff --git a/test/ingest_search/ingest_search_suite_test.go b/test/ingest_search/ingest_search_suite_test.go index eb4132142..6bce14483 100644 --- a/test/ingest_search/ingest_search_suite_test.go +++ b/test/ingest_search/ingest_search_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index 2d5a21978..2ec4e63b9 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemanager/lm_appfw_test.go b/test/licensemanager/lm_appfw_test.go index 547603f9f..0ec351063 100644 --- a/test/licensemanager/lm_appfw_test.go +++ b/test/licensemanager/lm_appfw_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemanager/lm_test.go b/test/licensemanager/lm_test.go index 88200fb8c..625d1a674 100644 --- a/test/licensemanager/lm_test.go +++ b/test/licensemanager/lm_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemaster/lm_appfw_test.go b/test/licensemaster/lm_appfw_test.go index 123054338..b6be9a105 100644 --- a/test/licensemaster/lm_appfw_test.go +++ b/test/licensemaster/lm_appfw_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemaster/lm_suite_test.go b/test/licensemaster/lm_suite_test.go index ed5c80594..ceba436ed 100644 --- a/test/licensemaster/lm_suite_test.go +++ b/test/licensemaster/lm_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/licensemaster/lm_test.go b/test/licensemaster/lm_test.go index c0d4911fb..8d08dc433 100644 --- a/test/licensemaster/lm_test.go +++ b/test/licensemaster/lm_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/monitoring_console/mc_test.go b/test/monitoring_console/mc_test.go index 4d42c4f08..8210e096f 100644 --- a/test/monitoring_console/mc_test.go +++ b/test/monitoring_console/mc_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -105,9 +105,6 @@ var _ = Describe("Monitoring Console test (master)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - // Wait for MC to go to PENDING Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhasePending) - // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) @@ -119,9 +116,7 @@ var _ = Describe("Monitoring Console test (master)", func() { testcaseEnvInst.Log.Info("Verify MC configuration after Scale Up") testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, scaledSHReplicas, scaledIndexerReplicas, true) }) - }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { /* Test Steps @@ -192,9 +187,6 @@ var _ = Describe("Monitoring Console test (master)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - // Ensure Cluster Master Goes to Updating Phase - //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - // Ensure that the cluster-master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) @@ -280,9 +272,6 @@ var _ = Describe("Monitoring Console test (master)", func() { cm := &enterpriseApiV3.ClusterMaster{} testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) - // Ensure Cluster Master Goes to Updating Phase - //testcaseEnvInst.VerifyClusterMasterPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - // Ensure that the cluster-master goes to Ready phase testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) @@ -348,7 +337,6 @@ var _ = Describe("Monitoring Console test (manager)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) // Verify MC is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) @@ -452,9 +440,6 @@ var _ = Describe("Monitoring Console test (manager)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - // Wait for MC to go to Updating Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - // Verify MC is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) @@ -550,9 +535,6 @@ var _ = Describe("Monitoring Console test (manager)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - // Wait for MC to go to PENDING Phase - //testcaseEnvInst.VerifyMonitoringConsolePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhasePending) - // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) @@ -575,9 +557,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { indexerPods = testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), scaledIndexerReplicas, false, 0) testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) }) - }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { It("managermc1, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { /* Test Steps @@ -659,9 +639,6 @@ var _ = Describe("Monitoring Console test (manager)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - // Ensure Cluster Manager Goes to Updating Phase - //testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - // Ensure that the cluster-manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -784,9 +761,6 @@ var _ = Describe("Monitoring Console test (manager)", func() { // wait for custom resource resource version to change testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - // Ensure Cluster Manager Goes to Updating Phase - //testcaseEnvInst.VerifyClusterManagerPhase(ctx, deployment, enterpriseApi.PhaseUpdating) - // Ensure that the cluster-manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) diff --git a/test/monitoring_console/monitoring_console_suite_test.go b/test/monitoring_console/monitoring_console_suite_test.go index 274e507f4..74bf5b17c 100644 --- a/test/monitoring_console/monitoring_console_suite_test.go +++ b/test/monitoring_console/monitoring_console_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/secret/secret_suite_test.go b/test/secret/secret_suite_test.go index f12d3ed96..b933fbbd9 100644 --- a/test/secret/secret_suite_test.go +++ b/test/secret/secret_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/secret/secret_test.go b/test/secret/secret_test.go index c075d3be5..71aed45d1 100644 --- a/test/secret/secret_test.go +++ b/test/secret/secret_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/smartstore/smartstore_suite_test.go b/test/smartstore/smartstore_suite_test.go index 112ce28c8..54e837d61 100644 --- a/test/smartstore/smartstore_suite_test.go +++ b/test/smartstore/smartstore_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/smoke/smoke_suite_test.go b/test/smoke/smoke_suite_test.go index de4c35a89..f0ee154dc 100644 --- a/test/smoke/smoke_suite_test.go +++ b/test/smoke/smoke_suite_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index 7823ecea7..b9a705251 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/testenv/cmutil.go b/test/testenv/cmutil.go index 68e0bb499..6fc06a1d4 100644 --- a/test/testenv/cmutil.go +++ b/test/testenv/cmutil.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/deployment.go b/test/testenv/deployment.go index 395722983..f832d1fda 100644 --- a/test/testenv/deployment.go +++ b/test/testenv/deployment.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/ingest_utils.go b/test/testenv/ingest_utils.go index 2c0403b1e..1f28693bf 100644 --- a/test/testenv/ingest_utils.go +++ b/test/testenv/ingest_utils.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/lmutil.go b/test/testenv/lmutil.go index 326129786..ad651d994 100644 --- a/test/testenv/lmutil.go +++ b/test/testenv/lmutil.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/testenv/mcutil.go b/test/testenv/mcutil.go index 10bbaa0b9..0aa5d2361 100644 --- a/test/testenv/mcutil.go +++ b/test/testenv/mcutil.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/search_head_cluster_utils.go b/test/testenv/search_head_cluster_utils.go index 90c847afb..3fe55bb49 100644 --- a/test/testenv/search_head_cluster_utils.go +++ b/test/testenv/search_head_cluster_utils.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/search_utils.go b/test/testenv/search_utils.go index b0e85cc66..dea0667ed 100644 --- a/test/testenv/search_utils.go +++ b/test/testenv/search_utils.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/secretutil.go b/test/testenv/secretutil.go index a2f2e09a6..4dca85931 100644 --- a/test/testenv/secretutil.go +++ b/test/testenv/secretutil.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index a22981b67..fa92d8e0f 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/testenv.go b/test/testenv/testenv.go index 83576beda..361b66d04 100644 --- a/test/testenv/testenv.go +++ b/test/testenv/testenv.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/util.go b/test/testenv/util.go index ae902f995..e032e1f7b 100644 --- a/test/testenv/util.go +++ b/test/testenv/util.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/testenv/verificationutils.go b/test/testenv/verificationutils.go index 2393ffd88..624d8c536 100644 --- a/test/testenv/verificationutils.go +++ b/test/testenv/verificationutils.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022 Splunk Inc. All rights reserved. +// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -1146,7 +1146,7 @@ func (testenv *TestCaseEnv) VerifyNoPodResetByUID(ctx context.Context, deploymen } } -// WaitForSplunkPodCleanup Wait for cleanup to happend +// WaitForSplunkPodCleanup Wait for cleanup to happen func (testenv *TestCaseEnv) WaitForSplunkPodCleanup(ctx context.Context, deployment *Deployment) { gomega.Eventually(func() int { testenv.Log.Info("Waiting for Splunk Pods to be deleted before running test") From 5f0134596875e393a088f7c2bf0decef8c392793 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Mon, 30 Mar 2026 16:51:09 +0200 Subject: [PATCH 19/20] CSPL-3775 Refactoring - common naming, format and making sure functinality is not malformed --- .../c3/appframework_aws_suite_test.go | 6 +- .../c3/appframework_aws_test.go | 260 +++---- .../c3/manager_appframework_test.go | 260 +++---- test/appframework_aws/c3/test_helpers_test.go | 33 - .../m4/appframework_aws_suite_test.go | 6 +- .../m4/appframework_aws_test.go | 238 +++--- .../m4/manager_appframework_test.go | 529 +++----------- test/appframework_aws/m4/test_helpers_test.go | 33 - .../s1/appframework_aws_suite_test.go | 6 +- .../s1/appframework_aws_test.go | 93 ++- .../c3/appframework_azure_test.go | 265 +++---- .../c3/manager_appframework_azure_test.go | 265 +++---- test/appframework_az/c3/test_helpers_test.go | 33 - .../m4/appframework_azure_test.go | 247 +++---- .../m4/manager_appframework_azure_test.go | 227 +++--- test/appframework_az/m4/test_helpers_test.go | 40 - .../s1/appframework_azure_test.go | 94 ++- .../c3/appframework_gcs_test.go | 62 +- .../c3/manager_appframework_test.go | 690 +++++++++--------- test/appframework_gcp/c3/test_helpers_test.go | 33 - .../m4/appframework_gcs_test.go | 238 +++--- .../m4/manager_appframework_test.go | 122 ++-- test/appframework_gcp/m4/test_helpers_test.go | 33 - .../s1/appframework_gcs_test.go | 93 ++- test/custom_resource_crud/crud_test_shared.go | 48 +- .../custom_resource_crud_test.go | 10 +- test/delete_cr/deletecr_test.go | 4 +- .../index_and_ingestion_separation_test.go | 77 +- test/ingest_search/ingest_search_test.go | 2 +- .../ingest_search_test_shared.go | 14 +- test/licensemanager/lm_appfw_test.go | 2 +- test/licensemanager/lm_test.go | 6 +- test/licensemanager/lm_test_shared.go | 103 ++- test/licensemaster/lm_appfw_test.go | 2 +- test/licensemaster/lm_test.go | 6 +- .../monitoring_console_suite_test.go | 6 +- ...{mc_test.go => monitoring_console_test.go} | 64 +- .../monitoring_console_test_shared.go | 8 +- test/secret/secret_test.go | 10 +- test/secret/secret_test_shared.go | 11 +- test/smartstore/smartstore_test.go | 2 +- test/smartstore/smartstore_test_shared.go | 6 +- test/smoke/smoke_test.go | 6 +- test/testenv/appframework_utils.go | 84 +-- test/testenv/assertion_helpers.go | 78 +- test/testenv/azureutils.go | 8 +- test/testenv/cmutil.go | 10 +- test/testenv/common_test_patterns.go | 19 +- test/testenv/deployment.go | 178 ++--- test/testenv/gcputils.go | 48 +- test/testenv/lmutil.go | 2 +- test/testenv/mcutil.go | 12 +- test/testenv/multisite_helpers.go | 8 +- test/testenv/s3utils.go | 28 +- test/testenv/search_head_cluster_utils.go | 2 +- test/testenv/search_utils.go | 4 +- test/testenv/secretutil.go | 16 +- test/testenv/test_setup_helpers.go | 26 +- test/testenv/test_workflows.go | 30 +- test/testenv/testcaseenv.go | 4 +- test/testenv/testenv.go | 14 +- test/testenv/util.go | 26 +- test/testenv/verificationutils.go | 124 ++-- 63 files changed, 1979 insertions(+), 3035 deletions(-) delete mode 100644 test/appframework_aws/c3/test_helpers_test.go delete mode 100644 test/appframework_aws/m4/test_helpers_test.go delete mode 100644 test/appframework_az/c3/test_helpers_test.go delete mode 100644 test/appframework_az/m4/test_helpers_test.go delete mode 100644 test/appframework_gcp/c3/test_helpers_test.go delete mode 100644 test/appframework_gcp/m4/test_helpers_test.go rename test/monitoring_console/{mc_test.go => monitoring_console_test.go} (93%) diff --git a/test/appframework_aws/c3/appframework_aws_suite_test.go b/test/appframework_aws/c3/appframework_aws_suite_test.go index 8df2aca24..963f9ecc0 100644 --- a/test/appframework_aws/c3/appframework_aws_suite_test.go +++ b/test/appframework_aws/c3/appframework_aws_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -44,10 +43,7 @@ func TestBasic(t *testing.T) { Expect(testenv.LoadEnvFile()).ToNot(HaveOccurred(), "Error loading .env file") - sc, _ := GinkgoConfiguration() - sc.Timeout = 240 * time.Minute - - RunSpecs(t, "Running "+testSuiteName, sc) + RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { diff --git a/test/appframework_aws/c3/appframework_aws_test.go b/test/appframework_aws/c3/appframework_aws_test.go index 6381ffeca..3eddca4e8 100644 --- a/test/appframework_aws/c3/appframework_aws_test.go +++ b/test/appframework_aws/c3/appframework_aws_test.go @@ -57,9 +57,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.S3CloudCleanup(testS3Bucket, uploadedApps), filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -143,7 +141,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -162,15 +160,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -235,15 +231,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -309,7 +303,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -349,7 +343,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -368,15 +362,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -429,15 +421,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -516,7 +506,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -532,10 +522,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -585,9 +573,7 @@ var _ = Describe("c3appfw test", func() { //############# SCALING UP ################### // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -605,8 +591,7 @@ var _ = Describe("c3appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-idxc" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -628,7 +613,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas)) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -675,9 +660,7 @@ var _ = Describe("c3appfw test", func() { //############### SCALING DOWN ################ // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -693,8 +676,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -744,7 +726,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("smoke, c3, masterappframeworkc3, appframework: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -788,7 +770,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -804,10 +786,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -849,10 +829,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -875,7 +853,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them", func() { /* Test Steps @@ -943,7 +921,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -953,7 +931,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster master with scope local and append cluster scope + // Create App Framework Spec for Cluster Master with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -966,7 +944,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -985,10 +963,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1045,10 +1021,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1078,7 +1052,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then downgrade them", func() { /* Test Steps @@ -1144,7 +1118,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1154,7 +1128,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1165,7 +1139,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1184,10 +1158,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1260,10 +1232,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1293,7 +1263,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, masterappframeworkc3, appframework: can deploy a C3 SVA instance with App Framework enabled and install above 200MB of apps at once", func() { /* Test Steps @@ -1338,7 +1308,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1354,10 +1324,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1462,7 +1430,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1475,12 +1443,10 @@ var _ = Describe("c3appfw test", func() { shReplicas := 3 testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster") cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App Framework") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1535,10 +1501,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1618,7 +1582,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, masterappframeworkc3, appframework: can deploy a C3 SVA and have apps installed and updated locally on Cluster Manager and Deployer for manual polling", func() { /* Test Steps @@ -1666,7 +1630,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1681,10 +1645,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1726,10 +1688,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1793,7 +1753,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1859,7 +1819,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1869,7 +1829,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1880,7 +1840,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1898,10 +1858,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1970,10 +1928,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2084,7 +2040,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2213,7 +2169,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2250,7 +2206,7 @@ var _ = Describe("c3appfw test", func() { // Wait for polling interval to pass testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify all apps are installed on indexers appList = append(testenv.BigSingleApp, testenv.ExtraApps...) @@ -2311,7 +2267,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2332,10 +2288,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2401,7 +2355,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2422,10 +2376,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2488,7 +2440,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2503,10 +2455,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2605,7 +2555,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2649,10 +2599,8 @@ var _ = Describe("c3appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2672,7 +2620,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkc3, appframework: can deploy a C3 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2712,7 +2660,7 @@ var _ = Describe("c3appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to S3 for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion)) s3TestDirShc := "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) @@ -2721,7 +2669,7 @@ var _ = Describe("c3appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2739,10 +2687,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2804,7 +2750,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2828,10 +2774,8 @@ var _ = Describe("c3appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2886,7 +2830,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2911,14 +2855,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3: can deploy a C3 SVA and a Standalone, then add that Standalone as a Search Head to the cluster", func() { /* Test Steps @@ -2979,7 +2923,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, masterappframeworkc3, appframework: can deploy a C3 SVA and have ES app installed on Search Head Cluster", func() { /* Test Steps @@ -3028,7 +2972,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s Technology add-on app to S3 test directory for Indexer Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for SHC + // Create App Framework Spec for SHC appSourceNameShc = "appframework-shc-" + testenv.RandomDNSName(3) appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopePremiumApps, appSourceNameShc, s3TestDirShc, 180) @@ -3039,7 +2983,7 @@ var _ = Describe("c3appfw test", func() { }, } - // Create App framework Spec for Indexer Cluster + // Create App Framework Spec for Indexer Cluster appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 180) @@ -3085,10 +3029,8 @@ var _ = Describe("c3appfw test", func() { shc, err := deployment.DeploySearchHeadClusterWithGivenSpec(ctx, deployment.GetName()+"-shc", shSpec) Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/c3/manager_appframework_test.go b/test/appframework_aws/c3/manager_appframework_test.go index 384cf61ec..0fab3e695 100644 --- a/test/appframework_aws/c3/manager_appframework_test.go +++ b/test/appframework_aws/c3/manager_appframework_test.go @@ -54,9 +54,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.S3CloudCleanup(testS3Bucket, uploadedApps), filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -140,7 +138,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -159,15 +157,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -232,15 +228,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -284,7 +278,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) default: fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with provider set as %v", testenv.ClusterProvider)) } // Upload V1 apps to S3 for Monitoring Console @@ -449,7 +443,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -489,7 +483,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -508,15 +502,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -569,15 +561,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -656,7 +646,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -672,10 +662,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -725,9 +713,7 @@ var _ = Describe("c3appfw test", func() { //############# SCALING UP ################### // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -745,8 +731,7 @@ var _ = Describe("c3appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-idxc" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -772,7 +757,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas)) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -819,9 +804,7 @@ var _ = Describe("c3appfw test", func() { //############### SCALING DOWN ################ // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -837,8 +820,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -892,7 +874,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("smoke, c3, managerappframeworkc3, appframework: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -936,7 +918,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -952,10 +934,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -997,10 +977,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1023,7 +1001,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, managerappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them", func() { /* Test Steps @@ -1091,7 +1069,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1101,7 +1079,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -1114,7 +1092,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1133,10 +1111,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1193,10 +1169,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1226,7 +1200,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, managerappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then downgrade them", func() { /* Test Steps @@ -1292,7 +1266,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1302,7 +1276,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1313,7 +1287,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1332,10 +1306,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1408,10 +1380,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1441,7 +1411,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, managerappframeworkc3, appframework: can deploy a C3 SVA instance with App Framework enabled and install above 200MB of apps at once", func() { /* Test Steps @@ -1486,7 +1456,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1502,10 +1472,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1610,7 +1578,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1623,12 +1591,10 @@ var _ = Describe("c3appfw test", func() { shReplicas := 3 testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster") cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App Framework") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1683,10 +1649,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1766,7 +1730,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, managerappframeworkc3, appframework: can deploy a C3 SVA and have apps installed and updated locally on Cluster Manager and Deployer for manual polling", func() { /* Test Steps @@ -1814,7 +1778,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1829,10 +1793,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1874,10 +1836,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1941,7 +1901,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, managerappframeworkc3, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -2007,7 +1967,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -2017,7 +1977,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -2028,7 +1988,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -2046,10 +2006,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2118,10 +2076,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2232,7 +2188,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2361,7 +2317,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2463,7 +2419,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2484,10 +2440,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2553,7 +2507,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2574,10 +2528,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2640,7 +2592,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2655,10 +2607,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2757,7 +2707,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2801,10 +2751,8 @@ var _ = Describe("c3appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2824,7 +2772,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, managerappframeworkc3, appframework: can deploy a C3 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2864,7 +2812,7 @@ var _ = Describe("c3appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to S3 for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion)) s3TestDirShc := "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) @@ -2873,7 +2821,7 @@ var _ = Describe("c3appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2891,10 +2839,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2956,7 +2902,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2980,10 +2926,8 @@ var _ = Describe("c3appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3038,7 +2982,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3063,14 +3007,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3: can deploy a C3 SVA and a Standalone, then add that Standalone as a Search Head to the cluster", func() { /* Test Steps @@ -3131,7 +3075,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, managerappframeworkc3, appframework: can deploy a C3 SVA and have ES app installed on Search Head Cluster", func() { /* Test Steps @@ -3180,7 +3124,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s Technology add-on app to S3 test directory for Indexer Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for SHC + // Create App Framework Spec for SHC appSourceNameShc = "appframework-shc-" + testenv.RandomDNSName(3) appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopePremiumApps, appSourceNameShc, s3TestDirShc, 180) @@ -3191,7 +3135,7 @@ var _ = Describe("c3appfw test", func() { }, } - // Create App framework Spec for Indexer Cluster + // Create App Framework Spec for Indexer Cluster appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 180) @@ -3237,10 +3181,8 @@ var _ = Describe("c3appfw test", func() { shc, err := deployment.DeploySearchHeadClusterWithGivenSpec(ctx, deployment.GetName()+"-shc", shSpec) Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/c3/test_helpers_test.go b/test/appframework_aws/c3/test_helpers_test.go deleted file mode 100644 index 379908bce..000000000 --- a/test/appframework_aws/c3/test_helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package c3appfw - -import ( - "context" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. -func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) -} - -// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. -func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) -} diff --git a/test/appframework_aws/m4/appframework_aws_suite_test.go b/test/appframework_aws/m4/appframework_aws_suite_test.go index 419a76b06..95c94f9d0 100644 --- a/test/appframework_aws/m4/appframework_aws_suite_test.go +++ b/test/appframework_aws/m4/appframework_aws_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -42,10 +41,7 @@ var ( func TestBasic(t *testing.T) { RegisterFailHandler(Fail) - sc, _ := GinkgoConfiguration() - sc.Timeout = 240 * time.Minute - - RunSpecs(t, "Running "+testSuiteName, sc) + RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { diff --git a/test/appframework_aws/m4/appframework_aws_test.go b/test/appframework_aws/m4/appframework_aws_test.go index 45c71f82c..ca5845c9f 100644 --- a/test/appframework_aws/m4/appframework_aws_test.go +++ b/test/appframework_aws/m4/appframework_aws_test.go @@ -61,12 +61,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.S3CloudCleanup(testS3Bucket, uploadedApps), filePresentOnOperator) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and upgrade them", func() { /* Test Steps @@ -107,7 +105,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -143,7 +141,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -159,12 +157,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -235,10 +231,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -271,7 +265,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and downgrade them", func() { /* Test Steps @@ -312,7 +306,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -348,7 +342,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -361,12 +355,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -423,10 +415,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -456,7 +446,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps, scale up clusters, install apps on new pods, scale down", func() { /* Test Steps @@ -511,7 +501,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -526,10 +516,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -571,9 +559,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -591,8 +577,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -661,9 +646,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -679,8 +662,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -728,7 +710,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -770,7 +752,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -785,10 +767,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -830,10 +810,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -853,7 +831,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -897,7 +875,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 0) @@ -933,7 +911,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -944,12 +922,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1001,10 +977,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1097,7 +1071,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1143,7 +1117,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -1157,10 +1131,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1202,10 +1174,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1272,7 +1242,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, masterappframeworkm4, appframework: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1338,7 +1308,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1348,7 +1318,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster master with scope local and append cluster scope + // Create App Framework Spec for Cluster Master with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -1360,7 +1330,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -1380,10 +1350,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1453,10 +1421,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1563,7 +1529,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1576,7 +1542,7 @@ var _ = Describe("m4appfw test", func() { siteCount := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1700,7 +1666,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1714,7 +1680,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1763,7 +1729,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app install is in progress", func() { /* Test Steps @@ -1801,7 +1767,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1813,7 +1779,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1821,10 +1787,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1848,7 +1812,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app download is in progress", func() { /* Test Steps @@ -1886,7 +1850,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1898,7 +1862,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1906,10 +1870,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1933,7 +1895,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install an app, then disable it by using a disabled version of the app and then remove it from app source", func() { /* Test Steps @@ -1969,7 +1931,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1981,12 +1943,10 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2038,7 +1998,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2080,7 +2040,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -2094,10 +2054,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2124,8 +2082,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Master CR with latest config cm = &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Master") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Master") // Set AppsRepoPollInterval for Cluster Master to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Master to 180 seconds") @@ -2135,8 +2092,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2219,7 +2175,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and update apps after app download is completed", func() { /* Test Steps @@ -2266,7 +2222,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 120) @@ -2278,7 +2234,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2338,7 +2294,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, masterappframeworkm4, appframework: can deploy a M4 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2378,7 +2334,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to S3 for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion)) s3TestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) @@ -2387,7 +2343,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2405,10 +2361,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2426,7 +2380,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() { /* Test Steps @@ -2464,7 +2418,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2476,7 +2430,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2487,10 +2441,8 @@ var _ = Describe("m4appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2514,7 +2466,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and check IsDeploymentInProgress for CM and SHC CR's", func() { /* Test Steps @@ -2541,7 +2493,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2553,7 +2505,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") @@ -2566,7 +2518,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/m4/manager_appframework_test.go b/test/appframework_aws/m4/manager_appframework_test.go index 789f9a887..701d7cbb4 100644 --- a/test/appframework_aws/m4/manager_appframework_test.go +++ b/test/appframework_aws/m4/manager_appframework_test.go @@ -60,12 +60,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.S3CloudCleanup(testS3Bucket, uploadedApps), filePresentOnOperator) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and upgrade them", func() { /* Test Steps @@ -106,7 +104,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -142,7 +140,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -158,12 +156,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -234,18 +230,13 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Verify Monitoring Console is Ready and stays in ready state + // Verify Monitoring Console is ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) // Get Pod age to check for pod resets later @@ -270,7 +261,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and downgrade them", func() { /* Test Steps @@ -311,7 +302,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -347,7 +338,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -360,12 +351,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -422,10 +411,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -455,7 +442,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps, scale up clusters, install apps on new pods, scale down", func() { /* Test Steps @@ -510,7 +497,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -525,10 +512,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -570,9 +555,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -590,8 +573,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -660,9 +642,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -678,8 +658,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -689,9 +668,6 @@ var _ = Describe("m4appfw test", func() { err = deployment.UpdateCR(ctx, idxc) Expect(err).To(Succeed(), "Failed to Scale down Indexer Cluster") - // Ensure Indexer cluster scales down and go to ScalingDown phase - testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown, idxcName) - // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -727,7 +703,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -769,7 +745,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -784,10 +760,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -829,10 +803,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -852,7 +824,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -896,7 +868,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 0) @@ -932,7 +904,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -943,12 +915,11 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1000,10 +971,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1023,6 +992,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Modify config map to trigger manual update") config.Data["ClusterManager"] = strings.Replace(config.Data["ClusterManager"], "off", "on", 1) + config.Data["SearchHeadCluster"] = strings.Replace(config.Data["SearchHeadCluster"], "off", "on", 1) err = deployment.UpdateCR(ctx, config) Expect(err).To(Succeed(), "Unable to update config map") @@ -1039,21 +1009,6 @@ var _ = Describe("m4appfw test", func() { config, err = testenv.GetAppframeworkManualUpdateConfigMap(ctx, deployment, testcaseEnvInst.GetName()) Expect(err).To(Succeed(), "Unable to get config map for manual poll") - testcaseEnvInst.Log.Info("Modify config map to trigger manual update") - config.Data["SearchHeadCluster"] = strings.Replace(config.Data["SearchHeadCluster"], "off", "on", 1) - err = deployment.UpdateCR(ctx, config) - Expect(err).To(Succeed(), "Unable to update config map") - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify RF SF is met - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - testcaseEnvInst.Log.Info("Get config map for triggering manual update") - config, err = testenv.GetAppframeworkManualUpdateConfigMap(ctx, deployment, testcaseEnvInst.GetName()) - Expect(err).To(Succeed(), "Unable to get config map for manual poll") - testcaseEnvInst.Log.Info("Modify config map to trigger manual update") config.Data["MonitoringConsole"] = strings.Replace(config.Data["MonitoringConsole"], "off", "on", 1) err = deployment.UpdateCR(ctx, config) @@ -1076,7 +1031,7 @@ var _ = Describe("m4appfw test", func() { Expect(strings.Contains(config.Data["ClusterManager"], "status: off") && strings.Contains(config.Data["SearchHeadCluster"], "status: off") && strings.Contains(config.Data["MonitoringConsole"], "status: off")).To(Equal(true), "Config map update not complete") - // ############ VERIFY APPS UPDATED TO V2 ############# + //############### UPGRADE APPS ################ appVersion = "V2" cmAppSourceInfo.CrAppVersion = appVersion cmAppSourceInfo.CrAppList = appListV2 @@ -1095,7 +1050,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1141,7 +1096,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -1155,10 +1110,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1200,10 +1153,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1247,7 +1198,7 @@ var _ = Describe("m4appfw test", func() { // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) - // ########## Verify Manual Poll config map disabled after the poll is triggered ################# + // ########## Verify Manual Poll disabled after the poll is triggered ################# // Verify config map set back to off after poll trigger testcaseEnvInst.Log.Info(fmt.Sprintf("Verify config map set back to off after poll trigger for %s app", appVersion)) @@ -1270,8 +1221,8 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { - It("m4, integration, managerappframeworkm4, appframework: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + It("integration, m4, managerappframeworkm4, appframework: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps ################## SETUP #################### @@ -1336,7 +1287,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1346,7 +1297,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -1358,7 +1309,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultS3Region())} @@ -1378,10 +1329,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1451,10 +1400,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1487,281 +1434,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (M4) and App Framework", func() { - It("integration, m4, managerappframeworkm4, appframework: can deploy a M4, add new apps to app source while install is in progress and have all apps installed locally on Cluster Manager and Deployer", func() { - - /* Test Steps - ################## SETUP #################### - * Upload V1 apps to S3 for Monitoring Console - * Create app source for Monitoring Console - * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload big-size app to S3 for Indexer Cluster and Search Head Cluster - * Create app sources for Cluster Manager and Deployer - * Prepare and deploy M4 CRD with app framework - * Verify app installation is in progress on Cluster Manager and Deployer - * Upload more apps from S3 during bigger app install - * Wait for polling interval to pass - * Verify all apps are installed on Cluster Manager and Deployer - */ - - //################## SETUP #################### - // Upload V1 apps to S3 for Monitoring Console - appVersion := "V1" - appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Monitoring Console", appVersion)) - s3TestDirMC := "m4appfw-mc-" + testenv.RandomDNSName(4) - uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Prepare Monitoring Console spec with its own app source - appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) - appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) - appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) - - mcSpec := enterpriseApi.MonitoringConsoleSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - }, - AppFrameworkConfig: appFrameworkSpecMC, - } - - // Deploy Monitoring Console - testcaseEnvInst.Log.Info("Deploy Monitoring Console") - mcName := deployment.GetName() - mc, err := deployment.DeployMonitoringConsoleWithGivenSpec(ctx, testcaseEnvInst.GetName(), mcName, mcSpec) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Download all test apps from S3 - appList := append(testenv.BigSingleApp, testenv.ExtraApps...) - appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download apps") - - // Upload big-size app to S3 for Cluster Manager - appList = testenv.BigSingleApp - appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload big-size app to S3 for Cluster Manager") - s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Cluster Manager") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Upload big-size app to S3 for Search Head Cluster - testcaseEnvInst.Log.Info("Upload big-size app to S3 for Search Head Cluster") - s3TestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Create App framework Spec for M4 - appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) - appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) - appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) - appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) - appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 60) - appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopeLocal, appSourceNameShc, s3TestDirShc, 60) - - // Deploy M4 CRD - testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster with Search Head Cluster") - siteCount := 3 - indexersPerSite := 1 - cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Verify App installation is in progress on Cluster Manager - testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) - - // Upload more apps to S3 for Cluster Manager - appList = testenv.ExtraApps - appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload more apps to S3 for Cluster Manager") - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to S3 test directory for Cluster Manager") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Upload more apps to S3 for Deployer - testcaseEnvInst.Log.Info("Upload more apps to S3 for Deployer") - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to S3 test directory for Deployer") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Wait for polling interval to pass - testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - - // Verify all apps are installed on Cluster Manager - appList = append(testenv.BigSingleApp, testenv.ExtraApps...) - appFileList = testenv.GetAppFileList(appList) - cmPod := []string{fmt.Sprintf(testenv.ClusterManagerPod, deployment.GetName())} - testcaseEnvInst.Log.Info(fmt.Sprintf("Verify all apps %v are installed on Cluster Manager", appList)) - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), cmPod, appList, true, "enabled", false, false) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Wait for SearchHeadCluster to reach Ready phase - err = testcaseEnvInst.WaitForSearchHeadClusterPhase(ctx, deployment, testcaseEnvInst.GetName(), shc.Name, enterpriseApi.PhaseReady, 60*time.Second) - Expect(err).To(Succeed(), "Timed out waiting for SearchHeadCluster to reach Ready phase") - - // Wait for polling interval to pass - testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName()+"-shc", shc.Kind, appSourceNameShc, appFileList) - - // Verify all apps are installed on Deployer - deployerPod := []string{fmt.Sprintf(testenv.DeployerPod, deployment.GetName())} - testcaseEnvInst.Log.Info(fmt.Sprintf("Verify all apps %v are installed on Deployer", appList)) - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), deployerPod, appList, true, "enabled", false, false) - }) - }) - - Context("Single Site Indexer Cluster with Search Head Cluster (M4) and App Framework", func() { - It("smoke, m4, managerappframeworkm4, appframework: can deploy a M4, add new apps to app source while install is in progress and have all apps installed cluster-wide", func() { - - /* Test Steps - ################## SETUP #################### - * Upload V1 apps to S3 for Monitoring Console - * Create app source for Monitoring Console - * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload big-size app to S3 for Indexer Cluster and Search Head Cluster - * Create app sources for Cluster Manager and Deployer - * Prepare and deploy M4 CRD with app framework and wait for the pods to be ready - ############## VERIFICATIONS ################ - * Verify App installation is in progress on Cluster Manager and Deployer - * Upload more apps from S3 during bigger app install - * Wait for polling interval to pass - * Verify all apps are installed on Cluster Manager and Deployer - */ - - //################## SETUP #################### - // Upload V1 apps to S3 for Monitoring Console - appVersion := "V1" - appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Monitoring Console", appVersion)) - s3TestDirMC := "m4appfw-mc-" + testenv.RandomDNSName(4) - uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Prepare Monitoring Console spec with its own app source - appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) - appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) - appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) - - mcSpec := enterpriseApi.MonitoringConsoleSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Spec: enterpriseApi.Spec{ - ImagePullPolicy: "IfNotPresent", - Image: testcaseEnvInst.GetSplunkImage(), - }, - Volumes: []corev1.Volume{}, - }, - AppFrameworkConfig: appFrameworkSpecMC, - } - - // Deploy Monitoring Console - testcaseEnvInst.Log.Info("Deploy Monitoring Console") - mcName := deployment.GetName() - mc, err := deployment.DeployMonitoringConsoleWithGivenSpec(ctx, testcaseEnvInst.GetName(), mcName, mcSpec) - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console") - - // Verify Monitoring Console is ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Download all test apps from S3 - appList := append(testenv.BigSingleApp, testenv.ExtraApps...) - appFileList = testenv.GetAppFileList(appList) - err = testenv.DownloadFilesFromS3(testDataS3Bucket, testenv.AppLocationV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download apps") - - // Upload big-size app to S3 for Cluster Manager - appList = testenv.BigSingleApp - appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload big-size app to S3 for Cluster Manager") - s3TestDirIdxc = "m4appfw-idxc-" + testenv.RandomDNSName(4) - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Cluster Manager") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Upload big-size app to S3 for Search Head Cluster - testcaseEnvInst.Log.Info("Upload big-size app to S3 for Search Head Cluster") - s3TestDirShc = "m4appfw-shc-" + testenv.RandomDNSName(4) - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Search Head Cluster") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Create App framework Spec for M4 - appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) - appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) - appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) - appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) - appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) - appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopeCluster, appSourceNameShc, s3TestDirShc, 60) - - // Deploy M4 CRD - testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster with Search Head Cluster") - siteCount := 3 - shReplicas := 3 - indexersPerSite := 1 - cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Verify App installation is in progress - testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) - - // Upload more apps to S3 for Cluster Manager - appList = testenv.ExtraApps - appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload more apps to S3 for Cluster Manager") - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to S3 test directory for Cluster Manager") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Upload more apps to S3 for Deployer - testcaseEnvInst.Log.Info("Upload more apps to S3 for Deployer") - uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to S3 test directory for Deployer") - uploadedApps = append(uploadedApps, uploadedFiles...) - - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Wait for polling interval to pass - testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - - // Ensure the Indexers of all sites go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Verify all apps are installed on indexers - appList = append(testenv.BigSingleApp, testenv.ExtraApps...) - appFileList = testenv.GetAppFileList(appList) - idxcPodNames := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), indexersPerSite, true, siteCount) - testcaseEnvInst.Log.Info(fmt.Sprintf("Verify all apps %v are installed on indexers", appList)) - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), idxcPodNames, appList, true, "enabled", false, true) - - // Ensure Search Head Cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Wait for polling interval to pass - testcaseEnvInst.WaitForAppInstall(ctx, deployment, deployment.GetName()+"-shc", shc.Kind, appSourceNameShc, appFileList) - - // Verify all apps are installed on Search Heads - shcPodNames := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), shReplicas, false, 1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Verify all apps %v are installed on Search Heads", appList)) - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), shcPodNames, appList, true, "enabled", false, true) - - }) - }) - - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app install is in progress", func() { /* Test Steps @@ -1799,7 +1472,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1811,18 +1484,16 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager - testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) + testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1846,7 +1517,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app download is in progress", func() { /* Test Steps @@ -1884,7 +1555,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1896,7 +1567,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1904,10 +1575,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1931,7 +1600,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install an app, then disable it by using a disabled version of the app and then remove it from app source", func() { /* Test Steps @@ -1967,7 +1636,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1979,12 +1648,10 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2036,7 +1703,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2078,7 +1745,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -2092,10 +1759,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2122,8 +1787,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Manager CR with latest config cm = &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Manager") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Manager") // Set AppsRepoPollInterval for Cluster Manager to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Manager to 180 seconds") @@ -2133,8 +1797,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2217,7 +1880,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and update apps after app download is completed", func() { /* Test Steps @@ -2264,7 +1927,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 120) @@ -2276,7 +1939,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2336,7 +1999,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, managerappframeworkm4, appframework: can deploy a M4 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2376,7 +2039,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to S3 for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion)) s3TestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) @@ -2385,7 +2048,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2428,7 +2091,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() { /* Test Steps @@ -2466,7 +2129,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2478,7 +2141,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2489,10 +2152,8 @@ var _ = Describe("m4appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2516,7 +2177,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4, managerappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and check IsDeploymentInProgress for CM and SHC CR's", func() { /* Test Steps @@ -2543,7 +2204,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2555,7 +2216,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") @@ -2568,7 +2229,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_aws/m4/test_helpers_test.go b/test/appframework_aws/m4/test_helpers_test.go deleted file mode 100644 index 40cf1603a..000000000 --- a/test/appframework_aws/m4/test_helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package m4appfw - -import ( - "context" - - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. -func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} - -// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). -func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} diff --git a/test/appframework_aws/s1/appframework_aws_suite_test.go b/test/appframework_aws/s1/appframework_aws_suite_test.go index 32bf5f13b..ef3f14fe8 100644 --- a/test/appframework_aws/s1/appframework_aws_suite_test.go +++ b/test/appframework_aws/s1/appframework_aws_suite_test.go @@ -17,7 +17,6 @@ import ( "os" "path/filepath" "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -42,10 +41,7 @@ var ( func TestBasic(t *testing.T) { RegisterFailHandler(Fail) - sc, _ := GinkgoConfiguration() - sc.Timeout = 240 * time.Minute - - RunSpecs(t, "Running "+testSuiteName, sc) + RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { diff --git a/test/appframework_aws/s1/appframework_aws_test.go b/test/appframework_aws/s1/appframework_aws_test.go index c41e1658b..3b044274a 100644 --- a/test/appframework_aws/s1/appframework_aws_test.go +++ b/test/appframework_aws/s1/appframework_aws_test.go @@ -52,9 +52,7 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.S3CloudCleanup(testS3Bucket, uploadedApps), filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { @@ -102,7 +100,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -136,7 +134,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -157,7 +155,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -282,7 +280,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -306,7 +304,7 @@ var _ = Describe("s1appfw test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -326,7 +324,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -453,7 +451,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Standalone", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -483,7 +481,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -503,7 +501,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -538,8 +536,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -571,8 +568,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale down Standalone") scaledReplicaCount = 1 standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone after scaling down") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone after scaling down") standalone.Spec.Replicas = int32(scaledReplicaCount) err = deployment.UpdateCR(ctx, standalone) @@ -641,7 +637,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -658,7 +654,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -678,8 +674,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -754,7 +749,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload ES app to S3 test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopePremiumApps, appSourceName, s3TestDir, 60) appFrameworkSpec.AppSources[0].PremiumAppsProps = enterpriseApi.PremiumAppsProps{ @@ -777,7 +772,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone with App Framework") // Ensure Standalone goes to Ready phase testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -866,7 +861,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -946,7 +941,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 0) @@ -975,7 +970,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 0) @@ -995,7 +990,7 @@ var _ = Describe("s1appfw test", func() { // Create Standalone Deployment with App Framework standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1138,7 +1133,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1152,7 +1147,7 @@ var _ = Describe("s1appfw test", func() { AppFrameworkConfig: appFrameworkSpec, } - // Create App framework Spec + // Create App Framework Spec appSourceNameStandalone2 := "appframework-2-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameStandalone2 := "appframework-test-volume-2-" + testenv.RandomDNSName(3) appFrameworkSpecStandalone2 := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameStandalone2, enterpriseApi.ScopeLocal, appSourceNameStandalone2, s3TestDirStandalone2, 60) @@ -1222,7 +1217,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -1261,7 +1256,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1281,7 +1276,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App installation is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1338,7 +1333,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1355,7 +1350,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // ############ Verify livenessProbe and readinessProbe config object and scripts############ testcaseEnvInst.Log.Info("Get config map for livenessProbe and readinessProbe") @@ -1428,7 +1423,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1445,7 +1440,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1501,7 +1496,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1519,7 +1514,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1581,7 +1576,7 @@ var _ = Describe("s1appfw test", func() { * Verify no pod resets triggered due to app install * Verify App enabled and version by running splunk cmd // ############ Modify secret key ########### - * Create App framework volume with random credentials and apply to Spec + * Create App Framework volume with random credentials and apply to Spec * Check for changes in App phase to determine if next poll has been triggered ############ UPGRADE V2 APPS ########### * Upload V2 apps to S3 App Source @@ -1612,7 +1607,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1631,7 +1626,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) secretref := standalone.Spec.AppFrameworkConfig.VolList[0].SecretRef - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), secretref) Expect(err).To(Succeed(), "Unable to obtain secret object") @@ -1651,7 +1646,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") // ############ Modify secret key ########### - // Create App framework volume with invalid credentials and apply to Spec + // Create App Framework volume with invalid credentials and apply to Spec testcaseEnvInst.Log.Info("Update Standalone spec with invalid credentials") err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), secretref, modifiedSecretData) Expect(err).To(Succeed(), "Unable to update secret Object") @@ -1733,7 +1728,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload app to S3 test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 120) spec := enterpriseApi.StandaloneSpec{ @@ -1750,7 +1745,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1828,7 +1823,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 15 - // Create App framework Spec + // Create App Framework Spec appSourceName := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1892,7 +1887,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to S3 test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1909,7 +1904,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App Download is completed on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1963,7 +1958,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -2001,7 +1996,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -2022,7 +2017,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Standalone CR testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, deployment.GetName(), standalone.Kind) diff --git a/test/appframework_az/c3/appframework_azure_test.go b/test/appframework_az/c3/appframework_azure_test.go index 98459a8c4..b20c56c44 100644 --- a/test/appframework_az/c3/appframework_azure_test.go +++ b/test/appframework_az/c3/appframework_azure_test.go @@ -52,10 +52,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - azureBlobClient := &testenv.AzureBlobClient{} - azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.AzureCloudCleanup(ctx, uploadedApps), filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -141,7 +138,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -160,15 +157,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -226,15 +221,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -300,7 +293,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -340,7 +333,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -359,15 +352,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -421,15 +412,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -508,7 +497,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -524,10 +513,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -567,9 +554,7 @@ var _ = Describe("c3appfw test", func() { //############# SCALING UP ################### // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -587,8 +572,7 @@ var _ = Describe("c3appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-idxc" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -610,7 +594,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas)) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -649,9 +633,7 @@ var _ = Describe("c3appfw test", func() { //############### SCALING DOWN ################ // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -667,8 +649,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -718,7 +699,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("smoke, c3azure, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -762,7 +743,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -778,10 +759,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -824,10 +803,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -850,7 +827,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and have ES app installed on Search Head Cluster", func() { /* Test Steps @@ -900,7 +877,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Indexer Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for SHC + // Create App Framework Spec for SHC appSourceNameShc = "appframework-shc-" + testenv.RandomDNSName(3) appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopePremiumApps, appSourceNameShc, azTestDirShc, 60) @@ -911,7 +888,7 @@ var _ = Describe("c3appfw test", func() { }, } - // Create App framework Spec for Indexer Cluster + // Create App Framework Spec for Indexer Cluster appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -957,10 +934,8 @@ var _ = Describe("c3appfw test", func() { shc, err := deployment.DeploySearchHeadClusterWithGivenSpec(ctx, deployment.GetName()+"-shc", shSpec) Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1003,10 +978,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName()+"-shc", shc.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1023,7 +996,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them", func() { /* Test Steps @@ -1091,7 +1064,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1101,7 +1074,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1114,7 +1087,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1133,10 +1106,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1210,10 +1181,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1243,7 +1212,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then downgrade them", func() { /* Test Steps @@ -1312,7 +1281,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1322,7 +1291,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1333,7 +1302,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1352,10 +1321,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1417,10 +1384,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1450,7 +1415,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA instance with App Framework enabled and install above 200MB of apps at once", func() { /* Test Steps @@ -1496,7 +1461,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1512,10 +1477,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1620,7 +1583,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1633,12 +1596,10 @@ var _ = Describe("c3appfw test", func() { shReplicas := 3 testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster") cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App Framework") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1694,10 +1655,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1777,7 +1736,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and have apps installed and updated locally on Cluster Manager and Deployer for manual polling", func() { /* Test Steps @@ -1825,7 +1784,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1840,10 +1799,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1886,10 +1843,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1953,7 +1908,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -2019,7 +1974,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -2029,7 +1984,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -2040,7 +1995,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -2058,10 +2013,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2131,10 +2084,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2246,7 +2197,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2376,7 +2327,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2479,7 +2430,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2500,10 +2451,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2570,7 +2519,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2591,10 +2540,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2658,7 +2605,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2673,10 +2620,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2778,7 +2723,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2822,10 +2767,8 @@ var _ = Describe("c3appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2845,7 +2788,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2881,7 +2824,7 @@ var _ = Describe("c3appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to Azure for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search Head Cluster", appVersion)) azTestDirShc := "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToAzure(ctx, testenv.StorageAccount, testenv.StorageAccountKey, downloadDirV1, azTestDirShc, appFileList) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) @@ -2890,7 +2833,7 @@ var _ = Describe("c3appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2908,10 +2851,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2974,7 +2915,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2998,10 +2939,8 @@ var _ = Describe("c3appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3056,7 +2995,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3081,14 +3020,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, masterappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and a Standalone, then add that Standalone as a Search Head to the cluster", func() { /* Test Steps diff --git a/test/appframework_az/c3/manager_appframework_azure_test.go b/test/appframework_az/c3/manager_appframework_azure_test.go index 533bc20dc..17092862c 100644 --- a/test/appframework_az/c3/manager_appframework_azure_test.go +++ b/test/appframework_az/c3/manager_appframework_azure_test.go @@ -51,10 +51,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - azureBlobClient := &testenv.AzureBlobClient{} - azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.AzureCloudCleanup(ctx, uploadedApps), filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -139,7 +136,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -158,15 +155,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -224,15 +219,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -298,7 +291,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -338,7 +331,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -357,15 +350,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -419,15 +410,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -506,7 +495,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -522,10 +511,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -565,9 +552,7 @@ var _ = Describe("c3appfw test", func() { //############# SCALING UP ################### // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -585,8 +570,7 @@ var _ = Describe("c3appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-idxc" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -608,7 +592,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas)) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -647,9 +631,7 @@ var _ = Describe("c3appfw test", func() { //############### SCALING DOWN ################ // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -665,8 +647,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -716,7 +697,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, managerappframeworkazurec3, appframeworkazure, azure_sanity: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -760,7 +741,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -776,10 +757,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -822,10 +801,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -848,7 +825,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and have ES app installed on Search Head Cluster", func() { /* Test Steps @@ -898,7 +875,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Indexer Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for SHC + // Create App Framework Spec for SHC appSourceNameShc = "appframework-shc-" + testenv.RandomDNSName(3) appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopePremiumApps, appSourceNameShc, azTestDirShc, 60) @@ -909,7 +886,7 @@ var _ = Describe("c3appfw test", func() { }, } - // Create App framework Spec for Indexer Cluster + // Create App Framework Spec for Indexer Cluster appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -955,10 +932,8 @@ var _ = Describe("c3appfw test", func() { shc, err := deployment.DeploySearchHeadClusterWithGivenSpec(ctx, deployment.GetName()+"-shc", shSpec) Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1001,10 +976,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName()+"-shc", shc.Kind, appSourceNameShc, appFileList) - // // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1022,7 +995,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration,managerappframeworkazurec3, appframeworkazure, azure_sanity: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them", func() { /* Test Steps @@ -1090,7 +1063,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1100,7 +1073,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1113,7 +1086,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1132,10 +1105,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1209,10 +1180,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1242,7 +1211,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration,managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then downgrade them", func() { /* Test Steps @@ -1311,7 +1280,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1321,7 +1290,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1332,7 +1301,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1351,10 +1320,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1417,10 +1384,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1450,7 +1415,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA instance with App Framework enabled and install above 200MB of apps at once", func() { /* Test Steps @@ -1496,7 +1461,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1512,10 +1477,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1620,7 +1583,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1633,12 +1596,10 @@ var _ = Describe("c3appfw test", func() { shReplicas := 3 testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster") cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App Framework") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1694,10 +1655,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1777,7 +1736,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3azure, managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and have apps installed and updated locally on Cluster Manager and Deployer for manual polling", func() { /* Test Steps @@ -1825,7 +1784,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1840,10 +1799,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1886,10 +1843,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1953,7 +1908,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration,managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -2019,7 +1974,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -2029,7 +1984,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -2040,7 +1995,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -2058,10 +2013,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2131,10 +2084,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2246,7 +2197,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2376,7 +2327,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2479,7 +2430,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2500,10 +2451,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2570,7 +2519,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2591,10 +2540,8 @@ var _ = Describe("c3appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2658,7 +2605,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2673,10 +2620,8 @@ var _ = Describe("c3appfw test", func() { cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2778,7 +2723,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2822,10 +2767,8 @@ var _ = Describe("c3appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2845,7 +2788,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration,managerappframeworkazurec3, appframeworkazure: can deploy a C3 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2881,7 +2824,7 @@ var _ = Describe("c3appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to Azure for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search Head Cluster", appVersion)) azTestDirShc := "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToAzure(ctx, testenv.StorageAccount, testenv.StorageAccountKey, downloadDirV1, azTestDirShc, appFileList) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) @@ -2890,7 +2833,7 @@ var _ = Describe("c3appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2908,10 +2851,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2974,7 +2915,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2998,10 +2939,8 @@ var _ = Describe("c3appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -3056,7 +2995,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3081,14 +3020,14 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3: can deploy a C3 SVA and a Standalone, then add that Standalone as a Search Head to the cluster", func() { /* Test Steps diff --git a/test/appframework_az/c3/test_helpers_test.go b/test/appframework_az/c3/test_helpers_test.go deleted file mode 100644 index f1d418225..000000000 --- a/test/appframework_az/c3/test_helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package azurec3appfw - -import ( - "context" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. -func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) -} - -// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. -func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) -} diff --git a/test/appframework_az/m4/appframework_azure_test.go b/test/appframework_az/m4/appframework_azure_test.go index 1a5afe208..e8ede677d 100644 --- a/test/appframework_az/m4/appframework_azure_test.go +++ b/test/appframework_az/m4/appframework_azure_test.go @@ -60,13 +60,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - azureBlobClient := &testenv.AzureBlobClient{} - azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.AzureCloudCleanup(ctx, uploadedApps), filePresentOnOperator) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled, install apps and upgrade them", func() { /* Test Steps @@ -107,7 +104,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -143,7 +140,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -159,17 +156,15 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -220,10 +215,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -256,7 +249,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled, install apps and downgrade them", func() { /* Test Steps @@ -297,7 +290,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -333,7 +326,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -346,12 +339,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -409,10 +400,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -442,7 +431,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled, install apps, scale up clusters, install apps on new pods, scale down", func() { /* Test Steps @@ -497,7 +486,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -512,10 +501,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -547,9 +534,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -567,8 +552,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -629,9 +613,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -647,8 +629,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -696,7 +677,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -738,7 +719,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 60) @@ -753,10 +734,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -799,10 +778,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -822,7 +799,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -866,7 +843,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 0) @@ -902,7 +879,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 0) @@ -913,12 +890,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -970,10 +945,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1065,7 +1038,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1111,7 +1084,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 0) @@ -1125,10 +1098,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1171,10 +1142,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1241,7 +1210,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4azure, integration, masterappframeworkazurem4, appframeworkazure: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1307,7 +1276,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1317,7 +1286,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster master with scope local and append cluster scope + // Create App Framework Spec for Cluster Master with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1329,7 +1298,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1349,10 +1318,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1423,10 +1390,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1534,7 +1499,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1547,7 +1512,7 @@ var _ = Describe("m4appfw test", func() { siteCount := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1671,7 +1636,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1685,7 +1650,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1734,7 +1699,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled and reset operator pod while app install is in progress", func() { /* Test Steps @@ -1773,7 +1738,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1785,7 +1750,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1793,10 +1758,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1820,7 +1783,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled and reset operator pod while app download is in progress", func() { /* Test Steps @@ -1859,7 +1822,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1871,7 +1834,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1879,10 +1842,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1906,7 +1867,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled, install an app, then disable it by using a disabled version of the app and then remove it from app source", func() { /* Test Steps @@ -1943,7 +1904,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1955,12 +1916,10 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2014,7 +1973,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2056,7 +2015,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 0) @@ -2070,10 +2029,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2100,8 +2057,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Master CR with latest config cm = &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Master") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Master") // Set AppsRepoPollInterval for Cluster Master to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Master to 180 seconds") @@ -2111,8 +2067,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2196,7 +2151,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled and update apps after app download is completed", func() { /* Test Steps @@ -2244,7 +2199,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 120) @@ -2256,7 +2211,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2287,10 +2242,8 @@ var _ = Describe("m4appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2309,7 +2262,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4azure, integration, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2345,7 +2298,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to Azure for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search Head Cluster", appVersion)) azTestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToAzure(ctx, testenv.StorageAccount, testenv.StorageAccountKey, downloadDirV1, azTestDirShc, appFileList) Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory for Search Head Cluster") @@ -2354,7 +2307,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2372,10 +2325,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2393,7 +2344,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() { /* Test Steps @@ -2432,7 +2383,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -2444,7 +2395,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2455,10 +2406,8 @@ var _ = Describe("m4appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2482,7 +2431,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("smoke, m4azure, masterappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled, install apps and check IsDeploymentInProgress for CM and SHC CR's", func() { /* Test Steps @@ -2509,7 +2458,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -2521,7 +2470,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") @@ -2534,7 +2483,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/m4/manager_appframework_azure_test.go b/test/appframework_az/m4/manager_appframework_azure_test.go index 405fb820e..d82223754 100644 --- a/test/appframework_az/m4/manager_appframework_azure_test.go +++ b/test/appframework_az/m4/manager_appframework_azure_test.go @@ -59,10 +59,7 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - azureBlobClient := &testenv.AzureBlobClient{} - azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.AzureCloudCleanup(ctx, uploadedApps), filePresentOnOperator) }) Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { @@ -106,7 +103,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -142,7 +139,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -158,17 +155,15 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -219,10 +214,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -296,7 +289,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -332,7 +325,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -345,12 +338,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -408,10 +399,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -496,7 +485,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -511,10 +500,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -546,9 +533,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -566,8 +551,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -628,9 +612,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -646,8 +628,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -695,7 +676,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, managerappframeworkazurem4, appframeworkazure: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -737,7 +718,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 60) @@ -752,10 +733,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -798,10 +777,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -821,7 +798,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, managerappframeworkazurem4, appframeworkazure: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -865,7 +842,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 0) @@ -901,7 +878,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 0) @@ -912,12 +889,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -969,10 +944,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1064,7 +1037,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, managerappframeworkazurem4, appframeworkazure: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1110,7 +1083,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 0) @@ -1124,10 +1097,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1170,10 +1141,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1240,7 +1209,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4azure, integration, managerappframeworkazurem4, appframeworkazure: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1306,7 +1275,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1316,7 +1285,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, azTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameIdxcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1328,7 +1297,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, azTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, azTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpecAzure(appSourceVolumeNameShcCluster, testenv.GetAzureEndpoint(ctx), testcaseEnvInst.GetIndexSecretName(), "azure", "blob")} @@ -1348,10 +1317,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1422,10 +1389,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1533,7 +1498,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1546,7 +1511,7 @@ var _ = Describe("m4appfw test", func() { siteCount := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1671,7 +1636,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1685,7 +1650,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1773,7 +1738,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1785,7 +1750,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1793,10 +1758,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1859,7 +1822,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1871,7 +1834,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1879,10 +1842,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1943,7 +1904,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -1955,12 +1916,10 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2014,7 +1973,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4azure, managerappframeworkazurem4, appframeworkazure: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2056,7 +2015,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 0) @@ -2070,10 +2029,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2100,8 +2057,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Master CR with latest config cm = &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Master") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Master") // Set AppsRepoPollInterval for Cluster Master to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Master to 180 seconds") @@ -2111,8 +2067,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2244,7 +2199,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, azTestDirIdxc, 120) @@ -2256,7 +2211,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2287,10 +2242,8 @@ var _ = Describe("m4appfw test", func() { appFileList = testenv.GetAppFileList(appListV2) testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2345,7 +2298,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to Azure for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Azure for Search Head Cluster", appVersion)) azTestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToAzure(ctx, testenv.StorageAccount, testenv.StorageAccountKey, downloadDirV1, azTestDirShc, appFileList) Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory for Search Head Cluster") @@ -2354,7 +2307,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2372,10 +2325,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2432,7 +2383,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to Azure test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -2444,7 +2395,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2455,10 +2406,8 @@ var _ = Describe("m4appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure that the Cluster Manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2509,7 +2458,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, azTestDirIdxc, 60) @@ -2521,7 +2470,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") @@ -2534,7 +2483,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_az/m4/test_helpers_test.go b/test/appframework_az/m4/test_helpers_test.go deleted file mode 100644 index 9e23a067c..000000000 --- a/test/appframework_az/m4/test_helpers_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package azurem4appfw - -import ( - "context" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. -func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} - -// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). -func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} - -// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. -func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) -} diff --git a/test/appframework_az/s1/appframework_azure_test.go b/test/appframework_az/s1/appframework_azure_test.go index cb084e554..d43a24954 100644 --- a/test/appframework_az/s1/appframework_azure_test.go +++ b/test/appframework_az/s1/appframework_azure_test.go @@ -48,10 +48,7 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - azureBlobClient := &testenv.AzureBlobClient{} - azureBlobClient.DeleteFilesOnAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.AzureCloudCleanup(ctx, uploadedApps), filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { @@ -102,7 +99,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -135,7 +132,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Standalone", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -156,7 +153,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -271,7 +268,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -295,7 +292,7 @@ var _ = Describe("s1appfw test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -315,7 +312,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -445,7 +442,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Standalone", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -476,7 +473,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -496,7 +493,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -521,8 +518,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -546,8 +542,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale down Standalone") scaledReplicaCount = 1 standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone after scaling down") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone after scaling down") standalone.Spec.Replicas = int32(scaledReplicaCount) err = deployment.UpdateCR(ctx, standalone) @@ -617,7 +612,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -634,7 +629,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -654,8 +649,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -733,7 +727,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload ES app to Azure test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopePremiumApps, appSourceName, azTestDir, 60) appFrameworkSpec.AppSources[0].PremiumAppsProps = enterpriseApi.PremiumAppsProps{ @@ -756,7 +750,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone with App Framework") // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -843,7 +837,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -923,7 +917,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 0) @@ -952,7 +946,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 0) @@ -972,7 +966,7 @@ var _ = Describe("s1appfw test", func() { // Create Standalone Deployment with App Framework standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1105,7 +1099,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to Azure test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1119,7 +1113,7 @@ var _ = Describe("s1appfw test", func() { AppFrameworkConfig: appFrameworkSpec, } - // Create App framework Spec + // Create App Framework Spec appSourceNameStandalone2 := "appframework-2-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameStandalone2 := "appframework-test-volume-2-" + testenv.RandomDNSName(3) appFrameworkSpecStandalone2 := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameStandalone2, enterpriseApi.ScopeLocal, appSourceNameStandalone2, azTestDirStandalone2, 60) @@ -1189,7 +1183,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -1229,7 +1223,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1249,7 +1243,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App installation is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1308,7 +1302,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1325,7 +1319,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App installation is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1379,7 +1373,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1396,7 +1390,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1453,7 +1447,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1471,7 +1465,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1535,7 +1529,7 @@ var _ = Describe("s1appfw test", func() { * Verify no pod resets triggered due to app install * Verify App enabled and version by running splunk cmd // ############ Modify secret key ########### - * Create App framework volume with random credentials and apply to Spec + * Create App Framework volume with random credentials and apply to Spec * Check for changes in App phase to determine if next poll has been triggered ############ UPGRADE V2 APPS ########### * Upload V2 apps to Azure App Source @@ -1566,7 +1560,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1585,7 +1579,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) secretref := standalone.Spec.AppFrameworkConfig.VolList[0].SecretRef - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") secretStruct, _ := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), secretref) secretData := secretStruct.Data @@ -1604,7 +1598,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") // ############ Modify secret key ########### - // Create App framework volume with invalid credentials and apply to Spec + // Create App Framework volume with invalid credentials and apply to Spec testcaseEnvInst.Log.Info("Update Standalone spec with invalid credentials") err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), secretref, modifiedSecretData) Expect(err).To(Succeed(), "Unable to update secret Object") @@ -1688,7 +1682,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload app to Azure test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 120) spec := enterpriseApi.StandaloneSpec{ @@ -1705,7 +1699,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1782,7 +1776,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 15 - // Create App framework Spec + // Create App Framework Spec appSourceName := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1847,7 +1841,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to Azure test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1864,7 +1858,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App Download is completed on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1918,7 +1912,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Azure test directory for Monitoring Console", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, azTestDirMC, 60) @@ -1956,7 +1950,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, azTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1977,7 +1971,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Standalone CR testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, deployment.GetName(), standalone.Kind) diff --git a/test/appframework_gcp/c3/appframework_gcs_test.go b/test/appframework_gcp/c3/appframework_gcs_test.go index e49b34bd9..a9250959a 100644 --- a/test/appframework_gcp/c3/appframework_gcs_test.go +++ b/test/appframework_gcp/c3/appframework_gcs_test.go @@ -57,9 +57,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.GCPCloudCleanup(testGcsBucket, uploadedApps), filePresentOnOperator) }) Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -143,7 +141,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -162,15 +160,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify no SH in disconnected status is present on CM testcaseEnvInst.VerifyNoDisconnectedSHPresentOnCM(ctx, deployment) @@ -235,15 +231,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -309,7 +303,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -349,7 +343,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -368,15 +362,13 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -429,15 +421,13 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - verifyMCVersionChangedAndReady(ctx, testcaseEnvInst, deployment, mc, resourceVersion) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -460,7 +450,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It(" c3gcp, masterappframeworkc3gcp, c3_gcp_sanity: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -504,7 +494,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -520,10 +510,8 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -565,10 +553,8 @@ var _ = Describe("c3appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -621,7 +607,7 @@ var _ = Describe("c3appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -646,7 +632,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyC3ClusterReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_gcp/c3/manager_appframework_test.go b/test/appframework_gcp/c3/manager_appframework_test.go index 7d2ceabb7..cb492d28e 100644 --- a/test/appframework_gcp/c3/manager_appframework_test.go +++ b/test/appframework_gcp/c3/manager_appframework_test.go @@ -55,9 +55,7 @@ var _ = Describe("c3appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.GCPCloudCleanup(testGcsBucket, uploadedApps), filePresentOnOperator) }) XContext("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() { @@ -65,10 +63,10 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Monitoring Console + * Upload V1 apps to GCS for Monitoring Console * Create app source for Monitoring Console * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### INITIAL VERIFICATIONS ############# @@ -80,7 +78,7 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V1 apps are copied, installed on Monitoring Console and on Search Heads and Indexers pods ############### UPGRADE APPS ################ - * Upload V2 apps on Gcs + * Upload V2 apps on GCS * Wait for Monitoring Console and C3 pods to be ready ############ FINAL VERIFICATIONS ############ * Verify Apps are Downloaded in App Deployment Info @@ -93,13 +91,13 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Upload V1 apps to Gcs for Monitoring Console + // Upload V1 apps to GCS for Monitoring Console appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) gcsTestDirMC := "c3appfw-mc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Prepare Monitoring Console spec with its own app source @@ -127,21 +125,21 @@ var _ = Describe("c3appfw test", func() { // Verify Monitoring Console is ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Upload V1 apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload V1 apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -210,32 +208,32 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############### UPGRADE APPS ################ - // Delete apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - // Upload V2 apps to Gcs for Indexer Cluster + // Upload V2 apps to GCS for Indexer Cluster appVersion = "V2" appFileList = testenv.GetAppFileList(appListV2) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V2 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V2 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V2 apps to Gcs for Monitoring Console - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + // Upload V2 apps to GCS for Monitoring Console + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -290,7 +288,7 @@ var _ = Describe("c3appfw test", func() { switch testenv.ClusterProvider { case "eks": licenseFilePath, err := testenv.DownloadLicenseFromGCPBucket() - Expect(err).To(Succeed(), "Unable to download license file from Gcs") + Expect(err).To(Succeed(), "Unable to download license file from GCS") // Create License Config Map testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) case "azure": @@ -305,10 +303,10 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.CreateLicenseConfigMap(licenseFilePath) default: fmt.Printf("Unable to download license file") - testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with Cluster Provider set as %v", testenv.ClusterProvider)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Unable to download license file with provider set as %v", testenv.ClusterProvider)) } - // Upload V1 apps to Gcs for Monitoring Console + // Upload V1 apps to GCS for Monitoring Console oldImage := "Refer to RELATED_SPLUNK_IMAGE_ENTERPRISE" newImage := "splunk/splunk:latest" @@ -432,10 +430,10 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V2 apps to Gcs for Monitoring Console + * Upload V2 apps to GCS for Monitoring Console * Create app source for Monitoring Console * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload V2 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V2 apps to GCS for Indexer Cluster and Search Head Cluster * Create app source for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ########### INITIAL VERIFICATIONS ########### @@ -447,7 +445,7 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V2 apps are copied, installed on Monitoring Console and also on Search Heads and Indexers pods ############## DOWNGRADE APPS ############### - * Upload V1 apps on Gcs + * Upload V1 apps on GCS * Wait for Monitoring Console and C3 pods to be ready ########### FINAL VERIFICATIONS ############# * Verify Apps are Downloaded in App Deployment Info @@ -460,16 +458,16 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Upload V2 apps to Gcs for Monitoring Console + // Upload V2 apps to GCS for Monitoring Console appVersion := "V2" appFileList := testenv.GetAppFileList(appListV2) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) gcsTestDirMC := "c3appfw-mc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -495,21 +493,21 @@ var _ = Describe("c3appfw test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Upload V2 apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload V2 apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V2 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V2 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -566,32 +564,32 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############## DOWNGRADE APPS ############### - // Delete apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion = "V1" appFileList = testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexers", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexers", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexers", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexers", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Monitoring Console - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + // Upload V1 apps to GCS for Monitoring Console + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -640,7 +638,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps on Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps on GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app config and wait for pods to be ready ########## INITIAL VERIFICATIONS ############ @@ -675,23 +673,23 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP ################## - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion := "V1" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) appFileList := testenv.GetAppFileList(appListV1) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -764,9 +762,7 @@ var _ = Describe("c3appfw test", func() { //############# SCALING UP ################### // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -784,8 +780,7 @@ var _ = Describe("c3appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-idxc" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -807,7 +802,7 @@ var _ = Describe("c3appfw test", func() { Expect(testenv.CheckIndexerOnCM(ctx, deployment, indexerName)).To(Equal(true)) // Ingest data on Indexers - testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas), "main", 2000) + testenv.IngestDataOnIndexers(ctx, deployment, deployment.GetName(), int(scaledIndexerReplicas)) // Ensure Search Head Cluster go to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -854,9 +849,7 @@ var _ = Describe("c3appfw test", func() { //############### SCALING DOWN ################ // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -872,8 +865,7 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -923,12 +915,12 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It(" c3gcp, c3_mgr_gcp_sanity: can deploy a C3 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs + * Upload V1 apps to GCS * Create app source with local scope for C3 SVA (Cluster Manager and Deployer) * Prepare and deploy C3 CRD with app framework and wait for pods to be ready ############# INITIAL VERIFICATIONS ########## @@ -951,23 +943,23 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion := "V1" gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster + // Upload V1 apps to GCS for Search Head Cluster gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1013,20 +1005,20 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############### UPGRADE APPS ################ - // Delete V1 apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete V1 apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil - // Upload V2 apps to Gcs + // Upload V2 apps to GCS appVersion = "V2" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS", appVersion)) appFileList = testenv.GetAppFileList(appListV2) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -1062,13 +1054,13 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them", func() { /* Test Steps ################## SETUP #################### * Split Applist into clusterlist and local list - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster for local and cluster scope + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster for local and cluster scope * Create app sources for Cluster Manager and Deployer with local and cluster scope * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### INITIAL VERIFICATIONS ############# @@ -1080,7 +1072,7 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V1 apps are copied, installed on Monitoring Console and on Search Heads and Indexers pods ############### UPGRADE APPS ################ - * Upload V2 apps on Gcs + * Upload V2 apps on GCS * Wait for all C3 pods to be ready ############ FINAL VERIFICATIONS ############ * Verify Apps are Downloaded in App Deployment Info @@ -1098,39 +1090,39 @@ var _ = Describe("c3appfw test", func() { appListLocal := appListV1[len(appListV1)/2:] appListCluster := appListV1[:len(appListV1)/2] - // Upload appListLocal list of apps to Gcs (to be used for local install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + // Upload appListLocal list of apps to GCS (to be used for local install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirIdxcLocal = "c3appfw-" + testenv.RandomDNSName(4) localappFileList := testenv.GetAppFileList(appListLocal) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install for Indexers", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install for Indexers", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirShcLocal = "c3appfw-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirIdxcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) clusterappFileList := testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirShcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1140,7 +1132,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, gcsTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} @@ -1153,7 +1145,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, gcsTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, gcsTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1204,8 +1196,8 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############### UPGRADE APPS ################ - // Delete apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil @@ -1213,24 +1205,24 @@ var _ = Describe("c3appfw test", func() { appListLocal = appListV1[len(appListV1)/2:] appListCluster = appListV1[:len(appListV1)/2] - // Upload appListLocal list of V2 apps to Gcs (to be used for local install) + // Upload appListLocal list of V2 apps to GCS (to be used for local install) appVersion = "V2" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) localappFileList = testenv.GetAppFileList(appListLocal) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install for Indexers", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install for Indexers", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of V2 apps to Gcs (to be used for cluster-wide install) + // Upload appListCluster list of V2 apps to GCS (to be used for cluster-wide install) clusterappFileList = testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -1273,13 +1265,13 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then downgrade them", func() { /* Test Steps ################## SETUP #################### * Split Applist into clusterlist and local list - * Upload V2 apps to Gcs for Indexer Cluster and Search Head Cluster for local and cluster scope + * Upload V2 apps to GCS for Indexer Cluster and Search Head Cluster for local and cluster scope * Create app sources for Cluster Manager and Deployer with local and cluster scope * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### INITIAL VERIFICATIONS ############# @@ -1291,7 +1283,7 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V2 apps are copied, installed on Monitoring Console and on Search Heads and Indexers pods ############### Downgrade APPS ################ - * Upload V1 apps on Gcs + * Upload V1 apps on GCS * Wait for all C3 pods to be ready ############ FINAL VERIFICATIONS ############ * Verify Apps are Downloaded in App Deployment Info @@ -1309,37 +1301,37 @@ var _ = Describe("c3appfw test", func() { appListLocal := appListV2[len(appListV2)/2:] appListCluster := appListV2[:len(appListV2)/2] - // Upload appListLocal list of apps to Gcs (to be used for local install) for Idxc - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + // Upload appListLocal list of apps to GCS (to be used for local install) for Idxc + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirIdxcLocal = "c3appfw-" + testenv.RandomDNSName(4) localappFileList := testenv.GetAppFileList(appListLocal) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListLocal list of apps to Gcs (to be used for local install) for Shc - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + // Upload appListLocal list of apps to GCS (to be used for local install) for Shc + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirShcLocal = "c3appfw-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirIdxcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) clusterappFileList := testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirShcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1349,7 +1341,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, gcsTestDirIdxcLocal, 60) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -1360,7 +1352,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, gcsTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, gcsTestDirShcLocal, 60) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -1427,8 +1419,8 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############# DOWNGRADE APPS ################ - // Delete apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil @@ -1436,24 +1428,24 @@ var _ = Describe("c3appfw test", func() { appListLocal = appListV1[len(appListV1)/2:] appListCluster = appListV1[:len(appListV1)/2] - // Upload appListLocal list of V1 apps to Gcs (to be used for local install) + // Upload appListLocal list of V1 apps to GCS (to be used for local install) appVersion = "V1" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) localappFileList = testenv.GetAppFileList(appListLocal) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of V2 apps to Gcs (to be used for cluster-wide install) + // Upload appListCluster list of V2 apps to GCS (to be used for cluster-wide install) clusterappFileList = testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -1496,13 +1488,13 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, appframework: can deploy a C3 SVA instance with App Framework enabled and install above 200MB of apps at once", func() { /* Test Steps ################## SETUP #################### * Create App Source for C3 SVA (Cluster Manager and Deployer) - * Add more apps than usual on Gcs for this test + * Add more apps than usual on GCS for this test * Prepare and deploy C3 CRD with app framework and wait for pods to be ready ############### VERIFICATIONS ############### * Verify Apps are Downloaded in App Deployment Info @@ -1520,8 +1512,8 @@ var _ = Describe("c3appfw test", func() { appFileList := testenv.GetAppFileList(appList) appVersion := "V1" - // Download apps from Gcs - testcaseEnvInst.Log.Info("Download bigger amount of apps from Gcs for this test") + // Download apps from GCS + testcaseEnvInst.Log.Info("Download bigger amount of apps from GCS for this test") err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps files") @@ -1529,19 +1521,19 @@ var _ = Describe("c3appfw test", func() { appList = append(appListV1, appList...) appFileList = testenv.GetAppFileList(appList) - // Upload app to Gcs for Indexer Cluster + // Upload app to GCS for Indexer Cluster gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload apps to Gcs test directory for Indexer Cluster") + Expect(err).To(Succeed(), "Unable to upload apps to GCS test directory for Indexer Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload app to Gcs for Search Head Cluster + // Upload app to GCS for Search Head Cluster gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload apps to Gcs test directory for Search Head Cluster") + Expect(err).To(Succeed(), "Unable to upload apps to GCS test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1592,10 +1584,10 @@ var _ = Describe("c3appfw test", func() { It("integration, c3, appframework: can deploy a C3 SVA with App Framework enabled for manual update", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Monitoring Console + * Upload V1 apps to GCS for Monitoring Console * Create app source for Monitoring Console * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload V1 apps to Gcs + * Upload V1 apps to GCS * Create app source with manaul poll for M4 SVA (Cluster Manager and Deployer) * Prepare and deploy C3 CRD with app framework and wait for pods to be ready ########## INITIAL VERIFICATION ############# @@ -1623,13 +1615,13 @@ var _ = Describe("c3appfw test", func() { */ // ################## SETUP #################### - // Upload V1 apps to Gcs for Monitoring Console + // Upload V1 apps to GCS for Monitoring Console appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) gcsTestDirMC := "c3appfw-mc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Prepare Monitoring Console spec with its own app source @@ -1657,19 +1649,19 @@ var _ = Describe("c3appfw test", func() { // Verify Monitoring Console is ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster + // Upload V1 apps to GCS for Search Head Cluster gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1682,7 +1674,7 @@ var _ = Describe("c3appfw test", func() { shReplicas := 3 testcaseEnvInst.Log.Info("Deploy Single Site Indexer Cluster") cm, _, shc, err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx, deployment.GetName(), indexerReplicas, true, appFrameworkSpecIdxc, appFrameworkSpecShc, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App Framework") // Ensure Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -1719,28 +1711,28 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) // ############### UPGRADE APPS ################ - // Delete V1 apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete V1 apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil - // Upload V2 apps to Gcs for C3 + // Upload V2 apps to GCS for C3 appVersion = "V2" appFileList = testenv.GetAppFileList(appListV2) - testcaseEnvInst.Log.Info(fmt.Sprintf("Uploading %s apps to Gcs", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Uploading %s apps to GCS", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V2 apps to Gcs for Monitoring Console - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + // Upload V2 apps to GCS for Monitoring Console + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -1833,12 +1825,12 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, appframework: can deploy a C3 SVA and have apps installed and updated locally on Cluster Manager and Deployer for manual polling", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs + * Upload V1 apps to GCS * Create app source with local scope for C3 SVA (Cluster Manager and Deployer) * Prepare and deploy C3 CRD with app framework and wait for pods to be ready ############# INITIAL VERIFICATION ########## @@ -1865,23 +1857,23 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion := "V1" gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster + // Upload V1 apps to GCS for Search Head Cluster gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1926,20 +1918,20 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############### UPGRADE APPS ################ - // Delete V1 apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete V1 apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil - // Upload V2 apps to Gcs + // Upload V2 apps to GCS appVersion = "V2" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS", appVersion)) appFileList = testenv.GetAppFileList(appListV2) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Check for changes in App phase to determine if next poll has been triggered @@ -2016,13 +2008,13 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, appframework: can deploy a C3 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps ################## SETUP #################### * Split Applist into clusterlist and local list - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster for local and cluster scope + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster for local and cluster scope * Create app sources for Cluster Manager and Deployer with local and cluster scope * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### INITIAL VERIFICATIONS ############# @@ -2034,7 +2026,7 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V1 apps are copied, installed on Monitoring Console and on Search Heads and Indexers pods ############### UPGRADE APPS ################ - * Upload V2 apps on Gcs + * Upload V2 apps on GCS * Wait for all C3 pods to be ready ############ FINAL VERIFICATIONS ############ * Verify Apps are Downloaded in App Deployment Info @@ -2052,37 +2044,37 @@ var _ = Describe("c3appfw test", func() { appListLocal := appListV1[len(appListV1)/2:] appListCluster := appListV1[:len(appListV1)/2] - // Upload appListLocal list of apps to Gcs (to be used for local install) for Idxc - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + // Upload appListLocal list of apps to GCS (to be used for local install) for Idxc + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirIdxcLocal = "c3appfw-" + testenv.RandomDNSName(4) localappFileList := testenv.GetAppFileList(appListLocal) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListLocal list of apps to Gcs (to be used for local install) for Shc - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + // Upload appListLocal list of apps to GCS (to be used for local install) for Shc + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) gcsTestDirShcLocal = "c3appfw-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (local scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirIdxcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) clusterappFileList := testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of apps to Gcs (to be used for cluster-wide install) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for cluster-wide install (cluster scope)", appVersion)) + // Upload appListCluster list of apps to GCS (to be used for cluster-wide install) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for cluster-wide install (cluster scope)", appVersion)) gcsTestDirShcCluster = "c3appfw-cluster-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to Gcs test directory", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -2092,7 +2084,7 @@ var _ = Describe("c3appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, gcsTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} appFrameworkSpecIdxc.VolList = append(appFrameworkSpecIdxc.VolList, volumeSpecCluster...) @@ -2103,7 +2095,7 @@ var _ = Describe("c3appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, gcsTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, gcsTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} appFrameworkSpecShc.VolList = append(appFrameworkSpecShc.VolList, volumeSpecCluster...) @@ -2153,8 +2145,8 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyNoPodResetByUID(ctx, deployment, splunkPodUIDs, nil) //############### UPGRADE APPS ################ - // Delete apps on Gcs - testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on Gcs", appVersion)) + // Delete apps on GCS + testcaseEnvInst.Log.Info(fmt.Sprintf("Delete %s apps on GCS", appVersion)) testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) uploadedApps = nil @@ -2162,24 +2154,24 @@ var _ = Describe("c3appfw test", func() { appListLocal = appListV1[len(appListV1)/2:] appListCluster = appListV1[:len(appListV1)/2] - // Upload appListLocal list of V2 apps to Gcs (to be used for local install) + // Upload appListLocal list of V2 apps to GCS (to be used for local install) appVersion = "V2" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for local install (local scope)", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for local install (local scope)", appVersion)) localappFileList = testenv.GetAppFileList(appListLocal) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcLocal, localappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for local install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for local install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload appListCluster list of V2 apps to Gcs (to be used for cluster-wide install) + // Upload appListCluster list of V2 apps to GCS (to be used for cluster-wide install) clusterappFileList = testenv.GetAppFileList(appListCluster) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShcCluster, clusterappFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for cluster-wide install", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for cluster-wide install", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // ############ ENABLE MANUAL POLL ############ @@ -2245,27 +2237,27 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Monitoring Console + * Upload V1 apps to GCS for Monitoring Console * Create app source for Monitoring Console * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload big-size app to Gcs for Indexer Cluster and Search Head Cluster + * Upload big-size app to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework ############## VERIFICATIONS ################ * Verify app installation is in progress on Cluster Manager and Deployer - * Upload more apps from Gcs during bigger app install + * Upload more apps from GCS during bigger app install * Wait for polling interval to pass * Verify all apps are installed on Cluster Manager and Deployer */ //################## SETUP #################### - // Upload V1 apps to Gcs for Monitoring Console + // Upload V1 apps to GCS for Monitoring Console appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) gcsTestDirMC := "c3appfw-mc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Prepare Monitoring Console spec with its own app source @@ -2293,29 +2285,29 @@ var _ = Describe("c3appfw test", func() { // Verify Monitoring Console is ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Download all apps from Gcs + // Download all apps from GCS appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") - // Upload big-size app to Gcs for Cluster Manager + // Upload big-size app to GCS for Cluster Manager appList = testenv.BigSingleApp appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload big-size app to Gcs for Cluster Manager") + testcaseEnvInst.Log.Info("Upload big-size app to GCS for Cluster Manager") gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to Gcs test directory for Cluster Manager") + Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Cluster Manager") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload big-size app to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info("Upload big-size app to Gcs for Search Head Cluster") + // Upload big-size app to GCS for Search Head Cluster + testcaseEnvInst.Log.Info("Upload big-size app to GCS for Search Head Cluster") gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to Gcs test directory for Search Head Cluster") + Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2332,18 +2324,18 @@ var _ = Describe("c3appfw test", func() { // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) - // Upload more apps to Gcs for Cluster Manager + // Upload more apps to GCS for Cluster Manager appList = testenv.ExtraApps appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload more apps to Gcs for Cluster Manager") + testcaseEnvInst.Log.Info("Upload more apps to GCS for Cluster Manager") uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to Gcs test directory for Cluster Manager") + Expect(err).To(Succeed(), "Unable to upload more apps to GCS test directory for Cluster Manager") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload more apps to Gcs for Deployer - testcaseEnvInst.Log.Info("Upload more apps to Gcs for Deployer") + // Upload more apps to GCS for Deployer + testcaseEnvInst.Log.Info("Upload more apps to GCS for Deployer") uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to Gcs test directory for Deployer") + Expect(err).To(Succeed(), "Unable to upload more apps to GCS test directory for Deployer") uploadedApps = append(uploadedApps, uploadedFiles...) // Ensure Cluster Manager goes to Ready phase @@ -2374,27 +2366,27 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Monitoring Console + * Upload V1 apps to GCS for Monitoring Console * Create app source for Monitoring Console * Prepare and deploy Monitoring Console CRD with app framework and wait for the pod to be ready - * Upload big-size app to Gcs for Indexer Cluster and Search Head Cluster + * Upload big-size app to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ############## VERIFICATIONS ################ * Verify App installation is in progress on Cluster Manager and Deployer - * Upload more apps from Gcs during bigger app install + * Upload more apps from GCS during bigger app install * Wait for polling interval to pass * Verify all apps are installed on Cluster Manager and Deployer */ //################## SETUP #################### - // Upload V1 apps to Gcs for Monitoring Console + // Upload V1 apps to GCS for Monitoring Console appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Monitoring Console", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Monitoring Console", appVersion)) gcsTestDirMC := "c3appfw-mc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirMC, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Monitoring Console %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) // Prepare Monitoring Console spec with its own app source @@ -2422,29 +2414,29 @@ var _ = Describe("c3appfw test", func() { // Verify Monitoring Console is ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Download all apps from Gcs + // Download all apps from GCS appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList = testenv.GetAppFileList(appList) err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") - // Upload big-size app to Gcs for Cluster Manager + // Upload big-size app to GCS for Cluster Manager appList = testenv.BigSingleApp appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload big-size app to Gcs for Cluster Manager") + testcaseEnvInst.Log.Info("Upload big-size app to GCS for Cluster Manager") gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to Gcs test directory for Cluster Manager") + Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Cluster Manager") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload big-size app to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info("Upload big-size app to Gcs for Search Head Cluster") + // Upload big-size app to GCS for Search Head Cluster + testcaseEnvInst.Log.Info("Upload big-size app to GCS for Search Head Cluster") gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big-size app to Gcs test directory for Search Head Cluster") + Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2461,18 +2453,18 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) - // Upload more apps to Gcs for Cluster Manager + // Upload more apps to GCS for Cluster Manager appList = testenv.ExtraApps appFileList = testenv.GetAppFileList(appList) - testcaseEnvInst.Log.Info("Upload more apps to Gcs for Cluster Manager") + testcaseEnvInst.Log.Info("Upload more apps to GCS for Cluster Manager") uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to Gcs test directory for Cluster Manager") + Expect(err).To(Succeed(), "Unable to upload more apps to GCS test directory for Cluster Manager") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload more apps to Gcs for Deployer - testcaseEnvInst.Log.Info("Upload more apps to Gcs for Deployer") + // Upload more apps to GCS for Deployer + testcaseEnvInst.Log.Info("Upload more apps to GCS for Deployer") uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload more apps to Gcs test directory for Deployer") + Expect(err).To(Succeed(), "Unable to upload more apps to GCS test directory for Deployer") uploadedApps = append(uploadedApps, uploadedFiles...) // Ensure Cluster Manager goes to Ready phase @@ -2510,7 +2502,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready * While app install is in progress, restart the operator @@ -2525,28 +2517,28 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Download all apps from Gcs + // Download all apps from GCS appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion := "V1" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2604,7 +2596,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready * While app download is in progress, restart the operator @@ -2619,28 +2611,28 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Download all apps from Gcs + // Download all apps from GCS appList := append(testenv.BigSingleApp, testenv.ExtraApps...) appFileList := testenv.GetAppFileList(appList) err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") - // Upload V1 apps to Gcs for Indexer Cluster + // Upload V1 apps to GCS for Indexer Cluster appVersion := "V1" - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2698,7 +2690,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### VERIFICATIONS ############# @@ -2710,28 +2702,28 @@ var _ = Describe("c3appfw test", func() { * Verify bundle push is successful * Verify V1 apps are copied, installed on Monitoring Console and on Search Heads and Indexers pods * Disable the app - * Delete the app from Gcs + * Delete the app from GCS * Check for repo state in App Deployment Info */ //################## SETUP #################### appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - // Upload V1 apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload V1 apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2771,7 +2763,7 @@ var _ = Describe("c3appfw test", func() { allAppSourceInfo := []testenv.AppSourceInfo{cmAppSourceInfo, shcAppSourceInfo} testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") - // Verify repo state on App to be disabled to be 1 (i.e app present on Gcs bucket) + // Verify repo state on App to be disabled to be 1 (i.e app present on GCS bucket) appName := appListV1[0] appFileName := testenv.GetAppFileList([]string{appName}) testcaseEnvInst.VerifyAppRepoState(ctx, deployment, cm.Name, cm.Kind, appSourceNameIdxc, 1, appFileName[0]) @@ -2792,12 +2784,12 @@ var _ = Describe("c3appfw test", func() { // Wait for App state to update after config file change testcaseEnvInst.WaitforAppInstallState(ctx, deployment, idxcPodNames, testcaseEnvInst.GetName(), appName, "disabled", true) - // Delete the file from Gcs + // Delete the file from GCS gcsFilepath := filepath.Join(gcsTestDirIdxc, appFileName[0]) err = testenv.DeleteFileOnGCP(testGcsBucket, gcsFilepath) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to delete %s app on Gcs test directory", appFileName[0])) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to delete %s app on GCS test directory", appFileName[0])) - // Verify repo state is set to 2 (i.e app deleted from Gcs bucket) + // Verify repo state is set to 2 (i.e app deleted from GCS bucket) testcaseEnvInst.VerifyAppRepoState(ctx, deployment, cm.Name, cm.Kind, appSourceNameIdxc, 2, appFileName[0]) }) @@ -2808,7 +2800,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready * While app download is completed, upload new versions of the apps @@ -2831,28 +2823,28 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Download all apps from Gcs + // Download all apps from GCS appVersion := "V1" appListV1 := []string{appListV1[0]} appFileList := testenv.GetAppFileList(appListV1) err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download apps") - // Upload V1 apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload V1 apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2870,19 +2862,19 @@ var _ = Describe("c3appfw test", func() { // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) - // Upload V2 apps to Gcs for Indexer Cluster + // Upload V2 apps to GCS for Indexer Cluster appVersion = "V2" appListV2 := []string{appListV2[0]} appFileList = testenv.GetAppFileList(appListV2) - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V2 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V2 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Get Pod age to check for pod resets later @@ -2923,12 +2915,12 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("c3, integration, appframework: can deploy a C3 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps ################## SETUP #################### - * Upload 15 apps of 100MB size each to Gcs for Indexer Cluster and Search Head Cluster for cluster scope + * Upload 15 apps of 100MB size each to GCS for Indexer Cluster and Search Head Cluster for cluster scope * Create app sources for Cluster Master and Deployer with cluster scope * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready ######### INITIAL VERIFICATIONS ############# @@ -2955,24 +2947,24 @@ var _ = Describe("c3appfw test", func() { err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.PVTestAppsLocation, downloadDirPVTestApps, appFileList) Expect(err).To(Succeed(), "Unable to download app files") - // Upload apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc := "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirPVTestApps) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search head Cluster", appVersion)) + // Upload apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc := "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirPVTestApps) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3023,7 +3015,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP #################### - * Upload big-size app to Gcs for Indexer Cluster and Search Head Cluster + * Upload big-size app to GCS for Indexer Cluster and Search Head Cluster * Create app sources for Cluster Manager and Deployer * Prepare and deploy C3 CRD with app framework and wait for the pods to be ready * When app download is complete, delete apps from app directory @@ -3038,28 +3030,28 @@ var _ = Describe("c3appfw test", func() { */ //################## SETUP #################### - // Download big size apps from Gcs + // Download big size apps from GCS appList := testenv.BigSingleApp appFileList := testenv.GetAppFileList(appList) err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) Expect(err).To(Succeed(), "Unable to download big-size app") - // Upload big size app to Gcs for Indexer Cluster + // Upload big size app to GCS for Indexer Cluster appVersion := "V1" - testcaseEnvInst.Log.Info("Upload big size app to Gcs for Indexer Cluster") + testcaseEnvInst.Log.Info("Upload big size app to GCS for Indexer Cluster") gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big size to Gcs test directory for Indexer Cluster") + Expect(err).To(Succeed(), "Unable to upload big size to GCS test directory for Indexer Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload big size app to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info("Upload big size app to Gcs for Search Head Cluster") + // Upload big size app to GCS for Search Head Cluster + testcaseEnvInst.Log.Info("Upload big size app to GCS for Search Head Cluster") gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload big size to Gcs test directory for Search Head Cluster") + Expect(err).To(Succeed(), "Unable to upload big size to GCS test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3121,7 +3113,7 @@ var _ = Describe("c3appfw test", func() { /* Test Steps ################## SETUP ################## - * Upload V1 apps to Gcs for Indexer Cluster and Search Head Cluster + * Upload V1 apps to GCS for Indexer Cluster and Search Head Cluster * Prepare and deploy C3 CRD with app framework * Verify IsDeploymentInProgress is set * Wait for the pods to be ready @@ -3131,21 +3123,21 @@ var _ = Describe("c3appfw test", func() { appVersion := "V1" appFileList := testenv.GetAppFileList(appListV1) - // Upload V1 apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Indexer Cluster", appVersion)) + // Upload V1 apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Indexer Cluster", appVersion)) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload V1 apps to Gcs for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to Gcs for Search Head Cluster", appVersion)) + // Upload V1 apps to GCS for Search Head Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCS for Search Head Cluster", appVersion)) gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to Gcs test directory for Search Head Cluster", appVersion)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -3181,7 +3173,7 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3: can deploy a C3 SVA and a Standalone, then add that Standalone as a Search Head to the cluster", func() { /* Test Steps @@ -3242,12 +3234,12 @@ var _ = Describe("c3appfw test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("integration, c3, appframework: can deploy a C3 SVA and have ES app installed on Search Head Cluster", func() { /* Test Steps ################## SETUP #################### - * Upload ES app to Gcs + * Upload ES app to GCS * Upload TA add-on app to location for Indexer cluster * Create App Source with 'ScopeClusterWithPreConfig' scope for C3 SVA * Prepare and deploy C3 CRD with app framework and wait for pods to be ready @@ -3255,43 +3247,43 @@ var _ = Describe("c3appfw test", func() { * Verify ES app is installed on Deployer and on Search Heads * Verify TA add-on app is installed on indexers ################## UPGRADE VERIFICATION ############# - * Update ES app on Gcs location + * Update ES app on GCS location * Verify updated ES app is installed on Deployer and on Search Heads */ //################## SETUP #################### - // Download ES app from Gcs + // Download ES app from GCS appVersion := "V1" - testcaseEnvInst.Log.Info("Download ES app from Gcs") + testcaseEnvInst.Log.Info("Download ES app from GCS") esApp := []string{"SplunkEnterpriseSecuritySuite"} appFileList := testenv.GetAppFileList(esApp) err := testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileList) - Expect(err).To(Succeed(), "Unable to download ES app file from Gcs") + Expect(err).To(Succeed(), "Unable to download ES app file from GCS") - // Download Technology add-on app from Gcs - testcaseEnvInst.Log.Info("Download Technology add-on app from Gcs") + // Download Technology add-on app from GCS + testcaseEnvInst.Log.Info("Download Technology add-on app from GCS") taApp := []string{"Splunk_TA_ForIndexers"} appFileListIdxc := testenv.GetAppFileList(taApp) err = testenv.DownloadFilesFromGCP(testDataGcsBucket, testenv.AppLocationV1, downloadDirV1, appFileListIdxc) - Expect(err).To(Succeed(), "Unable to download ES app file from Gcs") + Expect(err).To(Succeed(), "Unable to download ES app file from GCS") - // Create directory for file upload to Gcs + // Create directory for file upload to GCS gcsTestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4) gcsTestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4) - // Upload ES app to Gcs - testcaseEnvInst.Log.Info("Upload ES app to Gcs") + // Upload ES app to GCS + testcaseEnvInst.Log.Info("Upload ES app to GCS") uploadedFiles, err := testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV1) - Expect(err).To(Succeed(), "Unable to upload ES app to Gcs test directory") + Expect(err).To(Succeed(), "Unable to upload ES app to GCS test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Upload Technology add-on apps to Gcs for Indexer Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s Technology add-on app to Gcs for Indexer Cluster", appVersion)) + // Upload Technology add-on apps to GCS for Indexer Cluster + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s Technology add-on app to GCS for Indexer Cluster", appVersion)) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirIdxc, appFileListIdxc, downloadDirV1) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s Technology add-on app to Gcs test directory for Indexer Cluster %s", appVersion, testGcsBucket)) + Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s Technology add-on app to GCS test directory for Indexer Cluster %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for SHC + // Create App Framework Spec for SHC appSourceNameShc = "appframework-shc-" + testenv.RandomDNSName(3) appSourceVolumeNameShc := "appframework-test-volume-shc-" + testenv.RandomDNSName(3) appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShc, enterpriseApi.ScopePremiumApps, appSourceNameShc, gcsTestDirShc, 180) @@ -3302,7 +3294,7 @@ var _ = Describe("c3appfw test", func() { }, } - // Create App framework Spec for Indexer Cluster + // Create App Framework Spec for Indexer Cluster appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 180) @@ -3377,16 +3369,16 @@ var _ = Describe("c3appfw test", func() { testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") // //############### UPGRADE APPS ################ - // // Download ES App from Gcs + // // Download ES App from GCS // appVersion = "V2" - // testcaseEnvInst.Log.Info("Download updated ES app from Gcs") + // testcaseEnvInst.Log.Info("Download updated ES app from GCS") // err = testenv.DownloadFilesFromGCP(testDataGcsBucket, gcsAppDirV2, downloadDirV2, appFileList) // Expect(err).To(Succeed(), "Unable to download ES app") - // // Upload V2 ES app to Gcs for Search Head Cluster - // testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s ES app to Gcs for Search Head Cluster", appVersion)) + // // Upload V2 ES app to GCS for Search Head Cluster + // testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s ES app to GCS for Search Head Cluster", appVersion)) // uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirV2) - // Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s ES app to Gcs test directory for Search Head Cluster", appVersion)) + // Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s ES app to GCS test directory for Search Head Cluster", appVersion)) // uploadedApps = append(uploadedApps, uploadedFiles...) // // Check for changes in App phase to determine if next poll has been triggered diff --git a/test/appframework_gcp/c3/test_helpers_test.go b/test/appframework_gcp/c3/test_helpers_test.go deleted file mode 100644 index ea19a251d..000000000 --- a/test/appframework_gcp/c3/test_helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package c3gcpappfw - -import ( - "context" - - enterpriseApi "github.com/splunk/splunk-operator/api/v4" - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyC3ClusterReady verifies SHC is ready and single-site indexers are ready. -func verifyC3ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment) { - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) -} - -// verifyMCVersionChangedAndReady waits for the MC resource version to change then verifies MC is ready. -func verifyMCVersionChangedAndReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, mc *enterpriseApi.MonitoringConsole, resourceVersion string) { - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) -} diff --git a/test/appframework_gcp/m4/appframework_gcs_test.go b/test/appframework_gcp/m4/appframework_gcs_test.go index 26ccdaed3..b3d7f39b4 100644 --- a/test/appframework_gcp/m4/appframework_gcs_test.go +++ b/test/appframework_gcp/m4/appframework_gcs_test.go @@ -61,12 +61,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.GCPCloudCleanup(testGcsBucket, uploadedApps), filePresentOnOperator) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It(" m4gcp, masterappframeworkm4gcp, m4_gcp_sanity: can deploy a M4 SVA with App Framework enabled, install apps and upgrade them", func() { /* Test Steps @@ -107,7 +105,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -143,7 +141,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -159,12 +157,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -235,10 +231,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -271,7 +265,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and downgrade them", func() { /* Test Steps @@ -312,7 +306,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -348,7 +342,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -361,12 +355,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -423,10 +415,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -456,7 +446,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install apps, scale up clusters, install apps on new pods, scale down", func() { /* Test Steps @@ -511,7 +501,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -526,10 +516,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -571,9 +559,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -591,8 +577,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -661,9 +646,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -679,8 +662,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -728,7 +710,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -770,7 +752,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -785,10 +767,8 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -830,10 +810,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs = testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -853,7 +831,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -897,7 +875,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 0) @@ -933,7 +911,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 0) @@ -944,12 +922,10 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1001,10 +977,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1097,7 +1071,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1143,7 +1117,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, gcsTestDirIdxc, 0) @@ -1157,10 +1131,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -1202,10 +1174,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // ############ VERIFICATION APPS ARE NOT UPDATED BEFORE ENABLING MANUAL POLL ############ appVersion = "V1" @@ -1272,7 +1242,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, masterappframeworkm4, appframework: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1338,7 +1308,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCP test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1348,7 +1318,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster master with scope local and append cluster scope + // Create App Framework Spec for Cluster Master with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, gcsTestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} @@ -1360,7 +1330,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, gcsTestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, gcsTestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "gcs", testenv.GetDefaultGCPRegion())} @@ -1380,10 +1350,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1453,10 +1421,8 @@ var _ = Describe("m4appfw test", func() { // Check for changes in App phase to determine if next poll has been triggered testenv.WaitforPhaseChange(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameClusterIdxc, clusterappFileList) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1563,7 +1529,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1576,7 +1542,7 @@ var _ = Describe("m4appfw test", func() { siteCount := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1700,7 +1666,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1714,7 +1680,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1763,7 +1729,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app install is in progress", func() { /* Test Steps @@ -1801,7 +1767,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -1813,7 +1779,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1821,10 +1787,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1848,7 +1812,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app download is in progress", func() { /* Test Steps @@ -1886,7 +1850,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -1898,7 +1862,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1906,10 +1870,8 @@ var _ = Describe("m4appfw test", func() { // Delete Operator pod while Install in progress testenv.DeleteOperatorPod(testcaseEnvInst) - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -1933,7 +1895,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled, install an app, then disable it by using a disabled version of the app and then remove it from app source", func() { /* Test Steps @@ -1969,7 +1931,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -1981,12 +1943,10 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") - - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2038,7 +1998,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2080,7 +2040,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, gcsTestDirIdxc, 0) @@ -2094,10 +2054,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2124,8 +2082,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Master CR with latest config cm = &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Master") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Master") // Set AppsRepoPollInterval for Cluster Master to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Master to 180 seconds") @@ -2135,8 +2092,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2219,7 +2175,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and update apps after app download is completed", func() { /* Test Steps @@ -2266,7 +2222,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, gcsTestDirIdxc, 120) @@ -2278,7 +2234,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2338,7 +2294,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, masterappframeworkm4, appframework: can deploy a M4 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2378,7 +2334,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to GCP for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCP for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCP for Search Head Cluster", appVersion)) gcsTestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, gcsTestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) @@ -2387,7 +2343,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2405,10 +2361,8 @@ var _ = Describe("m4appfw test", func() { cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with Search Head Cluster") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4IndexersAndSHCReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 indexers and SHC are ready + testcaseEnvInst.VerifyM4IndexersAndSHCReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Get Pod age to check for pod resets later splunkPodUIDs := testenv.GetPodUIDs(testcaseEnvInst.GetName()) @@ -2426,7 +2380,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, masterappframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() { /* Test Steps @@ -2464,7 +2418,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -2476,7 +2430,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Master testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2487,10 +2441,8 @@ var _ = Describe("m4appfw test", func() { err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath}) Expect(err).To(Succeed(), "Unable to delete file on pod") - // Ensure that the Cluster Master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + // Ensure M4 cluster is ready + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) @@ -2514,7 +2466,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It(" m4gcp, masterappframeworkm4gcp, m4_gcp_sanity: can deploy a M4 SVA with App Framework enabled, install apps and check IsDeploymentInProgress for CM and SHC CR's", func() { /* Test Steps @@ -2541,7 +2493,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, gcsTestDirIdxc, 60) @@ -2553,7 +2505,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") @@ -2566,7 +2518,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for SHC") testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, shc.Name, shc.Kind) - verifyM4ClusterReady(ctx, testcaseEnvInst, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterMasterReady) // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/appframework_gcp/m4/manager_appframework_test.go b/test/appframework_gcp/m4/manager_appframework_test.go index d0abfec1e..36d3f0f89 100644 --- a/test/appframework_gcp/m4/manager_appframework_test.go +++ b/test/appframework_gcp/m4/manager_appframework_test.go @@ -60,12 +60,10 @@ var _ = Describe("m4appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnGCP(testGcsBucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.GCPCloudCleanup(testGcsBucket, uploadedApps), filePresentOnOperator) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It(" m4gcp, m4_mgr_gcp_sanity: can deploy a M4 SVA with App Framework enabled, install apps and upgrade them", func() { /* Test Steps @@ -106,7 +104,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -142,7 +140,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -158,7 +156,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -284,7 +282,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled, install apps and downgrade them", func() { /* Test Steps @@ -325,7 +323,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 60) @@ -361,7 +359,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -374,7 +372,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -483,7 +481,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled, install apps, scale up clusters, install apps on new pods, scale down", func() { /* Test Steps @@ -538,7 +536,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -605,9 +603,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING UP ################ // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale up Search Head Cluster defaultSHReplicas := shc.Spec.Replicas @@ -625,8 +621,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Indexer CR with latest config idxcName := deployment.GetName() + "-" + "site1" idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas := idxc.Spec.Replicas scaledIndexerReplicas := defaultIndexerReplicas + 1 testcaseEnvInst.Log.Info("Scale up Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -695,9 +690,7 @@ var _ = Describe("m4appfw test", func() { //############### SCALING DOWN ############## // Get instance of current Search Head Cluster CR with latest config - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to get instance of Search Head Cluster") // Scale down Search Head Cluster defaultSHReplicas = shc.Spec.Replicas @@ -713,8 +706,7 @@ var _ = Describe("m4appfw test", func() { testcaseEnvInst.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingDown) // Get instance of current Indexer CR with latest config - err = deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Failed to get instance of Indexer Cluster") defaultIndexerReplicas = idxc.Spec.Replicas scaledIndexerReplicas = defaultIndexerReplicas - 1 testcaseEnvInst.Log.Info("Scaling down Indexer Cluster", "Current Replicas", defaultIndexerReplicas, "New Replicas", scaledIndexerReplicas) @@ -762,7 +754,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA and have apps installed locally on Cluster Manager and Deployer", func() { /* Test Steps @@ -804,7 +796,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -895,7 +887,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled for manual poll", func() { /* Test Steps ################## SETUP #################### @@ -939,7 +931,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Monitoring Console %s", appVersion, testGcsBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) volumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, volumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, s3TestDirMC, 0) @@ -975,7 +967,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -986,7 +978,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 testcaseEnvInst.Log.Info("Deploy Multisite Indexer Cluster") cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster with App Framework") // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -1153,7 +1145,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA and have apps installed and updated locally on Cluster Manager and Deployer via manual poll", func() { /* Test Steps @@ -1199,7 +1191,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -1336,7 +1328,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, appframework: can deploy a m4 SVA with apps installed locally on Cluster Manager and Deployer, cluster-wide on Peers and Search Heads, then upgrade them via a manual poll", func() { /* Test Steps @@ -1402,7 +1394,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps (cluster scope) to GCP test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameLocalIdxc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameLocalShc := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameClusterIdxc := "appframework-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) @@ -1412,7 +1404,7 @@ var _ = Describe("m4appfw test", func() { appSourceVolumeNameIdxcCluster := "appframework-test-volume-idxc-cluster-" + testenv.RandomDNSName(3) appSourceVolumeNameShcCluster := "appframework-test-volume-shc-cluster-" + testenv.RandomDNSName(3) - // Create App framework Spec for Cluster manager with scope local and append cluster scope + // Create App Framework Spec for Cluster manager with scope local and append cluster scope appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalIdxc, s3TestDirIdxcLocal, 0) volumeSpecCluster := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameIdxcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultGCPRegion())} @@ -1424,7 +1416,7 @@ var _ = Describe("m4appfw test", func() { appSourceSpecCluster := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceNameClusterIdxc, s3TestDirIdxcCluster, appSourceClusterDefaultSpec)} appFrameworkSpecIdxc.AppSources = append(appFrameworkSpecIdxc.AppSources, appSourceSpecCluster...) - // Create App framework Spec for Search head cluster with scope local and append cluster scope + // Create App Framework Spec for Search Head cluster with scope local and append cluster scope appFrameworkSpecShc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameShcLocal, enterpriseApi.ScopeLocal, appSourceNameLocalShc, s3TestDirShcLocal, 0) volumeSpecCluster = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(appSourceVolumeNameShcCluster, testenv.GetGCPEndpoint(), testcaseEnvInst.GetIndexSecretName(), "aws", "s3", testenv.GetDefaultGCPRegion())} @@ -1641,7 +1633,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1654,7 +1646,7 @@ var _ = Describe("m4appfw test", func() { siteCount := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1777,7 +1769,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -1791,7 +1783,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, mcName, "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1840,7 +1832,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app install is in progress", func() { /* Test Steps @@ -1878,7 +1870,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1890,7 +1882,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App installation is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgInstallPending) @@ -1932,7 +1924,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled and reset operator pod while app download is in progress", func() { /* Test Steps @@ -1970,7 +1962,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -1982,7 +1974,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -2024,7 +2016,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled, install an app, then disable it by using a disabled version of the app and then remove it from app source", func() { /* Test Steps @@ -2060,7 +2052,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2072,7 +2064,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Ensure that the Cluster Manager goes to Ready phase testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) @@ -2136,7 +2128,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multi Site Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA, install apps via manual polling, switch to periodic polling, verify apps are not updated before the end of AppsRepoPollInterval, then updated after", func() { /* Test Steps @@ -2178,7 +2170,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 0) @@ -2226,8 +2218,7 @@ var _ = Describe("m4appfw test", func() { //######### SWITCH FROM MANUAL TO PERIODIC POLLING ############ // Get instance of current Cluster Manager CR with latest config cm = &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to edit Cluster Manager") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to edit Cluster Manager") // Set AppsRepoPollInterval for Cluster Manager to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Cluster Manager to 180 seconds") @@ -2237,8 +2228,7 @@ var _ = Describe("m4appfw test", func() { // Get instance of current Search Head Cluster CR with latest config shc = &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Failed to edit Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Failed to edit Search Head Cluster") // Set AppsRepoPollInterval for Search Head Cluster to 180 seconds testcaseEnvInst.Log.Info("Set AppsRepoPollInterval for Search Head Cluster to 180 seconds") @@ -2321,7 +2311,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled and update apps after app download is completed", func() { /* Test Steps @@ -2368,7 +2358,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeLocal, appSourceNameIdxc, s3TestDirIdxc, 120) @@ -2380,7 +2370,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is in progress on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2440,7 +2430,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("m4, integration, appframework: can deploy a M4 SVA and install a bigger volume of apps than the operator PV disk space", func() { /* Test Steps @@ -2480,7 +2470,7 @@ var _ = Describe("m4appfw test", func() { uploadedApps = append(uploadedApps, uploadedFiles...) // Upload apps to GCP for Search Head Cluster - testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCP for Search head Cluster", appVersion)) + testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to GCP for Search Head Cluster", appVersion)) s3TestDirShc := "m4appfw-shc-" + testenv.RandomDNSName(4) uploadedFiles, err = testenv.UploadFilesToGCP(testGcsBucket, s3TestDirShc, appFileList, downloadDirPVTestApps) Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) @@ -2489,7 +2479,7 @@ var _ = Describe("m4appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 30 - // Create App framework Spec for C3 + // Create App Framework Spec for C3 appSourceNameIdxc := "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc := "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceVolumeNameIdxc := "appframework-test-volume-idxc-" + testenv.RandomDNSName(3) @@ -2532,7 +2522,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() { /* Test Steps @@ -2570,7 +2560,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big size to GCP test directory for Search Head Cluster") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2582,7 +2572,7 @@ var _ = Describe("m4appfw test", func() { shReplicas := 3 indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify App Download is completed on Cluster Manager testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -2627,7 +2617,7 @@ var _ = Describe("m4appfw test", func() { }) }) - Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() { + Context("Multisite Indexer Cluster with Search Head Cluster (M4) with App Framework", func() { It(" m4gcp, m4_mgr_gcp_sanity: can deploy a M4 SVA with App Framework enabled, install apps and check IsDeploymentInProgress for CM and SHC CR's", func() { /* Test Steps @@ -2654,7 +2644,7 @@ var _ = Describe("m4appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCP test directory for Search Head Cluster", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for M4 + // Create App Framework Spec for M4 appSourceNameIdxc = "appframework-idxc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appSourceNameShc = "appframework-shc-" + enterpriseApi.ScopeCluster + testenv.RandomDNSName(3) appFrameworkSpecIdxc := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameIdxc, enterpriseApi.ScopeCluster, appSourceNameIdxc, s3TestDirIdxc, 60) @@ -2666,7 +2656,7 @@ var _ = Describe("m4appfw test", func() { indexersPerSite := 1 cm, _, shc, err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx, deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpecIdxc, appFrameworkSpecShc, true, "", "") - Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App framework") + Expect(err).To(Succeed(), "Unable to deploy Multisite Indexer Cluster and Search Head Cluster with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Cluster Master CR testcaseEnvInst.Log.Info("Checking isDeploymentInProgress Flag for Cluster Manager") diff --git a/test/appframework_gcp/m4/test_helpers_test.go b/test/appframework_gcp/m4/test_helpers_test.go deleted file mode 100644 index e2e110af9..000000000 --- a/test/appframework_gcp/m4/test_helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018-2026 Splunk Inc. All rights reserved. - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package m4gcpappfw - -import ( - "context" - - "github.com/splunk/splunk-operator/test/testenv" -) - -// verifyM4ClusterReady verifies indexers are ready, cluster is configured as multisite, and SHC is ready. -func verifyM4ClusterReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} - -// verifyM4IndexersAndSHCReady verifies indexers are ready and SHC is ready (without multisite check). -func verifyM4IndexersAndSHCReady(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, siteCount int) { - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) -} diff --git a/test/appframework_gcp/s1/appframework_gcs_test.go b/test/appframework_gcp/s1/appframework_gcs_test.go index 5704e1560..bd5346e7d 100644 --- a/test/appframework_gcp/s1/appframework_gcs_test.go +++ b/test/appframework_gcp/s1/appframework_gcs_test.go @@ -52,9 +52,7 @@ var _ = Describe("s1appfw test", func() { }) AfterEach(func() { - testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, func() { - testenv.DeleteFilesOnGCP(testGCSBucket, uploadedApps) - }, filePresentOnOperator) + testenv.TeardownAppFrameworkTestCaseEnv(ctx, testcaseEnvInst, deployment, testenv.GCPCloudCleanup(testGCSBucket, uploadedApps), filePresentOnOperator) }) Context("Standalone deployment (S1) with App Framework", func() { @@ -102,7 +100,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to gcs test directory for Monitoring Console %s", appVersion, testGCSBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -136,7 +134,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -157,7 +155,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -282,7 +280,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to gcs test directory for Monitoring Console %s", appVersion, testGCSBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -306,7 +304,7 @@ var _ = Describe("s1appfw test", func() { // Verify Monitoring Console is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -326,7 +324,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -453,7 +451,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to gcs test directory for Standalone", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Monitoring Console + // Create App Framework Spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -483,7 +481,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to gcs test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -503,7 +501,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -538,8 +536,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -571,8 +568,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale down Standalone") scaledReplicaCount = 1 standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone after scaling down") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone after scaling down") standalone.Spec.Replicas = int32(scaledReplicaCount) err = deployment.UpdateCR(ctx, standalone) @@ -641,7 +637,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to gcs test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec for Standalone + // Create App Framework Spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -658,7 +654,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -678,8 +674,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Scale up Standalone") standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -754,7 +749,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload ES app to gcs test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopePremiumApps, appSourceName, gcsTestDir, 60) appFrameworkSpec.AppSources[0].PremiumAppsProps = enterpriseApi.PremiumAppsProps{ @@ -777,7 +772,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone with App Framework") // Ensure Standalone goes to Ready phase testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -866,7 +861,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to GCS test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -946,7 +941,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGCSBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 0) @@ -975,7 +970,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory", appVersion)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 0) @@ -995,7 +990,7 @@ var _ = Describe("s1appfw test", func() { // Create Standalone Deployment with App Framework standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1126,7 +1121,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload apps to GCS test directory") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework Spec + // Create App Framework Spec appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1140,7 +1135,7 @@ var _ = Describe("s1appfw test", func() { AppFrameworkConfig: appFrameworkSpec, } - // Create App framework Spec + // Create App Framework Spec appSourceNameStandalone2 := "appframework-2-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appSourceVolumeNameStandalone2 := "appframework-test-volume-2-" + testenv.RandomDNSName(3) appFrameworkSpecStandalone2 := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameStandalone2, enterpriseApi.ScopeLocal, appSourceNameStandalone2, gcsTestDirStandalone2, 60) @@ -1210,7 +1205,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGCSBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -1249,7 +1244,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1269,7 +1264,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App installation is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyComplete) @@ -1326,7 +1321,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1343,7 +1338,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // ############ Verify livenessProbe and readinessProbe config object and scripts############ testcaseEnvInst.Log.Info("Get config map for livenessProbe and readinessProbe") @@ -1416,7 +1411,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1433,7 +1428,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgDownloadComplete, enterpriseApi.AppPkgDownloadPending) @@ -1489,7 +1484,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1507,7 +1502,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) @@ -1569,7 +1564,7 @@ var _ = Describe("s1appfw test", func() { * Verify no pod resets triggered due to app install * Verify App enabled and version by running splunk cmd // ############ Modify secret key ########### - * Create App framework volume with random credentials and apply to Spec + * Create App Framework volume with random credentials and apply to Spec * Check for changes in App phase to determine if next poll has been triggered ############ UPGRADE V2 APPS ########### * Upload V2 apps to GCS App Source @@ -1600,7 +1595,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1619,7 +1614,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) secretref := standalone.Spec.AppFrameworkConfig.VolList[0].SecretRef - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), secretref) Expect(err).To(Succeed(), "Unable to obtain secret object") @@ -1639,7 +1634,7 @@ var _ = Describe("s1appfw test", func() { testcaseEnvInst.VerifyAppFrameworkState(ctx, deployment, allAppSourceInfo, splunkPodUIDs, "") // ############ Modify secret key ########### - // Create App framework volume with invalid credentials and apply to Spec + // Create App Framework volume with invalid credentials and apply to Spec testcaseEnvInst.Log.Info("Update Standalone spec with invalid credentials") err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), secretref, modifiedSecretData) Expect(err).To(Succeed(), "Unable to update secret Object") @@ -1721,7 +1716,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload app to GCS test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 120) spec := enterpriseApi.StandaloneSpec{ @@ -1738,7 +1733,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App download is in progress on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgInstallComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1816,7 +1811,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 15 - // Create App framework Spec + // Create App Framework Spec appSourceName := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -1880,7 +1875,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), "Unable to upload big-size app to GCS test directory for Standalone") uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) spec := enterpriseApi.StandaloneSpec{ @@ -1897,7 +1892,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify App Download is completed on Standalone testcaseEnvInst.VerifyAppState(ctx, deployment, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending) @@ -1951,7 +1946,7 @@ var _ = Describe("s1appfw test", func() { Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to GCS test directory for Monitoring Console %s", appVersion, testGCSBucket)) uploadedApps = append(uploadedApps, uploadedFiles...) - // Create App framework spec for Monitoring Console + // Create App Framework spec for Monitoring Console appSourceNameMC := "appframework-" + enterpriseApi.ScopeLocal + "mc-" + testenv.RandomDNSName(3) appSourceVolumeNameMC := "appframework-test-volume-mc-" + testenv.RandomDNSName(3) appFrameworkSpecMC := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeNameMC, enterpriseApi.ScopeLocal, appSourceNameMC, gcsTestDirMC, 60) @@ -1989,7 +1984,7 @@ var _ = Describe("s1appfw test", func() { // Maximum apps to be downloaded in parallel maxConcurrentAppDownloads := 5 - // Create App framework spec for Standalone + // Create App Framework spec for Standalone appSourceName = "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) appFrameworkSpec := testenv.GenerateAppFrameworkSpec(ctx, testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, gcsTestDir, 60) appFrameworkSpec.MaxConcurrentAppDownloads = uint64(maxConcurrentAppDownloads) @@ -2010,7 +2005,7 @@ var _ = Describe("s1appfw test", func() { // Deploy Standalone testcaseEnvInst.Log.Info("Deploy Standalone") standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") // Verify IsDeploymentInProgress Flag is set to true for Standalone CR testcaseEnvInst.VerifyIsDeploymentInProgressFlagIsSet(ctx, deployment, deployment.GetName(), standalone.Kind) diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index 0309d0117..50e1d1248 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -66,12 +66,21 @@ func RunS1CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, defaultCPULimits string, newCPULimits string) { // Deploy Single site Cluster and Search Head Clusters mcRef := deployment.GetName() + prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true /*shc*/, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - // Verify cluster is ready, RF/SF is met, and MC is ready - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.StandardC3Verification(ctx, deployment, deployment.GetName(), testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "")) + // Verify cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { + config.ClusterManagerReady(ctx, d, testcaseEnvInst) + }) + + // Verify telemetry + testcaseEnvInst.TriggerAndVerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) + + // Deploy and verify Monitoring Console, RF/SF + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") + testcaseEnvInst.StandardC3Verification(ctx, deployment, deployment.GetName(), mc) // Verify CPU limits on Indexers before updating the CR indexerCount := 3 @@ -80,7 +89,7 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes // Change CPU limits to trigger CR update idxc := &enterpriseApi.IndexerCluster{} instanceName := fmt.Sprintf("%s-idxc", deployment.GetName()) - testenv.GetInstanceWithExpect(ctx, deployment, idxc, instanceName, "Unable to get instance of indexer cluster") + testenv.GetInstanceWithExpect(ctx, deployment, idxc, instanceName, "Unable to get instance of Indexer Cluster") idxc.Spec.Resources.Limits = corev1.ResourceList{ "cpu": resource.MustParse(newCPULimits), } @@ -116,6 +125,9 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes // Verify Search Head go to ready state testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Verify CPU limits on Search Heads after updating the CR testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, newCPULimits) } @@ -128,8 +140,10 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t Expect(err).To(Succeed(), "Unable to deploy cluster") // Verify cluster is ready and RF/SF is met - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyClusterReadyAndRFSF(ctx, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { + config.ClusterManagerReady(ctx, d, testcaseEnvInst) + }) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, "") @@ -139,15 +153,13 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t // Delete the Search Head Cluster shc := &enterpriseApi.SearchHeadCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-shc", shc) - Expect(err).To(Succeed(), "Unable to GET SHC instance", "SHC Name", shc) + testenv.GetInstanceWithExpect(ctx, deployment, shc, deployment.GetName()+"-shc", "Unable to GET SHC instance") err = deployment.DeleteCR(ctx, shc) Expect(err).To(Succeed(), "Unable to delete SHC instance", "SHC Name", shc) // Delete the Indexer Cluster idxc := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) - Expect(err).To(Succeed(), "Unable to GET IDXC instance", "IDXC Name", idxc) + testenv.GetInstanceWithExpect(ctx, deployment, idxc, deployment.GetName()+"-idxc", "Unable to GET IDXC instance") err = deployment.DeleteCR(ctx, idxc) Expect(err).To(Succeed(), "Unable to delete IDXC instance", "IDXC Name", idxc) @@ -155,8 +167,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t config.DeleteClusterManager(ctx, deployment) // Delete Monitoring Console - err = deployment.GetInstance(ctx, mcRef, mc) - Expect(err).To(Succeed(), "Unable to GET Monitoring Console instance", "Monitoring Console Name", mcRef) + testenv.GetInstanceWithExpect(ctx, deployment, mc, mcRef, "Unable to GET Monitoring Console instance") err = deployment.DeleteCR(ctx, mc) Expect(err).To(Succeed(), "Unable to delete Monitoring Console instance", "Monitoring Console Name", mcRef) @@ -240,21 +251,14 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes testcaseEnvInst.TriggerAndVerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) - // Deploy Monitoring Console CRD - mc, err := deployment.DeployMonitoringConsole(ctx, mcRef, "") - Expect(err).To(Succeed(), "Unable to deploy Monitoring Console One instance") - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, "") // Verify RF SF is met testcaseEnvInst.VerifyRFSFMet(ctx, deployment) // Verify CPU limits on Indexers before updating the CR - for i := 1; i <= siteCount; i++ { - podName := fmt.Sprintf(testenv.MultiSiteIndexerPod, deployment.GetName(), i, 0) - testcaseEnvInst.VerifyCPULimits(deployment, podName, defaultCPULimits) - } + testcaseEnvInst.VerifyCPULimitsOnAllSites(deployment, deployment.GetName(), siteCount, defaultCPULimits) // Change CPU limits to trigger CR update idxc := &enterpriseApi.IndexerCluster{} diff --git a/test/custom_resource_crud/custom_resource_crud_test.go b/test/custom_resource_crud/custom_resource_crud_test.go index c64dbbc75..f01200b58 100644 --- a/test/custom_resource_crud/custom_resource_crud_test.go +++ b/test/custom_resource_crud/custom_resource_crud_test.go @@ -21,7 +21,7 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("Crcrud test", func() { +var _ = Describe("Custom Resource CRUD test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -60,7 +60,7 @@ var _ = Describe("Crcrud test", func() { for _, tc := range c3CrudConfigs { tc := tc - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { BeforeEach(func() { defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits @@ -72,7 +72,7 @@ var _ = Describe("Crcrud test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, c3: can deploy indexer and search head cluster, change their CR, update the instances", func() { + It(tc.label+", integration, c3: can deploy Indexer and Search Head Cluster, change their CR, update the instances", func() { config := tc.newConfig() RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) @@ -112,7 +112,7 @@ var _ = Describe("Crcrud test", func() { for _, tc := range m4CrudConfigs { tc := tc - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { + Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster)", func() { BeforeEach(func() { defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits @@ -123,7 +123,7 @@ var _ = Describe("Crcrud test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, m4: can deploy multisite indexer and search head clusters, change their CR, update the instances", func() { + It(tc.label+", integration, m4: can deploy multisite Indexer and Search Head Clusters, change their CR, update the instances", func() { config := tc.newConfig() RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) diff --git a/test/delete_cr/deletecr_test.go b/test/delete_cr/deletecr_test.go index b64a7a02e..167d4ea24 100644 --- a/test/delete_cr/deletecr_test.go +++ b/test/delete_cr/deletecr_test.go @@ -21,7 +21,7 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("DeleteCR test", func() { +var _ = Describe("Delete CR test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -35,7 +35,7 @@ var _ = Describe("DeleteCR test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Standalone deployment (S1 - Standalone Pod)", func() { + Context("Standalone deployment (S1)", func() { It("integration, managerdeletecr: can deploy standalone and delete", func() { testenv.RunDeleteStandaloneWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName()) }) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go index 1e8a5ba31..db2169a99 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_test.go @@ -78,15 +78,8 @@ var _ = Describe("Index and Ingestion Separation test", func() { )} queue.SQS.VolList = volumeSpec - // Deploy Queue - testcaseEnvInst.Log.Info("Deploy Queue") - q, err := deployment.DeployQueue(ctx, "queue", queue) - Expect(err).To(Succeed(), "Unable to deploy Queue") - - // Deploy ObjectStorage - testcaseEnvInst.Log.Info("Deploy ObjectStorage") - objStorage, err := deployment.DeployObjectStorage(ctx, "os", objectStorage) - Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") + // Deploy Queue and ObjectStorage + q, objStorage := deployQueueAndObjectStorage(ctx, deployment, queue, objectStorage) // Deploy Ingestor Cluster with additional configurations (similar to standalone app framework test) appSourceName := "appframework-" + enterpriseApi.ScopeLocal + testenv.RandomDNSName(3) @@ -134,7 +127,7 @@ var _ = Describe("Index and Ingestion Separation test", func() { } testcaseEnvInst.Log.Info("Deploy Ingestor Cluster with additional configurations") - _, err = deployment.DeployIngestorClusterWithAdditionalConfiguration(ctx, ic) + _, err := deployment.DeployIngestorClusterWithAdditionalConfiguration(ctx, ic) Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster") // Ensure that Ingestor Cluster is in Ready phase @@ -180,8 +173,7 @@ var _ = Describe("Index and Ingestion Separation test", func() { // Get instance of current Ingestor Cluster CR with latest config testcaseEnvInst.Log.Info("Get instance of current Ingestor Cluster CR with latest config") ingest := &enterpriseApi.IngestorCluster{} - err := deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) - Expect(err).To(Succeed(), "Failed to get instance of Ingestor Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, ingest, deployment.GetName()+"-ingest", "Failed to get instance of Ingestor Cluster") // Verify Ingestor Cluster Status testcaseEnvInst.Log.Info("Verify Ingestor Cluster Status") @@ -191,8 +183,7 @@ var _ = Describe("Index and Ingestion Separation test", func() { // Get instance of current Indexer Cluster CR with latest config testcaseEnvInst.Log.Info("Get instance of current Indexer Cluster CR with latest config") index := &enterpriseApi.IndexerCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", index) - Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, index, deployment.GetName()+"-idxc", "Failed to get instance of Indexer Cluster") // Verify Indexer Cluster Status testcaseEnvInst.Log.Info("Verify Indexer Cluster Status") @@ -207,18 +198,10 @@ var _ = Describe("Index and Ingestion Separation test", func() { if strings.Contains(pod, "ingest") || strings.Contains(pod, "idxc") { // Verify outputs.conf - testcaseEnvInst.Log.Info("Verify outputs.conf") - outputsPath := "opt/splunk/etc/system/local/outputs.conf" - outputsConf, err := testenv.GetConfFile(pod, outputsPath, deployment.GetName()) - Expect(err).To(Succeed(), "Failed to get outputs.conf from Ingestor Cluster pod") - testenv.ValidateContent(outputsConf, outputs, true) + verifyConfFileContent(pod, "opt/splunk/etc/system/local/outputs.conf", deployment.GetName(), outputs, "Failed to get outputs.conf from Ingestor Cluster pod") // Verify default-mode.conf - testcaseEnvInst.Log.Info("Verify default-mode.conf") - defaultsPath := "opt/splunk/etc/system/local/default-mode.conf" - defaultsConf, err := testenv.GetConfFile(pod, defaultsPath, deployment.GetName()) - Expect(err).To(Succeed(), "Failed to get default-mode.conf from Ingestor Cluster pod") - testenv.ValidateContent(defaultsConf, defaultsAll, true) + verifyConfFileContent(pod, "opt/splunk/etc/system/local/default-mode.conf", deployment.GetName(), defaultsAll, "Failed to get default-mode.conf from Ingestor Cluster pod") // Verify AWS env variables testcaseEnvInst.Log.Info("Verify AWS env variables") @@ -233,17 +216,31 @@ var _ = Describe("Index and Ingestion Separation test", func() { testenv.ValidateContent(defaultsConf, defaultsIngest, true) } else if strings.Contains(pod, "idxc") { // Verify inputs.conf - testcaseEnvInst.Log.Info("Verify inputs.conf") - inputsPath := "opt/splunk/etc/system/local/inputs.conf" - inputsConf, err := testenv.GetConfFile(pod, inputsPath, deployment.GetName()) - Expect(err).To(Succeed(), "Failed to get inputs.conf from Indexer Cluster pod") - testenv.ValidateContent(inputsConf, inputs, true) + verifyConfFileContent(pod, "opt/splunk/etc/system/local/inputs.conf", deployment.GetName(), inputs, "Failed to get inputs.conf from Indexer Cluster pod") } } }) }) }) +// verifyConfFileContent retrieves a conf file from a pod and validates its content. +func verifyConfFileContent(pod, confPath, deploymentName string, expectedContent []string, errorMsg string) { + conf, err := testenv.GetConfFile(pod, confPath, deploymentName) + Expect(err).To(Succeed(), errorMsg) + testenv.ValidateContent(conf, expectedContent, true) +} + +// deployQueueAndObjectStorage deploys a Queue and ObjectStorage CR and returns both. +func deployQueueAndObjectStorage(ctx context.Context, deployment *testenv.Deployment, qSpec enterpriseApi.QueueSpec, osSpec enterpriseApi.ObjectStorageSpec) (*enterpriseApi.Queue, *enterpriseApi.ObjectStorage) { + q, err := deployment.DeployQueue(ctx, "queue", qSpec) + Expect(err).To(Succeed(), "Unable to deploy Queue") + + objStorage, err := deployment.DeployObjectStorage(ctx, "os", osSpec) + Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") + + return q, objStorage +} + // setupIngestorStack deploys the full Queue/ObjectStorage/IngestorCluster/ClusterManager/IndexerCluster stack // and verifies each component reaches the Ready phase. func setupIngestorStack(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, qSpec enterpriseApi.QueueSpec, osSpec enterpriseApi.ObjectStorageSpec, cmSpec enterpriseApi.ClusterManagerSpec) { @@ -253,13 +250,9 @@ func setupIngestorStack(ctx context.Context, deployment *testenv.Deployment, tes )} qSpec.SQS.VolList = volumeSpec - q, err := deployment.DeployQueue(ctx, "queue", qSpec) - Expect(err).To(Succeed(), "Unable to deploy Queue") - - objStorage, err := deployment.DeployObjectStorage(ctx, "os", osSpec) - Expect(err).To(Succeed(), "Unable to deploy ObjectStorage") + q, objStorage := deployQueueAndObjectStorage(ctx, deployment, qSpec, osSpec) - _, err = deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") + _, err := deployment.DeployIngestorCluster(ctx, deployment.GetName()+"-ingest", 3, v1.ObjectReference{Name: q.Name}, v1.ObjectReference{Name: objStorage.Name}, "") Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster") _, err = deployment.DeployClusterManagerWithGivenSpec(ctx, deployment.GetName(), cmSpec) @@ -277,29 +270,25 @@ func setupIngestorStack(ctx context.Context, deployment *testenv.Deployment, tes func deleteIngestorStack(ctx context.Context, deployment *testenv.Deployment) { // Delete the Indexer Cluster idxc := &enterpriseApi.IndexerCluster{} - err := deployment.GetInstance(ctx, deployment.GetName()+"-idxc", idxc) - Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance", "Indexer Cluster Name", idxc) - err = deployment.DeleteCR(ctx, idxc) + testenv.GetInstanceWithExpect(ctx, deployment, idxc, deployment.GetName()+"-idxc", "Unable to get Indexer Cluster instance") + err := deployment.DeleteCR(ctx, idxc) Expect(err).To(Succeed(), "Unable to delete Indexer Cluster instance", "Indexer Cluster Name", idxc) // Delete the Ingestor Cluster ingest := &enterpriseApi.IngestorCluster{} - err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest) - Expect(err).To(Succeed(), "Unable to get Ingestor Cluster instance", "Ingestor Cluster Name", ingest) + testenv.GetInstanceWithExpect(ctx, deployment, ingest, deployment.GetName()+"-ingest", "Unable to get Ingestor Cluster instance") err = deployment.DeleteCR(ctx, ingest) Expect(err).To(Succeed(), "Unable to delete Ingestor Cluster instance", "Ingestor Cluster Name", ingest) // Delete the Queue q := &enterpriseApi.Queue{} - err = deployment.GetInstance(ctx, "queue", q) - Expect(err).To(Succeed(), "Unable to get Queue instance", "Queue Name", q) + testenv.GetInstanceWithExpect(ctx, deployment, q, "queue", "Unable to get Queue instance") err = deployment.DeleteCR(ctx, q) Expect(err).To(Succeed(), "Unable to delete Queue", "Queue Name", q) // Delete the ObjectStorage objStorage := &enterpriseApi.ObjectStorage{} - err = deployment.GetInstance(ctx, "os", objStorage) - Expect(err).To(Succeed(), "Unable to get ObjectStorage instance", "ObjectStorage Name", objStorage) + testenv.GetInstanceWithExpect(ctx, deployment, objStorage, "os", "Unable to get ObjectStorage instance") err = deployment.DeleteCR(ctx, objStorage) Expect(err).To(Succeed(), "Unable to delete ObjectStorage", "ObjectStorage Name", objStorage) } diff --git a/test/ingest_search/ingest_search_test.go b/test/ingest_search/ingest_search_test.go index 2ec4e63b9..4fdb8d888 100644 --- a/test/ingest_search/ingest_search_test.go +++ b/test/ingest_search/ingest_search_test.go @@ -21,7 +21,7 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("Ingest and Search Test", func() { +var _ = Describe("Ingest and Search test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment diff --git a/test/ingest_search/ingest_search_test_shared.go b/test/ingest_search/ingest_search_test_shared.go index 1dccd1b58..6873c3558 100644 --- a/test/ingest_search/ingest_search_test_shared.go +++ b/test/ingest_search/ingest_search_test_shared.go @@ -32,10 +32,7 @@ import ( // RunS1InternalLogSearchTest deploys a Standalone instance and verifies internal log searches // using both synchronous and asynchronous search APIs. func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) { - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") Eventually(func() enterpriseApi.Phase { podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) @@ -102,10 +99,7 @@ func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deploym // RunS1IngestAndSearchTest deploys a Standalone instance, ingests a custom log file into a new // index, and verifies the ingested data is searchable via both sync and async search APIs. func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) { - standalone, err := deployment.DeployStandalone(ctx, deployment.GetName(), "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance ") - - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") Eventually(func() enterpriseApi.Phase { podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) @@ -128,14 +122,14 @@ func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deploymen return enterpriseApi.PhaseError } - testcaseEnvInst.Log.Info("Waiting for standalone splunkd status to be ready", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase) + testcaseEnvInst.Log.Info("Waiting for standalone splunkd status to be ready", "instance", standalone.ObjectMeta.Name, "phase", standalone.Status.Phase) return standalone.Status.Phase }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) indexName := "myTestIndex" - err = testenv.CreateAnIndexStandalone(ctx, indexName, podName, deployment) + err := testenv.CreateAnIndexStandalone(ctx, indexName, podName, deployment) Expect(err).To(Succeed(), "Failed response to add index to splunk") logFile := "/tmp/test.log" diff --git a/test/licensemanager/lm_appfw_test.go b/test/licensemanager/lm_appfw_test.go index 0ec351063..4089e1a54 100644 --- a/test/licensemanager/lm_appfw_test.go +++ b/test/licensemanager/lm_appfw_test.go @@ -37,7 +37,7 @@ var _ = Describe("Licensemanager App Framework test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Manager", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster) with License Manager", func() { It("licensemanager, integration, c3: Splunk Operator can configure a C3 SVA and have apps installed locally on LM", func() { RunLMC3AppFrameworkTest(ctx, deployment, testcaseEnvInst, testenvInstance, config) }) diff --git a/test/licensemanager/lm_test.go b/test/licensemanager/lm_test.go index 625d1a674..634d880e5 100644 --- a/test/licensemanager/lm_test.go +++ b/test/licensemanager/lm_test.go @@ -43,14 +43,14 @@ var _ = Describe("Licensemanager test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Manager", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster) with License Manager", func() { It("licensemanager, integration, c3: Splunk Operator can configure License Manager with Indexers and Search Heads in C3 SVA", func() { RunLMC3Test(ctx, deployment, testcaseEnvInst, config) }) }) - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster) with License Manager", func() { - It("licensemanager, integration, m4: Splunk Operator can configure License Manager with indexers and search head in M4 SVA", func() { + Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster) with License Manager", func() { + It("licensemanager, integration, m4: Splunk Operator can configure License Manager with Indexers and Search Heads in M4 SVA", func() { RunLMM4Test(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 69eabf821..31d2c17f0 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -35,6 +35,23 @@ type LicenseTestConfig struct { LicenseManagerPodName string } +func newLicenseCommonSplunkSpec(testcaseEnvInst *testenv.TestCaseEnv) enterpriseApi.CommonSplunkSpec { + return enterpriseApi.CommonSplunkSpec{ + Volumes: []corev1.Volume{{ + Name: "licenses", + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: testcaseEnvInst.GetLMConfigMap(), + }, + }, + }, + }}, + LicenseURL: "/mnt/licenses/enterprise.lic", + Spec: enterpriseApi.Spec{ImagePullPolicy: "Always", Image: testcaseEnvInst.GetSplunkImage()}, + } +} + func NewLicenseMasterConfig() *LicenseTestConfig { return &LicenseTestConfig{ ClusterReadinessConfig: testenv.NewClusterReadinessConfigV3(), @@ -43,20 +60,7 @@ func NewLicenseMasterConfig() *LicenseTestConfig { }, BuildLMAppFrameworkSpec: func(testcaseEnvInst *testenv.TestCaseEnv, appFrameworkSpec enterpriseApi.AppFrameworkSpec) interface{} { return enterpriseApiV3.LicenseMasterSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Volumes: []corev1.Volume{{ - Name: "licenses", - VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: testcaseEnvInst.GetLMConfigMap(), - }, - }, - }, - }}, - LicenseURL: "/mnt/licenses/enterprise.lic", - Spec: enterpriseApi.Spec{ImagePullPolicy: "Always", Image: testcaseEnvInst.GetSplunkImage()}, - }, + CommonSplunkSpec: newLicenseCommonSplunkSpec(testcaseEnvInst), AppFrameworkConfig: appFrameworkSpec, } }, @@ -72,20 +76,7 @@ func NewLicenseManagerConfig() *LicenseTestConfig { }, BuildLMAppFrameworkSpec: func(testcaseEnvInst *testenv.TestCaseEnv, appFrameworkSpec enterpriseApi.AppFrameworkSpec) interface{} { return enterpriseApi.LicenseManagerSpec{ - CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ - Volumes: []corev1.Volume{{ - Name: "licenses", - VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: testcaseEnvInst.GetLMConfigMap(), - }, - }, - }, - }}, - LicenseURL: "/mnt/licenses/enterprise.lic", - Spec: enterpriseApi.Spec{ImagePullPolicy: "Always", Image: testcaseEnvInst.GetSplunkImage()}, - }, + CommonSplunkSpec: newLicenseCommonSplunkSpec(testcaseEnvInst), AppFrameworkConfig: appFrameworkSpec, } }, @@ -94,18 +85,19 @@ func NewLicenseManagerConfig() *LicenseTestConfig { } func downloadAppFiles(ctx context.Context, testDataS3Bucket, azureDataContainer, appDir, downloadDir string, appFileList []string, version string) { + var err error + switch testenv.ClusterProvider { case "eks": - err := testenv.DownloadFilesFromS3(testDataS3Bucket, appDir, downloadDir, appFileList) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to download %s app files", version)) + err = testenv.DownloadFilesFromS3(testDataS3Bucket, appDir, downloadDir, appFileList) case "azure": containerName := "/" + azureDataContainer + "/" + appDir - err := testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDir, containerName, appFileList) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to download %s app files", version)) + err = testenv.DownloadFilesFromAzure(ctx, testenv.GetAzureEndpoint(ctx), testenv.StorageAccountKey, testenv.StorageAccount, downloadDir, containerName, appFileList) case "gcp": - err := testenv.DownloadFilesFromGCP(testDataS3Bucket, appDir, downloadDir, appFileList) - Expect(err).To(Succeed(), fmt.Sprintf("Unable to download %s app files", version)) + err = testenv.DownloadFilesFromGCP(testDataS3Bucket, appDir, downloadDir, appFileList) } + + Expect(err).To(Succeed(), fmt.Sprintf("Unable to download %s app files", version)) } func uploadAppFiles(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, testS3Bucket, testDir, downloadDir string, appFileList []string, version string) []string { @@ -143,13 +135,13 @@ func deleteUploadedFiles(ctx context.Context, testS3Bucket string, uploadedApps } func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download License File + // Download license file testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - // Create standalone Deployment with License Manager/Master + // Create Standalone deployment with License Manager/Master mcRef := deployment.GetName() standalone, err := config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with LM") // Wait for License Manager/Master to be in READY status config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) @@ -160,10 +152,10 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn // Deploy and verify Monitoring Console _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) - // ############ Verify livenessProbe and readinessProbe config object and scripts############ + // Verify livenessProbe and readinessProbe config object and scripts testcaseEnvInst.VerifyProbeConfigAndScripts(ctx, deployment, false) - // Verify License Manager/Master is configured on standalone instance + // Verify License Manager/Master is configured on Standalone instance standalonePodName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) testenv.VerifyLMConfiguredOnPod(ctx, deployment, standalonePodName) @@ -173,22 +165,24 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn } func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download License File + // Download license file testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - // Deploy Single site Cluster with License Manager/Master + // Deploy single site Cluster with License Manager/Master mcRef := deployment.GetName() err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { + config.ClusterManagerReady(ctx, d, testcaseEnvInst) + }) deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) // Verify License Manager/Master is configured on indexers and search heads - testenv.VerifyLMConfiguredOnIndexers(ctx, deployment, deployment.GetName(), 3) - testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) + indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), 3, false, 0) + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), 3, false, 0) + testenv.VerifyLMConfiguredOnPods(ctx, deployment, append(indexerPods, shPods...)) testenv.VerifyLMConfiguredOnMC(ctx, deployment) } @@ -222,10 +216,10 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment uploadedFiles := uploadAppFiles(ctx, testcaseEnvInst, testS3Bucket, testDir, downloadDirV1, appFileList, appVersion) uploadedApps = append(uploadedApps, uploadedFiles...) - // Download License File + // Download license file testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - // Create App framework Spec + // Create app framework spec volumeName := "lm-test-volume-" + testenv.RandomDNSName(3) var volumeSpec []enterpriseApi.VolumeSpec switch testenv.ClusterProvider { @@ -237,17 +231,17 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment volumeSpec = []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volumeName, testenv.GetS3Endpoint(), testcaseEnvInst.GetIndexSecretName(), "gcp", "blob", testenv.GetDefaultS3Region())} } - // AppSourceDefaultSpec: Remote Storage volume name and Scope of App deployment + // AppSourceDefaultSpec: Remote Storage volume name and scope of app deployment appSourceDefaultSpec := enterpriseApi.AppSourceDefaultSpec{ VolName: volumeName, Scope: enterpriseApi.ScopeLocal, } - // appSourceSpec: App source name, location and volume name and scope from appSourceDefaultSpec + // appSourceSpec: app source name, location and volume name and scope from appSourceDefaultSpec appSourceName := "lm-" + testenv.RandomDNSName(3) appSourceSpec := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceName, testDir, appSourceDefaultSpec)} - // appFrameworkSpec: AppSource settings, Poll Interval, volumes, appSources on volumes + // appFrameworkSpec: AppSource settings, poll interval, volumes, appSources on volumes appFrameworkSpec := enterpriseApi.AppFrameworkSpec{ Defaults: appSourceDefaultSpec, AppsRepoPollInterval: 60, @@ -260,7 +254,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment // Deploy the License Manager/Master with App Framework var err error _, err = config.DeployLicenseManagerWithGivenSpec(ctx, deployment, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy LM with App framework") + Expect(err).To(Succeed(), "Unable to deploy LM with App Framework") // Wait for License Manager/Master to be in READY status config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) @@ -309,7 +303,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment } func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download License File + // Download license file testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Deploy Multisite Cluster with License Manager/Master and Search Head @@ -324,8 +318,9 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) // Verify License Manager/Master is configured on indexers and search heads - testenv.VerifyLMConfiguredOnMultisiteIndexers(ctx, deployment, deployment.GetName(), siteCount) - testenv.VerifyLMConfiguredOnSearchHeads(ctx, deployment, deployment.GetName(), 3) + indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), 1, true, siteCount) + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), 3, false, 0) + testenv.VerifyLMConfiguredOnPods(ctx, deployment, append(indexerPods, shPods...)) testenv.VerifyLMConfiguredOnMC(ctx, deployment) } diff --git a/test/licensemaster/lm_appfw_test.go b/test/licensemaster/lm_appfw_test.go index b6be9a105..0536c05aa 100644 --- a/test/licensemaster/lm_appfw_test.go +++ b/test/licensemaster/lm_appfw_test.go @@ -39,7 +39,7 @@ var _ = Describe("Licensemaster App Framework test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Master", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster) with License Master", func() { It("licensemaster, integration, c3: Splunk Operator can configure a C3 SVA and have apps installed locally on LM", func() { licensemanager.RunLMC3AppFrameworkTest(ctx, deployment, testcaseEnvInst, testenvInstance, config) }) diff --git a/test/licensemaster/lm_test.go b/test/licensemaster/lm_test.go index 8d08dc433..55c5010af 100644 --- a/test/licensemaster/lm_test.go +++ b/test/licensemaster/lm_test.go @@ -45,14 +45,14 @@ var _ = Describe("Licensemaster test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster) with License Master", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster) with License Master", func() { It("licensemaster, integration, c3: Splunk Operator can configure License Master with Indexers and Search Heads in C3 SVA", func() { licensemanager.RunLMC3Test(ctx, deployment, testcaseEnvInst, config) }) }) - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster) with License Master", func() { - It("licensemaster, integration, m4: Splunk Operator can configure License Master with indexers and search head in M4 SVA", func() { + Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster) with License Master", func() { + It("licensemaster, integration, m4: Splunk Operator can configure License Master with Indexers and Search Heads in M4 SVA", func() { licensemanager.RunLMM4Test(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/monitoring_console/monitoring_console_suite_test.go b/test/monitoring_console/monitoring_console_suite_test.go index 74bf5b17c..167041418 100644 --- a/test/monitoring_console/monitoring_console_suite_test.go +++ b/test/monitoring_console/monitoring_console_suite_test.go @@ -15,7 +15,6 @@ package monitoringconsoletest import ( "testing" - "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -32,10 +31,7 @@ var ( func TestBasic(t *testing.T) { RegisterFailHandler(Fail) - sc, _ := GinkgoConfiguration() - sc.Timeout = 240 * time.Minute - - RunSpecs(t, "Running "+testSuiteName, sc) + RunSpecs(t, "Running "+testSuiteName) } var _ = BeforeSuite(func() { diff --git a/test/monitoring_console/mc_test.go b/test/monitoring_console/monitoring_console_test.go similarity index 93% rename from test/monitoring_console/mc_test.go rename to test/monitoring_console/monitoring_console_test.go index 8210e096f..67104889b 100644 --- a/test/monitoring_console/mc_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -42,7 +42,7 @@ var _ = Describe("Monitoring Console test (master)", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("mastermc, smoke: MC can configure SHC, indexer instances after scale up and standalone in a namespace", func() { /* Test Steps @@ -50,7 +50,7 @@ var _ = Describe("Monitoring Console test (master)", func() { 2. Deploy Monitoring Console 3. Wait for Monitoring Console status to go back to READY 4. Verify SH are configured in MC Config Map - 5. VerifyMonitoring Console Pod has Search Heads in Peer strings + 5. Verify Monitoring Console Pod has Search Heads in Peer strings 6. Verify Monitoring Console Pod has peers(indexers) in Peer string 7. Scale SH Cluster 8. Scale Indexer Count @@ -95,10 +95,10 @@ var _ = Describe("Monitoring Console test (master)", func() { // Deploy Standalone with MC reference testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) - // Ensure Indexer cluster go to Ready phase + // Ensure Indexer Cluster goes to Ready phase testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready Phase + // Ensure Search Head Cluster goes to Ready Phase // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -151,11 +151,10 @@ var _ = Describe("Monitoring Console test (master)", func() { mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") + Expect(err).To(Succeed(), "Unable to deploy Cluster Master") - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) @@ -173,8 +172,7 @@ var _ = Describe("Monitoring Console test (master)", func() { mcTwoName := deployment.GetName() + "-two" cm := &enterpriseApiV3.ClusterMaster{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) @@ -210,7 +208,7 @@ var _ = Describe("Monitoring Console test (master)", func() { shcName := deployment.GetName() + "-shc" testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) - // Ensure Search Head Cluster go to Ready Phase + // Ensure Search Head Cluster goes to Ready Phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) // Verify MC is Ready and stays in ready state @@ -224,7 +222,7 @@ var _ = Describe("Monitoring Console test (master)", func() { }) }) - Context("Multisite Clustered deployment (M4 - 3 Site clustered indexer, search head cluster)", func() { + Context("Multisite Clustered deployment (M4 - 3 Site Clustered Indexer, Search Head Cluster)", func() { It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { /* Test Steps @@ -276,10 +274,7 @@ var _ = Describe("Monitoring Console test (master)", func() { testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) // Deploy and verify Monitoring Console Two - mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - // Verify Monitoring Console TWO is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") masterParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"} VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, false) @@ -350,8 +345,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Reconfig S1 with 2nd Monitoring Console Name mcTwoName := deployment.GetName() + "-two" - err = deployment.GetInstance(ctx, standaloneOneName, standaloneOne) - Expect(err).To(Succeed(), "Unable to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standaloneOne, standaloneOneName, "Unable to get instance of Standalone") standaloneOne.Spec.MonitoringConsoleRef.Name = mcTwoName // Update Standalone with 2nd MC @@ -423,8 +417,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { testcaseEnvInst.Log.Info("Scaling Standalone CR") scaledReplicaCount := 2 standalone = &enterpriseApi.Standalone{} - err = deployment.GetInstance(ctx, deployment.GetName(), standalone) - Expect(err).To(Succeed(), "Failed to get instance of Standalone") + testenv.GetInstanceWithExpect(ctx, deployment, standalone, deployment.GetName(), "Failed to get instance of Standalone") standalone.Spec.Replicas = int32(scaledReplicaCount) @@ -451,7 +444,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("managermc, smoke: MC can configure SHC, indexer instances after scale up and standalone in a namespace", func() { /* Test Steps @@ -459,7 +452,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { 2. Deploy Monitoring Console 3. Wait for Monitoring Console status to go back to READY 4. Verify SH are configured in MC Config Map - 5. VerifyMonitoring Console Pod has Search Heads in Peer strings + 5. Verify Monitoring Console Pod has Search Heads in Peer strings 6. Verify Monitoring Console Pod has peers(indexers) in Peer string 7. Scale SH Cluster 8. Scale Indexer Count @@ -479,9 +472,8 @@ var _ = Describe("Monitoring Console test (manager)", func() { err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) @@ -525,10 +517,10 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // Ensure Indexer cluster go to Ready phase + // Ensure Indexer Cluster goes to Ready phase testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - // Ensure Search Head Cluster go to Ready Phase + // Ensure Search Head Cluster goes to Ready Phase // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) @@ -594,9 +586,8 @@ var _ = Describe("Monitoring Console test (manager)", func() { err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) @@ -625,8 +616,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { mcTwoName := deployment.GetName() + "-two" cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") // get revision number of the resource resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) @@ -660,15 +650,14 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Get instance of current SHC CR with latest config shc := &enterpriseApi.SearchHeadCluster{} shcName := deployment.GetName() + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Failed to get instance of Search Head Cluster") + testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Failed to get instance of Search Head Cluster") // Update SHC to use 2nd Monitoring Console shc.Spec.MonitoringConsoleRef.Name = mcTwoName err = deployment.UpdateCR(ctx, shc) Expect(err).To(Succeed(), "Failed to update Monitoring Console in Search Head Cluster CRD") - // Ensure Search Head Cluster go to Ready Phase + // Ensure Search Head Cluster goes to Ready Phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) // Verify MC is Ready and stays in ready state @@ -682,7 +671,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { }) }) - Context("Multisite Clustered deployment (M4 - 3 Site clustered indexer, search head cluster)", func() { + Context("Multisite Clustered deployment (M4 - 3 Site Clustered Indexer, Search Head Cluster)", func() { It("managermc2, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { /* Test Steps @@ -748,8 +737,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { // ############ CLUSTER MANAGER MC RECONFIG ################################# mcTwoName := deployment.GetName() + "-two" cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, deployment.GetName(), cm) - Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") + testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index 100647fd2..7cf06c586 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -32,12 +32,12 @@ import ( func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, standaloneOneName, standaloneTwoName string) { mcName := deployment.GetName() - // Deploy standalone one with MCRef + // Deploy Standalone one with MCRef spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) Expect(err).To(Succeed(), "Unable to deploy standalone instance") - // Wait for standalone to be in READY Status + // Wait for Standalone to be in READY Status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneOneName, standaloneOne) // Deploy MC and wait for MC to be READY @@ -49,7 +49,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC Config Map") verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) - // get revision number of the resource + // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) // Add another standalone instance in namespace @@ -120,7 +120,7 @@ func verifyStandaloneInMC(ctx context.Context, deployment *testenv.Deployment, t } // MCReconfigParams holds the service name and URL parameters that differ between -// V3 (master) and V4 (manager) monitoring console tests. +// V3 (master) and V4 (manager) Monitoring Console tests. type MCReconfigParams struct { CMServiceNameFmt string // format string for CM service name (e.g., testenv.ClusterMasterServiceName) CMURLKey string // config map URL key (e.g., "SPLUNK_CLUSTER_MASTER_URL" or splcommon.ClusterManagerURL) diff --git a/test/secret/secret_test.go b/test/secret/secret_test.go index 71aed45d1..f2e6d01d7 100644 --- a/test/secret/secret_test.go +++ b/test/secret/secret_test.go @@ -21,7 +21,7 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) -var _ = Describe("Secret Test", func() { +var _ = Describe("Secret test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment @@ -70,7 +70,7 @@ var _ = Describe("Secret Test", func() { for _, tc := range c3SecretConfigs { tc := tc - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) }) @@ -79,7 +79,7 @@ var _ = Describe("Secret Test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", smoke, c3: secret update on indexers and search head cluster", func() { + It(tc.label+", smoke, c3: secret update on Indexers and Search Head Cluster", func() { config := tc.newConfig() RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) @@ -98,7 +98,7 @@ var _ = Describe("Secret Test", func() { for _, tc := range m4SecretConfigs { tc := tc - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { + Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster)", func() { BeforeEach(func() { testenv.SpecifiedTestTimeout = 40000 testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) @@ -108,7 +108,7 @@ var _ = Describe("Secret Test", func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, m4: secret update on multisite indexers and search head cluster", func() { + It(tc.label+", integration, m4: secret update on multisite Indexers and Search Head Cluster", func() { config := tc.newConfig() RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index 6041cb28f..f575a401e 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -162,9 +162,6 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - // Get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -197,8 +194,10 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) - testcaseEnvInst.VerifyC3ComponentsReady(ctx, deployment) + config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { + config.ClusterManagerReady(ctx, d, testcaseEnvInst) + }) mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) @@ -209,7 +208,7 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) - // Ensure Search Head Cluster go to Ready phase + // Ensure Search Head Cluster goes to Ready phase testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) // Wait for PasswordSyncCompleted event on SearchHeadCluster diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index daa4dfc7a..d9a7a7148 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -41,7 +41,7 @@ var _ = Describe("Smartstore test", func() { for _, tc := range smartstoreConfigs { tc := tc - Context("Standalone Deployment (S1)", func() { + Context("Standalone deployment (S1)", func() { BeforeEach(func() { testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index ee501a7b2..17d1d2eb7 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -162,7 +162,7 @@ func RunS1EphemeralStorageTest(ctx context.Context, deployment *testenv.Deployme } standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App framework") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance with App Framework") testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) } @@ -194,7 +194,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) // Use multisite workflow helper to verify index, ingest data, roll to warm, and verify on S3 - testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexName, 2000) + testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexName) // Get old bundle hash before adding new index oldBundleHash := config.GetBundleHash(ctx, deployment) @@ -224,5 +224,5 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo // Use multisite workflow helper for the new index testcaseEnvInst.Log.Info("Ingesting data on index", "Index Name", indexNameTwo) - testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexNameTwo, 2000) + testcaseEnvInst.MultisiteIndexerWorkflow(ctx, deployment, deployment.GetName(), siteCount, indexNameTwo) } diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index b9a705251..66f355c33 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -41,19 +41,19 @@ var _ = Describe("Smoke test", func() { }) }) - Context("Clustered deployment (C3 - clustered indexer, search head cluster)", func() { + Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { It("smoke, basic, c3: can deploy indexers and search head cluster", func() { testenv.RunC3DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 3, "") }) }) - Context("Multisite cluster deployment (M4 - Multisite indexer cluster, Search head cluster)", func() { + Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster)", func() { It("smoke, basic, m4: can deploy indexers and search head cluster", func() { testenv.RunM4DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 1, 3, "") }) }) - Context("Multisite cluster deployment (M1 - multisite indexer cluster)", func() { + Context("Multisite cluster deployment (M1 - Multisite Indexer Cluster)", func() { It("smoke, basic: can deploy multisite indexers cluster", func() { testenv.RunM1DeploymentWorkflow(ctx, deployment, testcaseEnvInst, deployment.GetName(), 1, 3) }) diff --git a/test/testenv/appframework_utils.go b/test/testenv/appframework_utils.go index a60554bd6..6b6f08ef5 100644 --- a/test/testenv/appframework_utils.go +++ b/test/testenv/appframework_utils.go @@ -109,7 +109,7 @@ var PVTestAppsLocation = "appframework/100mb_sample_apps/" // AppStagingLocOnPod is the volume on Splunk pod where apps will be copied from operator var AppStagingLocOnPod = "/operator-staging/appframework/" -// AppDownloadVolume location on Operator pod for App framework downloads +// AppDownloadVolume location on Operator pod for App Framework downloads var AppDownloadVolume = "/opt/splunk/appframework/downloadedApps/" // GenerateAppSourceSpec return AppSourceSpec struct with given values @@ -125,7 +125,7 @@ func GenerateAppSourceSpec(appSourceName string, appSourceLocation string, appSo func GetPodAppStatus(ctx context.Context, deployment *Deployment, podName string, ns string, appname string, clusterWideInstall bool) (string, string, error) { // For clusterwide install do not check for versions on deployer and cluster-manager as the apps arent installed there if clusterWideInstall && (strings.Contains(podName, "-cluster-manager-") || strings.Contains(podName, splcommon.TestClusterManagerDashed) || strings.Contains(podName, "-deployer-")) { - logf.Log.Info("Pod skipped as install is Cluter-wide", "PodName", podName) + logf.Log.Info("Pod skipped as install is Cluter-wide", "podName", podName) return "", "", nil } output, err := GetPodAppInstallStatus(ctx, deployment, podName, ns, appname) @@ -154,11 +154,11 @@ func GetPodInstalledAppVersion(deployment *Deployment, podName string, ns string } } filePath := fmt.Sprintf("/opt/splunk/%s/%s/default/app.conf", path, appname) - logf.Log.Info("Check app version", "App", appname, "Conf file", filePath) + logf.Log.Info("Check app version", "app", appname, "confFile", filePath) confline, err := GetConfLineFromPod(podName, filePath, ns, "version", "launcher", true) if err != nil { - logf.Log.Error(err, "Failed to get version from pod", "Pod Name", podName) + logf.Log.Error(err, "Failed to get version from pod", "podName", podName) return "", err } version := strings.TrimSpace(strings.Split(confline, "=")[1]) @@ -181,7 +181,7 @@ func GetPodAppInstallStatus(ctx context.Context, deployment *Deployment, podName return "", err } - logf.Log.Info("Command executed", "on pod", podName, "command", command, "stdin", stdin, "stdout", stdout) + logf.Log.Info("Command executed", "onPod", podName, "command", command, "stdin", stdin, "stdout", stdout) return strings.TrimSuffix(stdout, "\n"), nil } @@ -195,7 +195,7 @@ func GetPodAppbtoolStatus(ctx context.Context, deployment *Deployment, podName s logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "command", command, "stdin", stdin) return "", err } - logf.Log.Info("Command executed", "on pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) + logf.Log.Info("Command executed", "onPod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) if len(stdout) > 0 { if strings.Contains(strings.Split(stdout, "\n")[0], "App is disabled") { @@ -218,13 +218,13 @@ func GetAppFileList(appList []string) []string { // GetAppframeworkManualUpdateConfigMap gets config map for given manual update configmap func GetAppframeworkManualUpdateConfigMap(ctx context.Context, deployment *Deployment, ns string) (*corev1.ConfigMap, error) { ConfigMapName := fmt.Sprintf(AppframeworkManualUpdateConfigMap, ns) - logf.Log.Info("Get config map for", "CONFIG MAP NAME", ConfigMapName) + logf.Log.Info("Get config map for", "configMapName", ConfigMapName) ConfigMap, err := GetConfigMap(ctx, deployment, ns, ConfigMapName) if err != nil { logf.Log.Error(err, "Failed to get splunk manual poll Config Map") return ConfigMap, err } - logf.Log.Info("Config Map contents", "CONFIG MAP NAME", ConfigMapName, "Data", ConfigMap.Data) + logf.Log.Info("Config Map contents", "configMapName", ConfigMapName, "data", ConfigMap.Data) return ConfigMap, err } @@ -234,19 +234,19 @@ func GetAppDeploymentInfoStandalone(ctx context.Context, deployment *Deployment, appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, standalone) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := standalone.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Standalone AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Standalone Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Standalone AppInfo Struct", "appName", appName, "appSource", appSourceName, "standaloneName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Standalone Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "standaloneName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Standalone Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "standaloneName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } @@ -256,19 +256,19 @@ func GetAppDeploymentInfoIngestorCluster(ctx context.Context, deployment *Deploy appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, ingestor) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := ingestor.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Ingestor AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Ingestor Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Ingestor AppInfo Struct", "appName", appName, "appSource", appSourceName, "ingestorName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Ingestor Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "ingestorName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Ingestor Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "ingestorName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } @@ -278,19 +278,19 @@ func GetAppDeploymentInfoMonitoringConsole(ctx context.Context, deployment *Depl appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, mc) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := mc.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Monitoring Console AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Monitoring Console Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Monitoring Console AppInfo Struct", "appName", appName, "appSource", appSourceName, "monitoringConsoleName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Monitoring Console Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "monitoringConsoleName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Monitoring Console Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "monitoringConsoleName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } @@ -300,41 +300,41 @@ func GetAppDeploymentInfoClusterManager(ctx context.Context, deployment *Deploym appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, cm) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := cm.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Cluster Manager AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Cluster Manager Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Cluster Manager AppInfo Struct", "appName", appName, "appSource", appSourceName, "clusterManagerName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Cluster Manager Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "clusterManagerName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Cluster Manager Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "clusterManagerName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } -// GetAppDeploymentInfoClusterMaster returns AppDeploymentInfo for given Cluster Manager, appSourceName and appName +// GetAppDeploymentInfoClusterMaster returns AppDeploymentInfo for given Cluster Master, appSourceName and appName func GetAppDeploymentInfoClusterMaster(ctx context.Context, deployment *Deployment, testenvInstance *TestCaseEnv, name string, appSourceName string, appName string) (enterpriseApi.AppDeploymentInfo, error) { cm := &enterpriseApiV3.ClusterMaster{} appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, cm) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := cm.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Cluster Master AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Cluster Master Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Cluster Master AppInfo Struct", "appName", appName, "appSource", appSourceName, "clusterMasterName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Cluster Master Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "clusterMasterName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Cluster Master Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "clusterMasterName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } @@ -344,19 +344,19 @@ func GetAppDeploymentInfoSearchHeadCluster(ctx context.Context, deployment *Depl appDeploymentInfo := enterpriseApi.AppDeploymentInfo{} err := deployment.GetInstance(ctx, name, cm) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name) return appDeploymentInfo, err } appInfoList := cm.Status.AppContext.AppsSrcDeployStatus[appSourceName].AppDeploymentInfoList for _, appInfo := range appInfoList { - testenvInstance.Log.Info("Checking Search Head Cluster AppInfo Struct", "App Name", appName, "App Source", appSourceName, "Search Head Name Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("Checking Search Head Cluster AppInfo Struct", "appName", appName, "appSource", appSourceName, "searchHeadClusterName", name, "appDeploymentInfo", appInfo) if strings.Contains(appName, appInfo.AppName) { - testenvInstance.Log.Info("App Deployment Info found.", "App Name", appName, "App Source", appSourceName, "Search Head Name Name", name, "AppDeploymentInfo", appInfo) + testenvInstance.Log.Info("App Deployment Info found.", "appName", appName, "appSource", appSourceName, "searchHeadClusterName", name, "appDeploymentInfo", appInfo) appDeploymentInfo = appInfo return appDeploymentInfo, nil } } - testenvInstance.Log.Info("App Info not found in App Info List", "App Name", appName, "App Source", appSourceName, "Search Head Name Name", name, "App Info List", appInfoList) + testenvInstance.Log.Info("App Info not found in App Info List", "appName", appName, "appSource", appSourceName, "searchHeadClusterName", name, "appInfoList", appInfoList) return appDeploymentInfo, err } @@ -389,7 +389,7 @@ func GetAppDeploymentInfo(ctx context.Context, deployment *Deployment, testenvIn func GenerateAppFrameworkSpec(ctx context.Context, testenvInstance *TestCaseEnv, volumeName string, scope string, appSourceName string, s3TestDir string, pollInterval int) enterpriseApi.AppFrameworkSpec { var volumeSpec []enterpriseApi.VolumeSpec - // Create App framework volume + // Create App Framework volume switch ClusterProvider { case "eks": volumeSpec = []enterpriseApi.VolumeSpec{GenerateIndexVolumeSpec(volumeName, GetS3Endpoint(), testenvInstance.GetIndexSecretName(), "aws", "s3", GetDefaultS3Region())} @@ -404,7 +404,7 @@ func GenerateAppFrameworkSpec(ctx context.Context, testenvInstance *TestCaseEnv, volumeSpec = []enterpriseApi.VolumeSpec{GenerateIndexVolumeSpec(volumeName, GetGCPEndpoint(), testenvInstance.GetIndexSecretName(), "gcp", "gcs", GetDefaultS3Region())} default: - testenvInstance.Log.Info("Failed to identify cluster provider name: Should be 'eks' or 'azure' or 'gcp' ") + testenvInstance.Log.Info("Failed to identify provider: Should be 'eks' or 'azure' or 'gcp'") } // AppSourceDefaultSpec: Remote Storage volume name and Scope of App deployment @@ -601,7 +601,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApi.Standalone{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -609,7 +609,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApi.MonitoringConsole{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -617,7 +617,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApi.SearchHeadCluster{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -625,7 +625,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApiV3.ClusterMaster{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -633,7 +633,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApi.ClusterManager{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -641,7 +641,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApiV3.LicenseMaster{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress @@ -649,7 +649,7 @@ func GetIsDeploymentInProgressFlag(ctx context.Context, deployment *Deployment, cr := &enterpriseApi.LicenseManager{} err := deployment.GetInstance(ctx, name, cr) if err != nil { - testenvInstance.Log.Error(err, "Failed to get CR ", "CR Name", name, "CR Kind", crKind) + testenvInstance.Log.Error(err, "Failed to get CR ", "crName", name, "crKind", crKind) return isDeploymentInProgress, err } isDeploymentInProgress = cr.Status.AppContext.IsDeploymentInProgress diff --git a/test/testenv/assertion_helpers.go b/test/testenv/assertion_helpers.go index 9b1574951..c274a5dc4 100644 --- a/test/testenv/assertion_helpers.go +++ b/test/testenv/assertion_helpers.go @@ -35,7 +35,7 @@ func (testcaseenv *TestCaseEnv) ScaleSearchHeadCluster(ctx context.Context, depl shc.Spec.Replicas = int32(newReplicas) UpdateCRWithExpect(ctx, deployment, shc, "Failed to scale Search Head Cluster") - // Verify Search Head cluster scales up and goes to ScalingUp phase + // Verify Search Head Cluster scales up and goes to ScalingUp phase testcaseenv.VerifySearchHeadClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp) } @@ -51,7 +51,7 @@ func (testcaseenv *TestCaseEnv) ScaleIndexerCluster(ctx context.Context, deploym idxc.Spec.Replicas = int32(newReplicas) UpdateCRWithExpect(ctx, deployment, idxc, "Failed to scale Indexer Cluster") - // Verify Indexer cluster scales up and goes to ScalingUp phase + // Verify Indexer Cluster scales up and goes to ScalingUp phase testcaseenv.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseScalingUp, idxcName) } @@ -84,7 +84,7 @@ func (testcaseenv *TestCaseEnv) VerifyMCConfigForC3Cluster(ctx context.Context, // Check Deployer in MC Config Map testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(DeployerServiceName, deploymentName)}, "SPLUNK_DEPLOYER_URL", mcName, shouldExist) - // Check Search Head Pods in MC Config Map + // Check Search Head pods in MC Config Map shPods := GeneratePodNameSlice(SearchHeadPod, deploymentName, shReplicas, false, 0) testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, shouldExist) @@ -98,10 +98,10 @@ func (testcaseenv *TestCaseEnv) VerifyMCConfigForC3Cluster(ctx context.Context, // VerifyMCConfigForM4Cluster verifies the standard MC configuration for an M4 multisite cluster func (testcaseenv *TestCaseEnv) VerifyMCConfigForM4Cluster(ctx context.Context, deployment *Deployment, deploymentName string, mcName string, shReplicas int, indexerReplicas int, siteCount int, shouldExist bool) { - // Check Cluster Manager in MC Config Map + // Check cluster manager in MC Config Map testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(ClusterMasterServiceName, deploymentName)}, "SPLUNK_CLUSTER_MASTER_URL", mcName, shouldExist) - // Check Deployer in MC Config Map + // Check deployer in MC Config Map testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(DeployerServiceName, deploymentName)}, "SPLUNK_DEPLOYER_URL", mcName, shouldExist) // Check Search Head Pods in MC Config Map @@ -119,7 +119,7 @@ func (testcaseenv *TestCaseEnv) VerifyMCConfigForM4Cluster(ctx context.Context, // DeployAndVerifyC3WithMC deploys a C3 cluster with a given MC and verifies all components are ready func (testcaseenv *TestCaseEnv) DeployAndVerifyC3WithMC(ctx context.Context, deployment *Deployment, deploymentName string, indexerReplicas int, mcName string) { err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deploymentName, indexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") + Expect(err).To(Succeed(), "Unable to deploy Cluster Master") // Verify all components are ready testcaseenv.VerifyClusterMasterReady(ctx, deployment) @@ -156,46 +156,58 @@ func (testcaseenv *TestCaseEnv) VerifyStandaloneInMC(ctx context.Context, deploy testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, []string{standalonePod}, mcName, shouldExist, false) } -// VerifyLMConfiguredOnIndexers verifies License Manager is configured on all indexer pods -func VerifyLMConfiguredOnIndexers(ctx context.Context, deployment *Deployment, deploymentName string, indexerCount int) { - for i := 0; i < indexerCount; i++ { - indexerPodName := fmt.Sprintf(IndexerPod, deploymentName, i) - VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) - } -} - -// VerifyLMConfiguredOnSearchHeads verifies License Manager is configured on all search head pods -func VerifyLMConfiguredOnSearchHeads(ctx context.Context, deployment *Deployment, deploymentName string, searchHeadCount int) { - for i := 0; i < searchHeadCount; i++ { - searchHeadPodName := fmt.Sprintf(SearchHeadPod, deploymentName, i) - VerifyLMConfiguredOnPod(ctx, deployment, searchHeadPodName) - } -} - -// VerifyLMConfiguredOnMultisiteIndexers verifies License Manager is configured on all multisite indexer pods -func VerifyLMConfiguredOnMultisiteIndexers(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int) { - for i := 1; i <= siteCount; i++ { - indexerPodName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, i, 0) - VerifyLMConfiguredOnPod(ctx, deployment, indexerPodName) +// VerifyLMConfiguredOnPods verifies License Manager is configured on all given pods +func VerifyLMConfiguredOnPods(ctx context.Context, deployment *Deployment, podNames []string) { + for _, podName := range podNames { + VerifyLMConfiguredOnPod(ctx, deployment, podName) } } // IngestDataOnIndexers ingests test data on all indexer pods -func IngestDataOnIndexers(ctx context.Context, deployment *Deployment, deploymentName string, indexerCount int, indexName string, logLineCount int) { +func IngestDataOnIndexers(ctx context.Context, deployment *Deployment, deploymentName string, indexerCount int) { for i := 0; i < indexerCount; i++ { podName := fmt.Sprintf(IndexerPod, deploymentName, i) logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) - CreateMockLogfile(logFile, logLineCount) - IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + CreateMockLogfile(logFile, LogLineCount) + IngestFileViaMonitor(ctx, logFile, DefaultIngestIndex, podName, deployment) } } +// VerifyM1ClusterReady verifies the cluster coordinator, indexers, and multisite status are ready (no SHC). +func (testcaseenv *TestCaseEnv) VerifyM1ClusterReady(ctx context.Context, deployment *Deployment, siteCount int, verifyCoordinator func(context.Context, *Deployment)) { + verifyCoordinator(ctx, deployment) + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) +} + +// VerifyM4ClusterReady verifies the cluster coordinator, indexers, multisite status, and SHC are ready. +func (testcaseenv *TestCaseEnv) VerifyM4ClusterReady(ctx context.Context, deployment *Deployment, siteCount int, verifyCoordinator func(context.Context, *Deployment)) { + verifyCoordinator(ctx, deployment) + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) +} + +// VerifyM4IndexersAndSHCReady verifies the cluster coordinator, indexers, and SHC are ready (without multisite check). +func (testcaseenv *TestCaseEnv) VerifyM4IndexersAndSHCReady(ctx context.Context, deployment *Deployment, siteCount int, verifyCoordinator func(context.Context, *Deployment)) { + verifyCoordinator(ctx, deployment) + testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) +} + +// VerifyC3ClusterReady verifies the cluster coordinator, SHC, and single-site indexers are ready. +func (testcaseenv *TestCaseEnv) VerifyC3ClusterReady(ctx context.Context, deployment *Deployment, verifyCoordinator func(context.Context, *Deployment)) { + verifyCoordinator(ctx, deployment) + testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) + testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) +} + // IngestDataOnMultisiteIndexers ingests test data on all multisite indexer pods -func IngestDataOnMultisiteIndexers(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { +func IngestDataOnMultisiteIndexers(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int) { for site := 1; site <= siteCount; site++ { podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, site, 0) logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) - CreateMockLogfile(logFile, logLineCount) - IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) + CreateMockLogfile(logFile, LogLineCount) + IngestFileViaMonitor(ctx, logFile, DefaultIngestIndex, podName, deployment) } } diff --git a/test/testenv/azureutils.go b/test/testenv/azureutils.go index 84a3f0601..04491d808 100644 --- a/test/testenv/azureutils.go +++ b/test/testenv/azureutils.go @@ -338,7 +338,7 @@ func (client *AzureBlobClient) DownloadFileFromAzure(ctx context.Context, downlo return "", err } - logf.Log.Info("Download from Azure successful:", "File", downloadRequest.RemoteFile) + logf.Log.Info("Download from Azure successful:", "file", downloadRequest.RemoteFile) return localFile.Name(), err } @@ -354,7 +354,7 @@ func DownloadFilesFromAzure(ctx context.Context, endPoint, accountKey, accountNa } _, err := azureBlobClient.DownloadFileFromAzure(ctx, downloadRequest, endPoint, StorageAccountKey, StorageAccount) if err != nil { - logf.Log.Error(err, "Unable to download file", "File Name", key) + logf.Log.Error(err, "Unable to download file", "fileName", key) return err } } @@ -374,7 +374,7 @@ func DownloadLicenseFromAzure(ctx context.Context, downloadDir string) (string, azureBlobClient := &AzureBlobClient{} filename, err := azureBlobClient.DownloadFileFromAzure(ctx, downloadRequest, GetAzureEndpoint(ctx), StorageAccountKey, StorageAccount) if err != nil { - logf.Log.Error(err, "Unable to download license file", "File", filename) + logf.Log.Error(err, "Unable to download license file", "file", filename) } return filename, err } @@ -431,7 +431,7 @@ func UploadFilesToAzure(ctx context.Context, accountName, accountKey, uploadFrom fileFullPath := "https://" + StorageAccount + ".blob.core.windows.net" + "/" + azureIndexesContainer + "/" + containerName + "/" + key fileName, err := UploadFileToAzure(ctx, accountName, accountKey, fileFullPath, fileLocation) if err != nil { - logf.Log.Error(err, "Unable to upload file", "File name", key) + logf.Log.Error(err, "Unable to upload file", "fileName", key) return nil, err } uploadedFiles = append(uploadedFiles, fileName) diff --git a/test/testenv/cmutil.go b/test/testenv/cmutil.go index 6fc06a1d4..e9b251ffb 100644 --- a/test/testenv/cmutil.go +++ b/test/testenv/cmutil.go @@ -158,7 +158,7 @@ func CheckIndexerOnCM(ctx context.Context, deployment *Deployment, indexerName s restResponse := GetIndexersOrSearchHeadsOnCM(ctx, deployment, "peer") found := false for _, entry := range restResponse.Entry { - logf.Log.Info("Peer found On CM", "Indexer Name", entry.Content.Label, "Status", entry.Content.Status) + logf.Log.Info("Peer found On CM", "indexerName", entry.Content.Label, "status", entry.Content.Status) if entry.Content.Label == indexerName { found = true break @@ -172,7 +172,7 @@ func CheckSearchHeadOnCM(ctx context.Context, deployment *Deployment, searchHead restResponse := GetIndexersOrSearchHeadsOnCM(ctx, deployment, "sh") found := false for _, entry := range restResponse.Entry { - logf.Log.Info("Search Head On CM", "Search Head", entry.Content.Label, "Status", entry.Content.Status) + logf.Log.Info("Search Head On CM", "searchHead", entry.Content.Label, "status", entry.Content.Status) if entry.Content.Label == searchHeadName { found = true break @@ -186,7 +186,7 @@ func CheckSearchHeadRemoved(ctx context.Context, deployment *Deployment) bool { restResponse := GetIndexersOrSearchHeadsOnCM(ctx, deployment, "sh") searchHeadRemoved := true for _, entry := range restResponse.Entry { - logf.Log.Info("Search Found", "Search Head", entry.Content.Label, "Status", entry.Content.Status) + logf.Log.Info("Search Found", "searchHead", entry.Content.Label, "status", entry.Content.Status) if entry.Content.Status == "Disconnected" { searchHeadRemoved = false } @@ -260,7 +260,7 @@ func CMBundlePushstatus(ctx context.Context, deployment *Deployment, previousBun // Check if new bundle was pushed by comparing hash if previousBundleHash != "" { if entry.Content.BundleID == previousBundleHash { - logf.Log.Info("Bundle hash not updated", "old Bundle hash", previousBundleHash, "new Bundle hash", entry.Content.BundleID) + logf.Log.Info("Bundle hash not updated", "oldBundleHash", previousBundleHash, "newBundleHash", entry.Content.BundleID) continue } } @@ -283,6 +283,6 @@ func GetClusterManagerBundleHash(ctx context.Context, deployment *Deployment, cr restResponse := ClusterManagerInfoResponse(ctx, deployment, podName) bundleHash := restResponse.Entry[0].Content.ActiveBundle.Checksum - logf.Log.Info("Bundle Hash on Cluster Manager Found", "Hash", bundleHash) + logf.Log.Info("Bundle Hash on Cluster Manager Found", "hash", bundleHash) return bundleHash } diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index 35e561eda..6c2aa043a 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" ) -// ClusterReadinessConfig holds v3/v4 API version callbacks for cluster and license manager +// ClusterReadinessConfig holds v3/v4 API version callbacks for cluster and License Manager // readiness verification. Shared across test packages to avoid per-package duplication. type ClusterReadinessConfig struct { LicenseManagerReady func(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) @@ -141,14 +141,14 @@ func (c *ClusterReadinessConfig) AppendSmartStoreIndex(ctx context.Context, depl Expect(err).To(Succeed(), "Failed to get instance of Cluster Master") cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster master") + Expect(err).To(Succeed(), "Failed to add new index to Cluster Master") } else { cm := &enterpriseApi.ClusterManager{} err := deployment.GetInstance(ctx, name, cm) Expect(err).To(Succeed(), "Failed to get instance of Cluster Manager") cm.Spec.SmartStore.IndexList = append(cm.Spec.SmartStore.IndexList, newIndex...) err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to add new index to cluster manager") + Expect(err).To(Succeed(), "Failed to add new index to Cluster Manager") } } @@ -163,13 +163,13 @@ func (testcaseenv *TestCaseEnv) DeployMCAndGetVersion(ctx context.Context, deplo // DeployAndVerifyStandalone deploys a standalone instance and verifies it reaches ready state func (testcaseenv *TestCaseEnv) DeployAndVerifyStandalone(ctx context.Context, deployment *Deployment, name string, mcRef string, licenseManagerRef string) *enterpriseApi.Standalone { standalone, err := deployment.DeployStandalone(ctx, name, mcRef, licenseManagerRef) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") + Expect(err).To(Succeed(), "Unable to deploy Standalone instance") testcaseenv.VerifyStandaloneReady(ctx, deployment, name, standalone) return standalone } -// DeployAndVerifyMonitoringConsole deploys a monitoring console and verifies it reaches ready state +// DeployAndVerifyMonitoringConsole deploys a Monitoring Console and verifies it reaches ready state func (testcaseenv *TestCaseEnv) DeployAndVerifyMonitoringConsole(ctx context.Context, deployment *Deployment, name string, licenseManagerRef string) *enterpriseApi.MonitoringConsole { mc, err := deployment.DeployMonitoringConsole(ctx, name, licenseManagerRef) Expect(err).To(Succeed(), "Unable to deploy Monitoring Console instance") @@ -194,12 +194,6 @@ func (testcaseenv *TestCaseEnv) VerifySearchHeadCPULimits(deployment *Deployment } } -// VerifyC3ComponentsReady verifies SHC and single-site indexers are ready (without CM check or RFSF). -func (testcaseenv *TestCaseEnv) VerifyC3ComponentsReady(ctx context.Context, deployment *Deployment) { - testcaseenv.VerifySearchHeadClusterReady(ctx, deployment) - testcaseenv.VerifySingleSiteIndexersReady(ctx, deployment) -} - // VerifyM4ComponentsReady verifies multisite indexers, multisite status, and SHC are ready (without CM check or RFSF). func (testcaseenv *TestCaseEnv) VerifyM4ComponentsReady(ctx context.Context, deployment *Deployment, siteCount int) { testcaseenv.VerifyIndexersReady(ctx, deployment, siteCount) @@ -215,8 +209,7 @@ func (testcaseenv *TestCaseEnv) VerifyMCVersionChangedAndReady(ctx context.Conte // VerifyClusterReadyAndRFSF is a common verification pattern that checks cluster is ready and RF/SF is met func (testcaseenv *TestCaseEnv) VerifyClusterReadyAndRFSF(ctx context.Context, deployment *Deployment) { - testcaseenv.VerifyClusterManagerReady(ctx, deployment) - testcaseenv.VerifyC3ComponentsReady(ctx, deployment) + testcaseenv.VerifyC3ClusterReady(ctx, deployment, testcaseenv.VerifyClusterManagerReady) testcaseenv.VerifyRFSFMet(ctx, deployment) } diff --git a/test/testenv/deployment.go b/test/testenv/deployment.go index f832d1fda..17059fb18 100644 --- a/test/testenv/deployment.go +++ b/test/testenv/deployment.go @@ -154,7 +154,7 @@ func (d *Deployment) DeployStandalone(ctx context.Context, name string, mcRef st // If license file specified, deploy License Manager if LicenseManager != "" && d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return nil, err @@ -326,7 +326,7 @@ func (d *Deployment) OperatorPodExecCommand(ctx context.Context, podName string, return stdout.String(), stderr.String(), nil } -// DeployLicenseManager deploys the license manager instance +// DeployLicenseManager deploys the License Manager instance func (d *Deployment) DeployLicenseManager(ctx context.Context, name string) (*enterpriseApi.LicenseManager, error) { if d.testenv.licenseFilePath == "" { @@ -344,7 +344,7 @@ func (d *Deployment) DeployLicenseManager(ctx context.Context, name string) (*en return deployed.(*enterpriseApi.LicenseManager), err } -// DeployLicenseMaster deploys the license manager instance +// DeployLicenseMaster deploys the License Master instance func (d *Deployment) DeployLicenseMaster(ctx context.Context, name string) (*enterpriseApiV3.LicenseMaster, error) { if d.testenv.licenseFilePath == "" { @@ -362,9 +362,9 @@ func (d *Deployment) DeployLicenseMaster(ctx context.Context, name string) (*ent return deployed.(*enterpriseApiV3.LicenseMaster), err } -// DeployClusterManager deploys the cluster manager +// DeployClusterManager deploys the Cluster Manager func (d *Deployment) DeployClusterManager(ctx context.Context, name, LicenseManagerName string, ansibleConfig string, mcRef string) (*enterpriseApi.ClusterManager, error) { - d.testenv.Log.Info("Deploying cluster-manager", "name", name, "LicenseRef", LicenseManagerName) + d.testenv.Log.Info("Deploying Cluster Manager", "name", name, "LicenseRef", LicenseManagerName) cm := newClusterManager(name, d.testenv.namespace, LicenseManagerName, ansibleConfig, d.testenv.splunkImage) if mcRef != "" { cm.Spec.MonitoringConsoleRef = corev1.ObjectReference{ @@ -382,9 +382,9 @@ func (d *Deployment) DeployClusterManager(ctx context.Context, name, LicenseMana return deployed.(*enterpriseApi.ClusterManager), err } -// DeployClusterMaster deploys the cluster manager +// DeployClusterMaster deploys the Cluster Master func (d *Deployment) DeployClusterMaster(ctx context.Context, name, LicenseManagerName string, ansibleConfig string, mcRef string) (*enterpriseApiV3.ClusterMaster, error) { - d.testenv.Log.Info("Deploying cluster-master", "name", name, "LicenseRef", LicenseManagerName) + d.testenv.Log.Info("Deploying Cluster Master", "name", name, "LicenseRef", LicenseManagerName) cm := newClusterMaster(name, d.testenv.namespace, LicenseManagerName, ansibleConfig, d.testenv.splunkImage) if mcRef != "" { cm.Spec.MonitoringConsoleRef = corev1.ObjectReference{ @@ -402,9 +402,9 @@ func (d *Deployment) DeployClusterMaster(ctx context.Context, name, LicenseManag return deployed.(*enterpriseApiV3.ClusterMaster), err } -// DeployClusterManagerWithSmartStoreIndexes deploys the cluster manager with smartstore indexes +// DeployClusterManagerWithSmartStoreIndexes deploys the Cluster Manager with SmartStore indexes func (d *Deployment) DeployClusterManagerWithSmartStoreIndexes(ctx context.Context, name, LicenseManagerName string, ansibleConfig string, smartstorespec enterpriseApi.SmartStoreSpec) (*enterpriseApi.ClusterManager, error) { - d.testenv.Log.Info("Deploying cluster-manager", "name", name) + d.testenv.Log.Info("Deploying Cluster Manager", "name", name) cm := newClusterManagerWithGivenIndexes(name, d.testenv.namespace, LicenseManagerName, ansibleConfig, d.testenv.splunkImage, smartstorespec) deployed, err := d.deployCR(ctx, name, cm) if err != nil { @@ -416,9 +416,9 @@ func (d *Deployment) DeployClusterManagerWithSmartStoreIndexes(ctx context.Conte return deployed.(*enterpriseApi.ClusterManager), err } -// DeployClusterMasterWithSmartStoreIndexes deploys the cluster manager with smartstore indexes +// DeployClusterMasterWithSmartStoreIndexes deploys the Cluster Master with SmartStore indexes func (d *Deployment) DeployClusterMasterWithSmartStoreIndexes(ctx context.Context, name, LicenseManagerName, ansibleConfig string, smartstorespec enterpriseApi.SmartStoreSpec) (*enterpriseApiV3.ClusterMaster, error) { - d.testenv.Log.Info("Deploying cluster-manager", "name", name) + d.testenv.Log.Info("Deploying Cluster Manager", "name", name) cm := newClusterMasterWithGivenIndexes(name, d.testenv.namespace, LicenseManagerName, ansibleConfig, d.testenv.splunkImage, smartstorespec) deployed, err := d.deployCR(ctx, name, cm) if err != nil { @@ -430,12 +430,12 @@ func (d *Deployment) DeployClusterMasterWithSmartStoreIndexes(ctx context.Contex return deployed.(*enterpriseApiV3.ClusterMaster), err } -// DeployIndexerCluster deploys the indexer cluster +// DeployIndexerCluster deploys the Indexer Cluster func (d *Deployment) DeployIndexerCluster(ctx context.Context, name, LicenseManagerName string, count int, clusterManagerRef string, ansibleConfig string, queue, os corev1.ObjectReference, serviceAccountName string) (*enterpriseApi.IndexerCluster, error) { - d.testenv.Log.Info("Deploying indexer cluster", "name", name, "CM", clusterManagerRef) + d.testenv.Log.Info("Deploying Indexer Cluster", "name", name, "CM", clusterManagerRef) indexer := newIndexerCluster(name, d.testenv.namespace, LicenseManagerName, count, clusterManagerRef, ansibleConfig, d.testenv.splunkImage, queue, os, serviceAccountName) pdata, _ := json.Marshal(indexer) - d.testenv.Log.Info("indexer cluster spec", "cr", string(pdata)) + d.testenv.Log.Info("Indexer Cluster spec", "cr", string(pdata)) deployed, err := d.deployCR(ctx, name, indexer) if err != nil { return nil, err @@ -444,14 +444,14 @@ func (d *Deployment) DeployIndexerCluster(ctx context.Context, name, LicenseMana return deployed.(*enterpriseApi.IndexerCluster), err } -// DeployIngestorCluster deploys the ingestor cluster +// DeployIngestorCluster deploys the Ingestor Cluster func (d *Deployment) DeployIngestorCluster(ctx context.Context, name string, count int, queue, os corev1.ObjectReference, serviceAccountName string) (*enterpriseApi.IngestorCluster, error) { - d.testenv.Log.Info("Deploying ingestor cluster", "name", name) + d.testenv.Log.Info("Deploying Ingestor Cluster", "name", name) ingestor := newIngestorCluster(name, d.testenv.namespace, count, d.testenv.splunkImage, queue, os, serviceAccountName) pdata, _ := json.Marshal(ingestor) - d.testenv.Log.Info("ingestor cluster spec", "cr", string(pdata)) + d.testenv.Log.Info("Ingestor Cluster spec", "cr", string(pdata)) deployed, err := d.deployCR(ctx, name, ingestor) if err != nil { return nil, err @@ -492,13 +492,13 @@ func (d *Deployment) DeployObjectStorage(ctx context.Context, name string, objSt return deployed.(*enterpriseApi.ObjectStorage), err } -// DeployIngestorClusterWithAdditionalConfiguration deploys the ingestor cluster with additional configuration +// DeployIngestorClusterWithAdditionalConfiguration deploys the Ingestor Cluster with additional configuration func (d *Deployment) DeployIngestorClusterWithAdditionalConfiguration(ctx context.Context, ic *enterpriseApi.IngestorCluster) (*enterpriseApi.IngestorCluster, error) { - d.testenv.Log.Info("Deploying ingestor cluster with additional configuration", "name", ic.Name) + d.testenv.Log.Info("Deploying Ingestor Cluster with additional configuration", "name", ic.Name) pdata, _ := json.Marshal(ic) - d.testenv.Log.Info("ingestor cluster spec", "cr", string(pdata)) + d.testenv.Log.Info("Ingestor Cluster spec", "cr", string(pdata)) deployed, err := d.deployCR(ctx, ic.Name, ic) if err != nil { return nil, err @@ -507,9 +507,9 @@ func (d *Deployment) DeployIngestorClusterWithAdditionalConfiguration(ctx contex return deployed.(*enterpriseApi.IngestorCluster), err } -// DeploySearchHeadCluster deploys a search head cluster +// DeploySearchHeadCluster deploys a Search Head Cluster func (d *Deployment) DeploySearchHeadCluster(ctx context.Context, name, ClusterManagerRef, LicenseManagerName string, ansibleConfig string, mcRef string) (*enterpriseApi.SearchHeadCluster, error) { - d.testenv.Log.Info("Deploying search head cluster", "name", name) + d.testenv.Log.Info("Deploying Search Head Cluster", "name", name) sh := newSearchHeadCluster(name, d.testenv.namespace, ClusterManagerRef, LicenseManagerName, ansibleConfig, d.testenv.splunkImage) if mcRef != "" { sh.Spec.MonitoringConsoleRef = corev1.ObjectReference{ @@ -553,7 +553,7 @@ func (d *Deployment) deployCR(ctx context.Context, name string, cr client.Object return nil }) - // Returns once we can retrieve the lm instance + // Returns once we can retrieve the LM instance if err := wait.PollImmediate(PollInterval, DefaultTimeout, func() (bool, error) { key := client.ObjectKey{Name: name, Namespace: d.testenv.namespace} err := d.testenv.GetKubeClient().Get(ctx, key, cr) @@ -725,7 +725,7 @@ func (d *Deployment) DeleteCR(ctx context.Context, cr client.Object) error { return err } -// DeploySingleSiteCluster deploys a lm and indexer cluster (shc optional) +// DeploySingleSiteCluster deploys a LM and Indexer Cluster (SHC optional) func (d *Deployment) DeploySingleSiteCluster(ctx context.Context, name string, indexerReplicas int, shc bool, mcRef string) error { var LicenseManager string @@ -734,13 +734,13 @@ func (d *Deployment) DeploySingleSiteCluster(ctx context.Context, name string, i if d.testenv.licenseFilePath != "" { // Enable LM to be tested if strings.Contains(name, "master") { - // Deploy the license master + // Deploy the License Master _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return err } } else { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -751,26 +751,26 @@ func (d *Deployment) DeploySingleSiteCluster(ctx context.Context, name string, i } if strings.Contains(name, "master") { - // Deploy the cluster master + // Deploy the Cluster Master _, err := d.DeployClusterMaster(ctx, name, LicenseManager, "", mcRef) if err != nil { return err } } else { - // Deploy the cluster manager + // Deploy the Cluster Manager _, err := d.DeployClusterManager(ctx, name, LicenseManager, "", mcRef) if err != nil { return err } } - // Deploy the indexer cluster + // Deploy the Indexer Cluster _, err := d.DeployIndexerCluster(ctx, name+"-idxc", LicenseManager, indexerReplicas, name, "", corev1.ObjectReference{}, corev1.ObjectReference{}, "") if err != nil { return err } - // Deploy the SH cluster + // Deploy the SH Cluster if shc { _, err = d.DeploySearchHeadCluster(ctx, name+"-shc", name, LicenseManager, "", mcRef) if err != nil { @@ -781,7 +781,7 @@ func (d *Deployment) DeploySingleSiteCluster(ctx context.Context, name string, i return nil } -// DeployMultisiteClusterMasterWithSearchHead deploys a lm, cluster-manager, indexers in multiple sites and SH clusters +// DeployMultisiteClusterMasterWithSearchHead deploys a LM, Cluster Manager, indexers in multiple sites and SH Clusters func (d *Deployment) DeployMultisiteClusterMasterWithSearchHead(ctx context.Context, name string, indexerReplicas int, siteCount int, mcRef string) error { var LicenseMaster string @@ -796,7 +796,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHead(ctx context.Cont LicenseMaster = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -843,7 +843,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHead(ctx context.Cont return nil } -// DeployMultisiteClusterWithSearchHead deploys a lm, cluster-manager, indexers in multiple sites and SH clusters +// DeployMultisiteClusterWithSearchHead deploys a LM, Cluster Manager, indexers in multiple sites and SH Clusters func (d *Deployment) DeployMultisiteClusterWithSearchHead(ctx context.Context, name string, indexerReplicas int, siteCount int, mcRef string) error { var LicenseManager string @@ -852,13 +852,13 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHead(ctx context.Context, n if d.testenv.licenseFilePath != "" { // Enable LM to be tested if strings.Contains(name, "master") { - // Deploy the license master + // Deploy the License Master _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return err } } else { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -868,7 +868,7 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHead(ctx context.Context, n LicenseManager = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -915,14 +915,14 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHead(ctx context.Context, n return nil } -// DeployMultisiteCluster deploys a lm, cluster-manager, indexers in multiple sites +// DeployMultisiteCluster deploys a LM, Cluster Manager, and indexers in multiple sites func (d *Deployment) DeployMultisiteCluster(ctx context.Context, name string, indexerReplicas int, siteCount int, mcRef string) error { var LicenseManager string // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -931,7 +931,7 @@ func (d *Deployment) DeployMultisiteCluster(ctx context.Context, name string, in LicenseManager = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -965,13 +965,13 @@ func (d *Deployment) DeployMultisiteCluster(ctx context.Context, name string, in return nil } -// DeployStandaloneWithLMaster deploys a standalone splunk enterprise instance with license manager on the specified testenv +// DeployStandaloneWithLMaster deploys a Standalone Splunk Enterprise instance with License Master on the specified testenv func (d *Deployment) DeployStandaloneWithLMaster(ctx context.Context, name string, mcRef string) (*enterpriseApi.Standalone, error) { var LicenseManager string // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return nil, err @@ -992,13 +992,13 @@ func (d *Deployment) DeployStandaloneWithLMaster(ctx context.Context, name strin return deployed.(*enterpriseApi.Standalone), err } -// DeployStandaloneWithLM deploys a standalone splunk enterprise instance with license manager on the specified testenv +// DeployStandaloneWithLM deploys a Standalone Splunk Enterprise instance with License Manager on the specified testenv func (d *Deployment) DeployStandaloneWithLM(ctx context.Context, name string, mcRef string) (*enterpriseApi.Standalone, error) { var LicenseManager string // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return nil, err @@ -1051,14 +1051,14 @@ func (d *Deployment) DeployStandaloneWithGivenSmartStoreSpec(ctx context.Context return deployed.(*enterpriseApi.Standalone), err } -// DeployMultisiteClusterWithSearchHeadAndIndexes deploys a lm, cluster-manager, indexers in multiple sites and SH clusters +// DeployMultisiteClusterWithSearchHeadAndIndexes deploys a LM, Cluster Manager, indexers in multiple sites and SH Clusters func (d *Deployment) DeployMultisiteClusterWithSearchHeadAndIndexes(ctx context.Context, name string, indexerReplicas int, siteCount int, indexesSecret string, smartStoreSpec enterpriseApi.SmartStoreSpec) error { var LicenseManager string // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -1067,7 +1067,7 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHeadAndIndexes(ctx context. LicenseManager = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1106,14 +1106,14 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHeadAndIndexes(ctx context. return err } -// DeployMultisiteClusterMasterWithSearchHeadAndIndexes deploys a lm, cluster-master, indexers in multiple sites and SH clusters +// DeployMultisiteClusterMasterWithSearchHeadAndIndexes deploys a LM, Cluster Master, indexers in multiple sites and SH Clusters func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx context.Context, name string, indexerReplicas int, siteCount int, indexesSecret string, smartStoreSpec enterpriseApi.SmartStoreSpec) error { var LicenseManager string // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return err @@ -1122,7 +1122,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx co LicenseManager = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1161,9 +1161,9 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndIndexes(ctx co return err } -// DeployClusterManagerWithGivenSpec deploys the cluster manager with given SPEC +// DeployClusterManagerWithGivenSpec deploys the Cluster Manager with given SPEC func (d *Deployment) DeployClusterManagerWithGivenSpec(ctx context.Context, name string, spec enterpriseApi.ClusterManagerSpec) (*enterpriseApi.ClusterManager, error) { - d.testenv.Log.Info("Deploying cluster-manager", "name", name) + d.testenv.Log.Info("Deploying Cluster Manager", "name", name) cm := newClusterManagerWithGivenSpec(name, d.testenv.namespace, spec) deployed, err := d.deployCR(ctx, name, cm) if err != nil { @@ -1172,9 +1172,9 @@ func (d *Deployment) DeployClusterManagerWithGivenSpec(ctx context.Context, name return deployed.(*enterpriseApi.ClusterManager), err } -// DeployClusterMasterWithGivenSpec deploys the cluster manager with given SPEC +// DeployClusterMasterWithGivenSpec deploys the Cluster Master with given SPEC func (d *Deployment) DeployClusterMasterWithGivenSpec(ctx context.Context, name string, spec enterpriseApiV3.ClusterMasterSpec) (*enterpriseApiV3.ClusterMaster, error) { - d.testenv.Log.Info("Deploying cluster-master", "name", name) + d.testenv.Log.Info("Deploying Cluster Master", "name", name) cm := newClusterMasterWithGivenSpec(name, d.testenv.namespace, spec) deployed, err := d.deployCR(ctx, name, cm) if err != nil { @@ -1183,17 +1183,17 @@ func (d *Deployment) DeployClusterMasterWithGivenSpec(ctx context.Context, name return deployed.(*enterpriseApiV3.ClusterMaster), err } -// DeploySearchHeadClusterWithGivenSpec deploys a search head cluster +// DeploySearchHeadClusterWithGivenSpec deploys a Search Head Cluster func (d *Deployment) DeploySearchHeadClusterWithGivenSpec(ctx context.Context, name string, spec enterpriseApi.SearchHeadClusterSpec) (*enterpriseApi.SearchHeadCluster, error) { - d.testenv.Log.Info("Deploying search head cluster", "name", name) + d.testenv.Log.Info("Deploying Search Head Cluster", "name", name) indexer := newSearchHeadClusterWithGivenSpec(name, d.testenv.namespace, spec) deployed, err := d.deployCR(ctx, name, indexer) return deployed.(*enterpriseApi.SearchHeadCluster), err } -// DeployLicenseManagerWithGivenSpec deploys the license manager with given SPEC +// DeployLicenseManagerWithGivenSpec deploys the License Manager with given SPEC func (d *Deployment) DeployLicenseManagerWithGivenSpec(ctx context.Context, name string, spec enterpriseApi.LicenseManagerSpec) (*enterpriseApi.LicenseManager, error) { - d.testenv.Log.Info("Deploying license-manager", "name", name) + d.testenv.Log.Info("Deploying License Manager", "name", name) lm := newLicenseManagerWithGivenSpec(name, d.testenv.namespace, spec) deployed, err := d.deployCR(ctx, name, lm) if err != nil { @@ -1202,9 +1202,9 @@ func (d *Deployment) DeployLicenseManagerWithGivenSpec(ctx context.Context, name return deployed.(*enterpriseApi.LicenseManager), err } -// DeployLicenseMasterWithGivenSpec deploys the license manager with given SPEC +// DeployLicenseMasterWithGivenSpec deploys the License Master with given SPEC func (d *Deployment) DeployLicenseMasterWithGivenSpec(ctx context.Context, name string, spec enterpriseApiV3.LicenseMasterSpec) (*enterpriseApiV3.LicenseMaster, error) { - d.testenv.Log.Info("Deploying license-master", "name", name) + d.testenv.Log.Info("Deploying License Master", "name", name) lm := newLicenseMasterWithGivenSpec(name, d.testenv.namespace, spec) deployed, err := d.deployCR(ctx, name, lm) if err != nil { @@ -1213,7 +1213,7 @@ func (d *Deployment) DeployLicenseMasterWithGivenSpec(ctx context.Context, name return deployed.(*enterpriseApiV3.LicenseMaster), err } -// DeploySingleSiteClusterWithGivenAppFrameworkSpec deploys indexer cluster (lm, shc optional) with app framework spec +// DeploySingleSiteClusterWithGivenAppFrameworkSpec deploys Indexer Cluster (LM, SHC optional) with app framework spec func (d *Deployment) DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx context.Context, name string, indexerReplicas int, shc bool, appFrameworkSpecIdxc enterpriseApi.AppFrameworkSpec, appFrameworkSpecShc enterpriseApi.AppFrameworkSpec, mcName string, licenseManager string) (*enterpriseApi.ClusterManager, *enterpriseApi.IndexerCluster, *enterpriseApi.SearchHeadCluster, error) { cm := &enterpriseApi.ClusterManager{} @@ -1222,14 +1222,14 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx contex // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return cm, idxc, sh, err } } - // Deploy the cluster manager + // Deploy the Cluster Manager cmSpec := enterpriseApi.ClusterManagerSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1251,7 +1251,7 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx contex return cm, idxc, sh, err } - // Deploy the indexer cluster + // Deploy the Indexer Cluster idxc, err = d.DeployIndexerCluster(ctx, name+"-idxc", licenseManager, indexerReplicas, name, "", corev1.ObjectReference{}, corev1.ObjectReference{}, "") if err != nil { return cm, idxc, sh, err @@ -1279,7 +1279,7 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx contex } pdata, _ := json.Marshal(shSpec) - d.testenv.Log.Info("Search head Spec", "cr", pdata) + d.testenv.Log.Info("Search Head Spec", "cr", pdata) if shc { sh, err = d.DeploySearchHeadClusterWithGivenSpec(ctx, name+"-shc", shSpec) @@ -1291,7 +1291,7 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenAppFrameworkSpec(ctx contex return cm, idxc, sh, nil } -// DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec deploys indexer cluster (lm, shc optional) with app framework spec +// DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec deploys Indexer Cluster (LM, SHC optional) with app framework spec func (d *Deployment) DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx context.Context, name string, indexerReplicas int, shc bool, appFrameworkSpecIdxc enterpriseApi.AppFrameworkSpec, appFrameworkSpecShc enterpriseApi.AppFrameworkSpec, mcName string, licenseMaster string) (*enterpriseApiV3.ClusterMaster, *enterpriseApi.IndexerCluster, *enterpriseApi.SearchHeadCluster, error) { cm := &enterpriseApiV3.ClusterMaster{} @@ -1300,14 +1300,14 @@ func (d *Deployment) DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return cm, idxc, sh, err } } - // Deploy the cluster manager + // Deploy the Cluster Master cmSpec := enterpriseApiV3.ClusterMasterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1329,7 +1329,7 @@ func (d *Deployment) DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx return cm, idxc, sh, err } - // Deploy the indexer cluster + // Deploy the Indexer Cluster idxc, err = d.DeployIndexerCluster(ctx, name+"-idxc", licenseMaster, indexerReplicas, name, "", corev1.ObjectReference{}, corev1.ObjectReference{}, "") if err != nil { return cm, idxc, sh, err @@ -1357,7 +1357,7 @@ func (d *Deployment) DeploySingleSiteClusterMasterWithGivenAppFrameworkSpec(ctx } pdata, _ := json.Marshal(shSpec) - d.testenv.Log.Info("Search head Spec", "cr", pdata) + d.testenv.Log.Info("Search Head Spec", "cr", pdata) if shc { sh, err = d.DeploySearchHeadClusterWithGivenSpec(ctx, name+"-shc", shSpec) @@ -1378,14 +1378,14 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx con // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, licenseManager) if err != nil { return cm, idxc, sh, err } } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1440,7 +1440,7 @@ func (d *Deployment) DeployMultisiteClusterWithSearchHeadAndAppFramework(ctx con multisite_master: splunk-%s-%s-service site: site0 `, name, "cluster-manager") - // Deploy the SH cluster + // Deploy the SH Cluster shSpec := enterpriseApi.SearchHeadClusterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1482,14 +1482,14 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(c // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, licenseMaster) if err != nil { return cm, idxc, sh, err } } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1544,7 +1544,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(c multisite_master: splunk-%s-%s-service site: site0 `, name, "cluster-master") - // Deploy the SH cluster + // Deploy the SH Cluster shSpec := enterpriseApi.SearchHeadClusterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1577,14 +1577,14 @@ func (d *Deployment) DeployMultisiteClusterMasterWithSearchHeadAndAppFramework(c return cm, idxc, sh, nil } -// DeploySingleSiteClusterWithGivenMonitoringConsole deploys indexer cluster (lm, shc optional) with given monitoring console +// DeploySingleSiteClusterWithGivenMonitoringConsole deploys Indexer Cluster (LM, SHC optional) with given Monitoring Console func (d *Deployment) DeploySingleSiteClusterWithGivenMonitoringConsole(ctx context.Context, name string, indexerReplicas int, shc bool, monitoringConsoleName string) error { licenseManager := "" // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -1593,7 +1593,7 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenMonitoringConsole(ctx conte licenseManager = name } - // Deploy the cluster manager + // Deploy the Cluster Manager cmSpec := enterpriseApi.ClusterManagerSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1614,7 +1614,7 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenMonitoringConsole(ctx conte return err } - // Deploy the indexer cluster + // Deploy the Indexer Cluster _, err = d.DeployIndexerCluster(ctx, name+"-idxc", licenseManager, indexerReplicas, name, "", corev1.ObjectReference{}, corev1.ObjectReference{}, "") if err != nil { return err @@ -1649,14 +1649,14 @@ func (d *Deployment) DeploySingleSiteClusterWithGivenMonitoringConsole(ctx conte return nil } -// DeploySingleSiteClusterMasterWithGivenMonitoringConsole deploys indexer cluster (lm, shc optional) with given monitoring console +// DeploySingleSiteClusterMasterWithGivenMonitoringConsole deploys Indexer Cluster (LM, SHC optional) with given Monitoring Console func (d *Deployment) DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx context.Context, name string, indexerReplicas int, shc bool, monitoringConsoleName string) error { licenseMaster := "" // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return err @@ -1665,7 +1665,7 @@ func (d *Deployment) DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx licenseMaster = name } - // Deploy the cluster manager + // Deploy the Cluster Master cmSpec := enterpriseApiV3.ClusterMasterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1686,7 +1686,7 @@ func (d *Deployment) DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx return err } - // Deploy the indexer cluster + // Deploy the Indexer Cluster _, err = d.DeployIndexerCluster(ctx, name+"-idxc", licenseMaster, indexerReplicas, name, "", corev1.ObjectReference{}, corev1.ObjectReference{}, "") if err != nil { return err @@ -1728,7 +1728,7 @@ func (d *Deployment) DeployMultisiteClusterWithMonitoringConsole(ctx context.Con // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseManager(ctx, name) if err != nil { return err @@ -1737,7 +1737,7 @@ func (d *Deployment) DeployMultisiteClusterWithMonitoringConsole(ctx context.Con licenseManager = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1791,7 +1791,7 @@ func (d *Deployment) DeployMultisiteClusterWithMonitoringConsole(ctx context.Con multisite_master: splunk-%s-%s-service site: site0 `, name, "cluster-manager") - // Deploy the SH cluster + // Deploy the SH Cluster shSpec := enterpriseApi.SearchHeadClusterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ @@ -1828,7 +1828,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithMonitoringConsole(ctx conte // If license file specified, deploy License Manager if d.testenv.licenseFilePath != "" { - // Deploy the license manager + // Deploy the License Manager _, err := d.DeployLicenseMaster(ctx, name) if err != nil { return err @@ -1837,7 +1837,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithMonitoringConsole(ctx conte licenseMaster = name } - // Deploy the cluster-manager + // Deploy the Cluster Manager defaults := `splunk: multisite_master: localhost all_sites: site1,site2,site3 @@ -1891,7 +1891,7 @@ func (d *Deployment) DeployMultisiteClusterMasterWithMonitoringConsole(ctx conte multisite_master: splunk-%s-%s-service site: site0 `, name, "cluster-master") - // Deploy the SH cluster + // Deploy the SH Cluster shSpec := enterpriseApi.SearchHeadClusterSpec{ CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{ Spec: enterpriseApi.Spec{ diff --git a/test/testenv/gcputils.go b/test/testenv/gcputils.go index 78c41d1aa..e6b9a0b1e 100644 --- a/test/testenv/gcputils.go +++ b/test/testenv/gcputils.go @@ -120,9 +120,9 @@ func CheckPrefixExistsOnGCP(prefix string) bool { logf.Log.Error(err, "Error listing objects in GCP bucket") return false } - logf.Log.Info("CHECKING OBJECT", "OBJECT", objAttrs.Name) + logf.Log.Info("CHECKING OBJECT", "object", objAttrs.Name) if strings.Contains(objAttrs.Name, prefix) { - logf.Log.Info("Prefix found in bucket", "Prefix", prefix, "Object", objAttrs.Name) + logf.Log.Info("Prefix found in bucket", "prefix", prefix, "object", objAttrs.Name) return true } } @@ -146,12 +146,12 @@ func CreateBucketAndPathIfNotExist(bucketName, path string) error { // Create the bucket err = client.Client.Bucket(bucketName).Create(ctx, gcpProjectID, nil) if err != nil { - logf.Log.Error(err, "Failed to create bucket", "Bucket Name", bucketName) + logf.Log.Error(err, "Failed to create bucket", "bucketName", bucketName) return err } - logf.Log.Info("Bucket created", "Bucket Name", bucketName) + logf.Log.Info("Bucket created", "bucketName", bucketName) } else if err != nil { - logf.Log.Error(err, "Error checking bucket attributes", "Bucket Name", bucketName) + logf.Log.Error(err, "Error checking bucket attributes", "bucketName", bucketName) return err } @@ -161,16 +161,16 @@ func CreateBucketAndPathIfNotExist(bucketName, path string) error { // Create a zero-length object to represent the path wc := client.Client.Bucket(bucketName).Object(path).NewWriter(ctx) if _, err := wc.Write([]byte{}); err != nil { - logf.Log.Error(err, "Failed to create path", "Path", path) + logf.Log.Error(err, "Failed to create path", "path", path) return err } if err := wc.Close(); err != nil { - logf.Log.Error(err, "Failed to finalize path creation", "Path", path) + logf.Log.Error(err, "Failed to finalize path creation", "path", path) return err } - logf.Log.Info("Path created", "Path", path) + logf.Log.Info("Path created", "path", path) } else if err != nil { - logf.Log.Error(err, "Error checking path attributes", "Path", path) + logf.Log.Error(err, "Error checking path attributes", "path", path) return err } @@ -209,7 +209,7 @@ func DownloadFileFromGCP(bucketName, objectName, gcpFilePath, downloadDir string objectPath := filepath.Join(gcpFilePath, objectName) rc, err := client.Client.Bucket(bucketName).Object(objectPath).NewReader(ctx) if err != nil { - logf.Log.Error(err, "Failed to create reader for object", "Object", objectName) + logf.Log.Error(err, "Failed to create reader for object", "object", objectName) return "", err } defer rc.Close() @@ -217,14 +217,14 @@ func DownloadFileFromGCP(bucketName, objectName, gcpFilePath, downloadDir string localPath := filepath.Join(downloadDir, objectName) file, err := os.Create(localPath) if err != nil { - logf.Log.Error(err, "Failed to create local file", "Filename", localPath) + logf.Log.Error(err, "Failed to create local file", "filename", localPath) return "", err } defer file.Close() written, err := io.Copy(file, rc) if err != nil { - logf.Log.Error(err, "Failed to download object", "Object", objectName) + logf.Log.Error(err, "Failed to download object", "object", objectName) return "", err } @@ -319,18 +319,18 @@ func DeleteFileOnGCP(bucketName, objectName string) error { err = client.Client.Bucket(bucketName).Object(objectName).Delete(ctx) if err != nil && err != storage.ErrObjectNotExist { - logf.Log.Error(err, "Unable to delete object from bucket", "Object Name", objectName, "Bucket Name", bucketName) + logf.Log.Error(err, "Unable to delete object from bucket", "objectName", objectName, "bucketName", bucketName) return err } // Optionally, verify deletion _, err = client.Client.Bucket(bucketName).Object(objectName).Attrs(ctx) if err == storage.ErrObjectNotExist { - logf.Log.Info("Deleted file on GCP", "File Name", objectName, "Bucket", bucketName) + logf.Log.Info("Deleted file on GCP", "fileName", objectName, "bucket", bucketName) return nil } if err != nil { - logf.Log.Error(err, "Error verifying deletion of object", "Object Name", objectName, "Bucket Name", bucketName) + logf.Log.Error(err, "Error verifying deletion of object", "objectName", objectName, "bucketName", bucketName) return err } @@ -342,12 +342,12 @@ func GetFilesInPathOnGCP(bucketName, path string) []string { resp := GetFileListOnGCP(bucketName, path) var files []string for _, obj := range resp { - logf.Log.Info("CHECKING OBJECT", "OBJECT", obj.Name) + logf.Log.Info("CHECKING OBJECT", "object", obj.Name) if strings.HasPrefix(obj.Name, path) { filename := strings.TrimPrefix(obj.Name, path) // This condition filters out directories as GCP returns objects with their full paths if len(filename) > 1 && !strings.HasSuffix(filename, "/") { - logf.Log.Info("File found in bucket", "Path", path, "Object", obj.Name) + logf.Log.Info("File found in bucket", "path", path, "object", obj.Name) files = append(files, filename) } } @@ -358,10 +358,10 @@ func GetFilesInPathOnGCP(bucketName, path string) []string { // DownloadFilesFromGCP downloads a list of files from a GCP bucket to a local directory func DownloadFilesFromGCP(bucketName, gcpAppDir, downloadDir string, appList []string) error { for _, key := range appList { - logf.Log.Info("Downloading file from GCP", "File name", key) + logf.Log.Info("Downloading file from GCP", "fileName", key) _, err := DownloadFileFromGCP(bucketName, key, gcpAppDir, downloadDir) if err != nil { - logf.Log.Error(err, "Unable to download file", "File Name", key) + logf.Log.Error(err, "Unable to download file", "fileName", key) return err } } @@ -372,22 +372,22 @@ func DownloadFilesFromGCP(bucketName, gcpAppDir, downloadDir string, appList []s func UploadFilesToGCP(bucketName, gcpTestDir string, appList []string, uploadDir string) ([]string, error) { var uploadedFiles []string for _, key := range appList { - logf.Log.Info("Uploading file to GCP", "File name", key) - logf.Log.Info("Using bucket", "Bucket", bucketName, "Path", gcpTestDir, "Upload Dir", uploadDir) + logf.Log.Info("Uploading file to GCP", "fileName", key) + logf.Log.Info("Using bucket", "bucket", bucketName, "path", gcpTestDir, "uploadDir", uploadDir) fileLocation := filepath.Join(uploadDir, key) fileBody, err := os.Open(fileLocation) if err != nil { - logf.Log.Error(err, "Unable to open file", "File name", key) + logf.Log.Error(err, "Unable to open file", "fileName", key) return nil, err } defer fileBody.Close() objectPath, err := UploadFileToGCP(bucketName, key, gcpTestDir, fileBody) if err != nil { - logf.Log.Error(err, "Unable to upload file", "File name", key) + logf.Log.Error(err, "Unable to upload file", "fileName", key) return nil, err } - logf.Log.Info("File uploaded to GCP", "File name", objectPath) + logf.Log.Info("File uploaded to GCP", "fileName", objectPath) uploadedFiles = append(uploadedFiles, objectPath) } return uploadedFiles, nil diff --git a/test/testenv/lmutil.go b/test/testenv/lmutil.go index ad651d994..e58cf2b2d 100644 --- a/test/testenv/lmutil.go +++ b/test/testenv/lmutil.go @@ -54,6 +54,6 @@ func CheckLicenseManagerConfigured(ctx context.Context, deployment *Deployment, return false } licenseManager := restResponse.Entry[0].Content.ManagerURI - logf.Log.Info("License Manager configuration on POD", "POD", podName, "License Manager", licenseManager) + logf.Log.Info("License Manager configuration on POD", "pod", podName, "licenseManager", licenseManager) return strings.Contains(licenseManager, "license-manager-service:8089") || strings.Contains(licenseManager, "license-master-service:8089") } diff --git a/test/testenv/mcutil.go b/test/testenv/mcutil.go index 0aa5d2361..0cd9448ee 100644 --- a/test/testenv/mcutil.go +++ b/test/testenv/mcutil.go @@ -60,7 +60,7 @@ func CheckMCPodReady(ns string) bool { return false } stsSlice := strings.Fields(stsLine) - logf.Log.Info("MC statefulset found", "POD", stsSlice[0], "READY", stsSlice[1]) + logf.Log.Info("MC statefulset found", "pod", stsSlice[0], "ready", stsSlice[1]) stsReady := strings.Contains(stsSlice[1], "1/1") // Check Status of monitoring console pod @@ -69,7 +69,7 @@ func CheckMCPodReady(ns string) bool { return false } podSlice := strings.Fields(podLine) - logf.Log.Info("MC Pod Found", "POD", podSlice[0], "READY", podSlice[1]) + logf.Log.Info("MC Pod Found", "pod", podSlice[0], "ready", podSlice[1]) podReady := strings.Contains(podSlice[1], "1/1") && strings.Contains(podSlice[2], "Running") return stsReady && podReady @@ -100,7 +100,7 @@ func GetConfiguredPeers(ns string, mcName string) []string { } } } - logf.Log.Info("Peer List found on MC Pod", "MC POD", podName, "Configured Peers", peerList) + logf.Log.Info("Peer List found on MC Pod", "mcPod", podName, "configuredPeers", peerList) return peerList } @@ -112,7 +112,7 @@ func CheckPodNameOnMC(ns string, mcName string, podName string) bool { found := false for _, peer := range peerList { if strings.Contains(peer, podName) { - logf.Log.Info("Check Peer matches on pod", "Pod Name", podName, "Peer in peer list", peer) + logf.Log.Info("Check Peer matches on pod", "podName", podName, "peerInPeerList", peer) found = true break } @@ -145,12 +145,12 @@ func GetMCConfigMap(ctx context.Context, deployment *Deployment, ns string, mcNa logf.Log.Error(err, "Failed to get Monitoring Console Config Map") return mcConfigMap, err } - logf.Log.Info("MC Config Map contents", "MC CONFIG MAP NAME", mcConfigMapName, "Data", mcConfigMap.Data) + logf.Log.Info("MC Config Map contents", "mcConfigMapName", mcConfigMapName, "data", mcConfigMap.Data) return mcConfigMap, err } // CheckPodNameInString checks for pod name in string func CheckPodNameInString(podName string, configString string) bool { - logf.Log.Info("Check MC Config String has Pod configured", "Monitoring Console Config Map Pod Config String", configString, "POD String", podName) + logf.Log.Info("Check MC Config String has Pod configured", "configString", configString, "podName", podName) return strings.Contains(configString, podName) } diff --git a/test/testenv/multisite_helpers.go b/test/testenv/multisite_helpers.go index 4429dbf02..dd837ffe8 100644 --- a/test/testenv/multisite_helpers.go +++ b/test/testenv/multisite_helpers.go @@ -28,11 +28,11 @@ func (testcaseenv *TestCaseEnv) VerifyIndexOnAllSites(ctx context.Context, deplo } // IngestDataOnAllSites ingests data to an index on all indexer pods across all sites -func IngestDataOnAllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { +func IngestDataOnAllSites(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string) { for siteNumber := 1; siteNumber <= siteCount; siteNumber++ { podName := fmt.Sprintf(MultiSiteIndexerPod, deploymentName, siteNumber, 0) logFile := fmt.Sprintf("test-log-%s.log", RandomDNSName(3)) - CreateMockLogfile(logFile, logLineCount) + CreateMockLogfile(logFile, LogLineCount) IngestFileViaMonitor(ctx, logFile, indexName, podName, deployment) } } @@ -63,12 +63,12 @@ func (testcaseenv *TestCaseEnv) VerifyCPULimitsOnAllSites(deployment *Deployment // MultisiteIndexerWorkflow encapsulates the common workflow for multisite indexer operations: // verify index, ingest data, roll to warm, verify on S3 -func (testcaseenv *TestCaseEnv) MultisiteIndexerWorkflow(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string, logLineCount int) { +func (testcaseenv *TestCaseEnv) MultisiteIndexerWorkflow(ctx context.Context, deployment *Deployment, deploymentName string, siteCount int, indexName string) { // Verify index exists on all sites testcaseenv.VerifyIndexOnAllSites(ctx, deployment, deploymentName, siteCount, indexName) // Ingest data on all sites - IngestDataOnAllSites(ctx, deployment, deploymentName, siteCount, indexName, logLineCount) + IngestDataOnAllSites(ctx, deployment, deploymentName, siteCount, indexName) // Roll hot to warm on all sites RollHotToWarmOnAllSites(ctx, deployment, deploymentName, siteCount, indexName) diff --git a/test/testenv/s3utils.go b/test/testenv/s3utils.go index e9559bf5b..3921844e2 100644 --- a/test/testenv/s3utils.go +++ b/test/testenv/s3utils.go @@ -48,9 +48,9 @@ func CheckPrefixExistsOnS3(prefix string) bool { resp := GetFileListOnS3(dataBucket, prefix) for _, key := range resp { - logf.Log.Info("CHECKING KEY ", "KEY", *key.Key) + logf.Log.Info("CHECKING KEY ", "key", *key.Key) if strings.Contains(*key.Key, prefix) { - logf.Log.Info("Prefix found on bucket", "Prefix", prefix, "KEY", *key.Key) + logf.Log.Info("Prefix found on bucket", "prefix", prefix, "key", *key.Key) return true } } @@ -89,7 +89,7 @@ func DownloadFileFromS3(dataBucket string, filename string, s3FilePath string, d // Create empty file on OS File System file, err := os.Create(filepath.Join(downloadDir, filename)) if err != nil { - logf.Log.Error(err, "Failed to create file", "Filename", file) + logf.Log.Error(err, "Failed to create file", "filename", file) } defer file.Close() @@ -107,7 +107,7 @@ func DownloadFileFromS3(dataBucket string, filename string, s3FilePath string, d }) if err != nil { - logf.Log.Error(err, "Failed to download file", "Bucket", dataBucket, "Path", s3FilePath, "Filename", filename) + logf.Log.Error(err, "Failed to download file", "bucket", dataBucket, "path", s3FilePath, "filename", filename) return "", err } @@ -169,7 +169,7 @@ func DeleteFileOnS3(bucket string, filename string) error { svc := s3.NewFromConfig(*cfg) _, err = svc.DeleteObject(context.TODO(), &s3.DeleteObjectInput{Bucket: aws.String(bucket), Key: aws.String(filename)}) if err != nil { - logf.Log.Error(err, "Unable to delete object from bucket", "Object Name", filename, "Bucket Name", bucket) + logf.Log.Error(err, "Unable to delete object from bucket", "objectName", filename, "bucketName", bucket) } waiter := s3.NewObjectNotExistsWaiter(svc) @@ -177,7 +177,7 @@ func DeleteFileOnS3(bucket string, filename string) error { Bucket: aws.String(bucket), Key: aws.String(filename), }, time.Duration(time.Duration(s3deleteWaitTime).Seconds())) - logf.Log.Info("Deleted file on S3", "File Name", filename, "Bucket", bucket) + logf.Log.Info("Deleted file on S3", "fileName", filename, "bucket", bucket) return err } @@ -186,12 +186,12 @@ func GetFilesInPathOnS3(bucket string, path string) []string { resp := GetFileListOnS3(bucket, path) var files []string for _, key := range resp { - logf.Log.Info("CHECKING KEY ", "KEY", *key.Key) + logf.Log.Info("CHECKING KEY ", "key", *key.Key) if strings.Contains(*key.Key, path) { filename := strings.Replace(*key.Key, path, "", -1) // This condition filters out directories as GetFileListOnS3 returns files and directories with their absolute path's if len(filename) > 1 { - logf.Log.Info("File found on bucket", "Prefix", path, "KEY", *key.Key) + logf.Log.Info("File found on bucket", "prefix", path, "key", *key.Key) files = append(files, filename) } } @@ -202,10 +202,10 @@ func GetFilesInPathOnS3(bucket string, path string) []string { // DownloadFilesFromS3 download given list of files from S3 to the given directory func DownloadFilesFromS3(testDataS3Bucket string, s3AppDir string, downloadDir string, appList []string) error { for _, key := range appList { - logf.Log.Info("Downloading file from S3", "File name", key) + logf.Log.Info("Downloading file from S3", "fileName", key) _, err := DownloadFileFromS3(testDataS3Bucket, key, s3AppDir, downloadDir) if err != nil { - logf.Log.Error(err, "Unable to download file", "File Name", key) + logf.Log.Error(err, "Unable to download file", "fileName", key) return err } } @@ -216,19 +216,19 @@ func DownloadFilesFromS3(testDataS3Bucket string, s3AppDir string, downloadDir s func UploadFilesToS3(testS3Bucket string, s3TestDir string, applist []string, downloadDir string) ([]string, error) { var uploadedFiles []string for _, key := range applist { - logf.Log.Info("Uploading file to S3", "File name", key) + logf.Log.Info("Uploading file to S3", "fileName", key) fileLocation := filepath.Join(downloadDir, key) fileBody, err := os.Open(fileLocation) if err != nil { - logf.Log.Error(err, "Unable to open file", "File name", key) + logf.Log.Error(err, "Unable to open file", "fileName", key) return nil, err } fileName, err := UploadFileToS3(testS3Bucket, key, s3TestDir, fileBody) if err != nil { - logf.Log.Error(err, "Unable to upload file", "File name", key) + logf.Log.Error(err, "Unable to upload file", "fileName", key) return nil, err } - logf.Log.Info("File upload to test S3", "File name", fileName) + logf.Log.Info("File upload to test S3", "fileName", fileName) uploadedFiles = append(uploadedFiles, fileName) } return uploadedFiles, nil diff --git a/test/testenv/search_head_cluster_utils.go b/test/testenv/search_head_cluster_utils.go index 3fe55bb49..4dd326676 100644 --- a/test/testenv/search_head_cluster_utils.go +++ b/test/testenv/search_head_cluster_utils.go @@ -115,7 +115,7 @@ func DeployerBundlePushstatus(ctx context.Context, deployment *Deployment, ns st } for appName := range appChecksum { if _, present := appBundlePush[appName]; !present { - logf.Log.Info("Deployer app not found on any members", "Appname", appName) + logf.Log.Info("Deployer app not found on any members", "appName", appName) return make(map[string]int) } } diff --git a/test/testenv/search_utils.go b/test/testenv/search_utils.go index dea0667ed..e6856d8dc 100644 --- a/test/testenv/search_utils.go +++ b/test/testenv/search_utils.go @@ -77,7 +77,7 @@ func PerformSearchSync(ctx context.Context, podName string, search string, deplo return "", err } - logf.Log.Info("Output of search Query", "Search", search, "Output", searchReqResp) + logf.Log.Info("Output of search Query", "search", search, "output", searchReqResp) // Since results can have multiple formats depending on the search SPL, leave this response as a string return searchReqResp, err @@ -102,7 +102,7 @@ func PerformSearchReq(ctx context.Context, podName string, search string, deploy return "", err } - logf.Log.Info("Output of search Query", "Search", search, "Output", stdout) + logf.Log.Info("Output of search Query", "search", search, "output", stdout) // Get SID var searchReqResult map[string]interface{} diff --git a/test/testenv/secretutil.go b/test/testenv/secretutil.go index 4dca85931..f30e72446 100644 --- a/test/testenv/secretutil.go +++ b/test/testenv/secretutil.go @@ -46,14 +46,14 @@ func GetSecretStruct(ctx context.Context, deployment *Deployment, ns string, sec secretObject := &corev1.Secret{} err := deployment.GetInstance(ctx, secretName, secretObject) if err != nil { - deployment.testenv.Log.Error(err, "Unable to get secret object", "Secret Name", secretName, "Namespace", ns) + deployment.testenv.Log.Error(err, "Unable to get secret object", "secretName", secretName, "namespace", ns) } return secretObject, err } // ModifySecretObject Modifies the secret object with given data func ModifySecretObject(ctx context.Context, deployment *Deployment, ns string, secretName string, data map[string][]byte) error { - logf.Log.Info("Modify secret object", "Secret Name", secretName, "Data", data) + logf.Log.Info("Modify secret object", "secretName", secretName, "data", data) secret := newSecretSpec(ns, secretName, data) err := deployment.UpdateCR(ctx, secret) @@ -66,7 +66,7 @@ func ModifySecretObject(ctx context.Context, deployment *Deployment, ns string, // DeleteSecretObject Deletes the entire secret object func DeleteSecretObject(ctx context.Context, deployment *Deployment, ns string, secretName string) error { - logf.Log.Info("Delete secret object", "Secret Name", secretName, "Namespace", ns) + logf.Log.Info("Delete secret object", "secretName", secretName, "namespace", ns) secret := newSecretSpec(ns, secretName, map[string][]byte{}) err := deployment.DeleteCR(ctx, secret) if err != nil { @@ -85,7 +85,7 @@ func GetMountedKey(ctx context.Context, deployment *Deployment, podName string, logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "command", command) return "" } - logf.Log.Info("Key found on pod", "Pod Name", podName, "stdout", stdout, "stderr", stderr) + logf.Log.Info("Key found on pod", "podName", podName, "stdout", stdout, "stderr", stderr) return stdout } @@ -99,7 +99,7 @@ func GetSecretFromServerConf(ctx context.Context, deployment *Deployment, podNam filePath := "/opt/splunk/etc/system/local/server.conf" confline, err := GetConfLineFromPod(podName, filePath, ns, configName, stanza, true) if err != nil { - logf.Log.Error(err, "Failed to get secret from pod", "Pod Name", podName, "Secret Name", configName) + logf.Log.Error(err, "Failed to get secret from pod", "podName", podName, "secretName", configName) return "", "", err } @@ -120,7 +120,7 @@ func DecryptSplunkEncodedSecret(ctx context.Context, deployment *Deployment, pod } logf.Log.Info("Command executed on pod", "pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) - logf.Log.Info("Decrypted Key Value", "Decrypted Key", stdout) + logf.Log.Info("Decrypted Key Value", "decryptedKey", stdout) return strings.TrimSuffix(stdout, "\n") } @@ -157,7 +157,7 @@ func GetVersionedSecretNames(ns string, version int) []string { } } } - logf.Log.Info("Versioned Secret Objects Found in Namespace", "NameSpace", ns, "Versioned Secrets", splunkSecrets) + logf.Log.Info("Versioned Secret Objects Found in Namespace", "namespace", ns, "versionedSecrets", splunkSecrets) return splunkSecrets } @@ -198,7 +198,7 @@ func GetSecretFromInputsConf(deployment *Deployment, podName string, ns string, filePath := "/opt/splunk/etc/apps/splunk_httpinput/local/inputs.conf" confline, err := GetConfLineFromPod(podName, filePath, ns, configName, stanza, true) if err != nil { - logf.Log.Error(err, "Failed to get secret from pod", "Pod Name", podName, "Secret Name", configName) + logf.Log.Error(err, "Failed to get secret from pod", "podName", podName, "secretName", configName) return "", "", err } secretList := strings.Split(confline, "=") diff --git a/test/testenv/test_setup_helpers.go b/test/testenv/test_setup_helpers.go index 4d3685ee5..326199d7d 100644 --- a/test/testenv/test_setup_helpers.go +++ b/test/testenv/test_setup_helpers.go @@ -81,6 +81,28 @@ func TeardownAppFrameworkTestCaseEnv(ctx context.Context, testcaseEnvInst *TestC CleanupOperatorFile(ctx, deployment, testcaseEnvInst, filePresentOnOperator) } +// S3CloudCleanup returns a cleanup function that deletes the given files from an S3 bucket. +func S3CloudCleanup(bucket string, uploadedApps []string) func() { + return func() { + DeleteFilesOnS3(bucket, uploadedApps) + } +} + +// AzureCloudCleanup returns a cleanup function that deletes the given files from Azure Blob storage. +func AzureCloudCleanup(ctx context.Context, uploadedApps []string) func() { + return func() { + azureBlobClient := &AzureBlobClient{} + azureBlobClient.DeleteFilesOnAzure(ctx, GetAzureEndpoint(ctx), StorageAccountKey, StorageAccount, uploadedApps) + } +} + +// GCPCloudCleanup returns a cleanup function that deletes the given files from a GCP bucket. +func GCPCloudCleanup(bucket string, uploadedApps []string) func() { + return func() { + DeleteFilesOnGCP(bucket, uploadedApps) + } +} + // LoadEnvFile traverses up the directory tree from the current working directory // to find and load a .env file using godotenv. Returns nil if no .env file is found. func LoadEnvFile() error { @@ -197,7 +219,7 @@ func SetupGCPAppsSuite(suiteName, testDataBucket, appDirV1, downloadDirV1, appDi return testenvInst, nil, nil } -// SetupLicenseConfigMap downloads the license file from the appropriate cloud provider +// SetupLicenseConfigMap downloads the license file from the appropriate provider // and creates a license config map. func SetupLicenseConfigMap(ctx context.Context, testcaseEnvInst *TestCaseEnv) { downloadDir := "licenseFolder" @@ -215,7 +237,7 @@ func SetupLicenseConfigMap(ctx context.Context, testcaseEnvInst *TestCaseEnv) { licenseFilePath, err = DownloadLicenseFromGCPBucket() Expect(err).To(Succeed(), "Unable to download license file from GCP") default: - testcaseEnvInst.Log.Info("Skipping license download", "ClusterProvider", ClusterProvider) + testcaseEnvInst.Log.Info("Skipping license download", "provider", ClusterProvider) return } diff --git a/test/testenv/test_workflows.go b/test/testenv/test_workflows.go index 2b095f605..8c5d60245 100644 --- a/test/testenv/test_workflows.go +++ b/test/testenv/test_workflows.go @@ -34,10 +34,7 @@ type WorkflowResult struct { // RunStandaloneDeploymentWorkflow deploys a standalone instance and verifies it's ready func RunStandaloneDeploymentWorkflow(ctx context.Context, deployment *Deployment, testcaseEnvInst *TestCaseEnv, name string) *WorkflowResult { - standalone, err := deployment.DeployStandalone(ctx, name, "", "") - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, name, standalone) + standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, name, "", "") return &WorkflowResult{Standalone: standalone} } @@ -47,10 +44,7 @@ func RunC3DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca err := deployment.DeploySingleSiteCluster(ctx, name, indexerReplicas, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy C3 cluster") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) + testcaseEnvInst.VerifyClusterReadyAndRFSF(ctx, deployment) return &WorkflowResult{} } @@ -60,10 +54,7 @@ func RunM4DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca err := deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) Expect(err).To(Succeed(), "Unable to deploy M4 cluster") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyM4ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) testcaseEnvInst.VerifyRFSFMet(ctx, deployment) return &WorkflowResult{} @@ -74,9 +65,7 @@ func RunM1DeploymentWorkflow(ctx context.Context, deployment *Deployment, testca err := deployment.DeployMultisiteCluster(ctx, name, indexerReplicas, siteCount, "") Expect(err).To(Succeed(), "Unable to deploy M1 cluster") - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) + testcaseEnvInst.VerifyM1ClusterReady(ctx, deployment, siteCount, testcaseEnvInst.VerifyClusterManagerReady) testcaseEnvInst.VerifyRFSFMet(ctx, deployment) return &WorkflowResult{} @@ -122,23 +111,20 @@ func RunDeleteC3Workflow(ctx context.Context, deployment *Deployment, testcaseEn idxc := &enterpriseApi.IndexerCluster{} idxcName := name + "-idxc" - err := deployment.GetInstance(ctx, idxcName, idxc) - Expect(err).To(Succeed(), "Unable to get Indexer Cluster instance") + GetInstanceWithExpect(ctx, deployment, idxc, idxcName, "Unable to get Indexer Cluster instance") - err = deployment.DeleteCR(ctx, idxc) + err := deployment.DeleteCR(ctx, idxc) Expect(err).To(Succeed(), "Unable to delete Indexer Cluster") shc := &enterpriseApi.SearchHeadCluster{} shcName := name + "-shc" - err = deployment.GetInstance(ctx, shcName, shc) - Expect(err).To(Succeed(), "Unable to get Search Head Cluster instance") + GetInstanceWithExpect(ctx, deployment, shc, shcName, "Unable to get Search Head Cluster instance") err = deployment.DeleteCR(ctx, shc) Expect(err).To(Succeed(), "Unable to delete Search Head Cluster") cm := &enterpriseApi.ClusterManager{} - err = deployment.GetInstance(ctx, name, cm) - Expect(err).To(Succeed(), "Unable to get Cluster Manager instance") + GetInstanceWithExpect(ctx, deployment, cm, name, "Unable to get Cluster Manager instance") err = deployment.DeleteCR(ctx, cm) Expect(err).To(Succeed(), "Unable to delete Cluster Manager") diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index fa92d8e0f..93f114406 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -357,7 +357,7 @@ func (testenv *TestCaseEnv) attachPVCToOperator(name string) error { operator := &appsv1.Deployment{} err = testenv.GetKubeClient().Get(ctx, namespacedName, operator) if err != nil { - testenv.Log.Error(err, "Unable to get operator", "operator name", testenv.operatorName) + testenv.Log.Error(err, "Unable to get operator", "operatorName", testenv.operatorName) return err } @@ -382,7 +382,7 @@ func (testenv *TestCaseEnv) attachPVCToOperator(name string) error { // update the operator deployment now err = testenv.GetKubeClient().Update(ctx, operator) if err != nil { - testenv.Log.Error(err, "Unable to update operator", "operator name", testenv.operatorName) + testenv.Log.Error(err, "Unable to update operator", "operatorName", testenv.operatorName) return err } diff --git a/test/testenv/testenv.go b/test/testenv/testenv.go index 361b66d04..e718ca9e4 100644 --- a/test/testenv/testenv.go +++ b/test/testenv/testenv.go @@ -70,7 +70,7 @@ const ( // C3 deployments require bundle push across all indexers and SHC deployer which can exceed 5 minutes. AppInstallTimeout = 10 * time.Minute - // SearchHeadPod Template String for search head pod + // SearchHeadPod Template String for Search Head pod SearchHeadPod = "splunk-%s-shc-search-head-%d" // DeployerPod Template String for deployer pod @@ -79,10 +79,10 @@ const ( // StandalonePod Template String for standalone pod StandalonePod = "splunk-%s-standalone-%d" - // LicenseManagerPod Template String for standalone pod + // LicenseManagerPod Template String for License Manager pod LicenseManagerPod = "splunk-%s-license-manager-%d" - // LicenseMasterPod Template String for standalone pod + // LicenseMasterPod Template String for License Master pod LicenseMasterPod = "splunk-%s-" + splcommon.LicenseManager + "-%d" // IngestorPod Template String for ingestor pod @@ -132,11 +132,17 @@ const ( // ClusterMasterServiceName Cluster Master Service Template String ClusterMasterServiceName = "splunk-%s-cluster-master-service" - // DeployerServiceName Cluster Manager Service Template String + // DeployerServiceName Deployer Service Template String DeployerServiceName = "splunk-%s-shc-deployer-service" // CRUpdateRetryCount if CR Update fails retry these many time CRUpdateRetryCount = 10 + + // LogLineCount is the default number of log lines to ingest for test data + LogLineCount = 2000 + + // DefaultIngestIndex is the default index name used for test data ingestion + DefaultIngestIndex = "main" ) var ( diff --git a/test/testenv/util.go b/test/testenv/util.go index e032e1f7b..6d4032eb0 100644 --- a/test/testenv/util.go +++ b/test/testenv/util.go @@ -741,7 +741,7 @@ func newStandaloneWithSpec(name, ns string, spec enterpriseApi.StandaloneSpec) * return &new } -// newMonitoringConsoleSpec returns MC Spec with given name, namespace and license manager Ref +// newMonitoringConsoleSpec returns MC Spec with given name, namespace and License Manager Ref func newMonitoringConsoleSpec(name, ns, LicenseManagerRef, splunkImage string) *enterpriseApi.MonitoringConsole { licenseMasterRef, licenseManagerRef := swapLicenseManager(name, LicenseManagerRef) @@ -963,7 +963,7 @@ func ExecuteCommandOnPod(ctx context.Context, deployment *Deployment, podName st logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "command", command) return "", err } - logf.Log.Info("Command executed", "on pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) + logf.Log.Info("Command executed", "onPod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) return stdout, nil } @@ -975,7 +975,7 @@ func ExecuteCommandOnOperatorPod(ctx context.Context, deployment *Deployment, po logf.Log.Error(err, "Failed to execute command on pod", "pod", podName, "shell", command, "command", stdin, "error", err.Error()) return "", err } - logf.Log.Info("Command executed", "on pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) + logf.Log.Info("Command executed", "onPod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) return stdout, nil } @@ -984,7 +984,7 @@ func GetConfigMap(ctx context.Context, deployment *Deployment, ns string, config configMap := &corev1.ConfigMap{} err := deployment.GetInstance(ctx, configMapName, configMap) if err != nil { - deployment.testenv.Log.Error(err, "Unable to get config map", "Config Map Name", configMap, "Namespace", ns) + deployment.testenv.Log.Error(err, "Unable to get config map", "configMapName", configMap, "namespace", ns) } return configMap, err } @@ -1055,7 +1055,7 @@ func newLicenseManagerWithGivenSpec(name, ns string, spec enterpriseApi.LicenseM return &new } -// newLicenseMasterWithGivenSpec create and initializes CR for License Manager Kind with Given Spec +// newLicenseMasterWithGivenSpec create and initializes CR for License Master Kind with Given Spec func newLicenseMasterWithGivenSpec(name, ns string, spec enterpriseApiV3.LicenseMasterSpec) *enterpriseApiV3.LicenseMaster { new := enterpriseApiV3.LicenseMaster{ TypeMeta: metav1.TypeMeta{ @@ -1115,7 +1115,7 @@ func GetDirsOrFilesInPath(ctx context.Context, deployment *Deployment, podName s // CheckStringInSlice check if string is present in a slice func CheckStringInSlice(stringSlice []string, compString string) bool { - logf.Log.Info("Checking for string in slice", "String", compString, "String Slice", stringSlice) + logf.Log.Info("Checking for string in slice", "string", compString, "stringSlice", stringSlice) for _, item := range stringSlice { if strings.Contains(item, compString) { return true @@ -1171,7 +1171,7 @@ func DeleteOperatorPod(testcaseEnvInst *TestCaseEnv) error { _, err := exec.Command("kubectl", "delete", "pod", "-n", ns, podName).Output() if err != nil { - logf.Log.Error(err, "Failed to delete operator pod ", "PodName", podName, "Namespace", ns) + logf.Log.Error(err, "Failed to delete operator pod ", "podName", podName, "namespace", ns) return err } return nil @@ -1183,7 +1183,7 @@ func DeleteFilesOnOperatorPod(ctx context.Context, deployment *Deployment, podNa cmd := fmt.Sprintf("rm -f %s", filepath) _, err := ExecuteCommandOnOperatorPod(ctx, deployment, podName, cmd) if err != nil { - logf.Log.Error(err, "Failed to delete file on pod ", "PodName", podName, "location", filepath, "command", cmd) + logf.Log.Error(err, "Failed to delete file on pod ", "podName", podName, "location", filepath, "command", cmd) return err } } @@ -1198,9 +1198,9 @@ func DumpGetSplunkVersion(ctx context.Context, ns string, deployment *Deployment if strings.Contains(podName, filterString) { stdout, err := ExecuteCommandOnPod(ctx, deployment, podName, cmd) if err != nil { - logf.Log.Error(err, "Failed to get splunkd version on the pod", "Pod Name", podName) + logf.Log.Error(err, "Failed to get splunkd version on the pod", "podName", podName) } - logf.Log.Info("Splunk Version Found", "Pod Name", podName, "Version", string(stdout)) + logf.Log.Info("Splunk Version Found", "podName", podName, "version", string(stdout)) } } } @@ -1210,7 +1210,7 @@ func CreateDummyFileOnOperator(ctx context.Context, deployment *Deployment, podN cmd := fmt.Sprintf("cd %s && dd if=/dev/zero of=./%s bs=4k iflag=fullblock,count_bytes count=%s", filepath, filename, size) _, err := ExecuteCommandOnOperatorPod(ctx, deployment, podName, cmd) if err != nil { - logf.Log.Error(err, "Failed to create file on the pod", "Pod Name", podName) + logf.Log.Error(err, "Failed to create file on the pod", "podName", podName) return err } return nil @@ -1218,10 +1218,10 @@ func CreateDummyFileOnOperator(ctx context.Context, deployment *Deployment, podN // DeleteConfigMap Delete configMap in the namespace func DeleteConfigMap(ns string, ConfigMapName string) error { - logf.Log.Info("Delete configMap", "configMap Name", ConfigMapName) + logf.Log.Info("Delete configMap", "configMapName", ConfigMapName) _, err := exec.Command("kubectl", "delete", "configmap", "-n", ns, ConfigMapName).Output() if err != nil { - logf.Log.Error(err, "Failed to delete config Map", "ConfigMap Name", ConfigMapName, "Namespace", ns) + logf.Log.Error(err, "Failed to delete config Map", "configMapName", ConfigMapName, "namespace", ns) return err } return nil diff --git a/test/testenv/verificationutils.go b/test/testenv/verificationutils.go index 624d8c536..a6750ba9d 100644 --- a/test/testenv/verificationutils.go +++ b/test/testenv/verificationutils.go @@ -83,7 +83,7 @@ func (testenv *TestCaseEnv) VerifyMonitoringConsoleReady(ctx context.Context, de if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for Monitoring Console phase to be ready", "instance", monitoringConsole.ObjectMeta.Name, "Phase", monitoringConsole.Status.Phase) + testenv.Log.Info("Waiting for Monitoring Console phase to be ready", "instance", monitoringConsole.ObjectMeta.Name, "phase", monitoringConsole.Status.Phase) DumpGetPods(testenv.GetName()) return monitoringConsole.Status.Phase @@ -106,7 +106,7 @@ func (testenv *TestCaseEnv) VerifyStandaloneReady(ctx context.Context, deploymen // Refresh the instance to get latest state err = deployment.GetInstance(ctx, standalone.Name, standalone) gomega.Expect(err).To(gomega.Succeed()) - testenv.Log.Info("Standalone reached Ready phase", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase) + testenv.Log.Info("Standalone reached Ready phase", "instance", standalone.ObjectMeta.Name, "phase", standalone.Status.Phase) DumpGetPods(testenv.GetName()) // In a steady state, we should stay in Ready and not flip-flop around @@ -128,13 +128,13 @@ func (testenv *TestCaseEnv) VerifySearchHeadClusterReady(ctx context.Context, de shc := &enterpriseApi.SearchHeadCluster{} err = deployment.GetInstance(ctx, instanceName, shc) gomega.Expect(err).To(gomega.Succeed()) - testenv.Log.Info("SearchHeadCluster reached Ready phase", "instance", shc.ObjectMeta.Name, "Phase", shc.Status.Phase, "DeployerPhase", shc.Status.DeployerPhase) + testenv.Log.Info("SearchHeadCluster reached Ready phase", "instance", shc.ObjectMeta.Name, "phase", shc.Status.Phase, "deployerPhase", shc.Status.DeployerPhase) DumpGetPods(testenv.GetName()) // In a steady state, we should stay in Ready and not flip-flop around gomega.Consistently(func() enterpriseApi.Phase { _ = deployment.GetInstance(ctx, deployment.GetName(), shc) - testenv.Log.Info("Check for Consistency Search Head Cluster phase to be ready", "instance", shc.ObjectMeta.Name, "Phase", shc.Status.Phase) + testenv.Log.Info("Check for Consistency Search Head Cluster phase to be ready", "instance", shc.ObjectMeta.Name, "phase", shc.Status.Phase) DumpGetSplunkVersion(ctx, testenv.GetName(), deployment, "-shc-") return shc.Status.Phase }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(enterpriseApi.PhaseReady)) @@ -151,13 +151,13 @@ func (testenv *TestCaseEnv) VerifySingleSiteIndexersReady(ctx context.Context, d idc := &enterpriseApi.IndexerCluster{} err = deployment.GetInstance(ctx, instanceName, idc) gomega.Expect(err).To(gomega.Succeed()) - testenv.Log.Info("IndexerCluster reached Ready phase", "instance", instanceName, "Phase", idc.Status.Phase) + testenv.Log.Info("IndexerCluster reached Ready phase", "instance", instanceName, "phase", idc.Status.Phase) DumpGetPods(testenv.GetName()) // In a steady state, we should stay in Ready and not flip-flop around gomega.Consistently(func() enterpriseApi.Phase { _ = deployment.GetInstance(ctx, instanceName, idc) - testenv.Log.Info("Check for Consistency indexer instance's phase to be ready", "instance", instanceName, "Phase", idc.Status.Phase) + testenv.Log.Info("Check for Consistency indexer instance's phase to be ready", "instance", instanceName, "phase", idc.Status.Phase) DumpGetSplunkVersion(ctx, testenv.GetName(), deployment, "-idxc-indexer-") return idc.Status.Phase }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(enterpriseApi.PhaseReady)) @@ -198,15 +198,15 @@ func (testenv *TestCaseEnv) VerifyClusterManagerReady(ctx context.Context, deplo cm := &enterpriseApi.ClusterManager{} err = deployment.GetInstance(ctx, deployment.GetName(), cm) gomega.Expect(err).To(gomega.Succeed()) - testenv.Log.Info("ClusterManager reached Ready phase", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase) + testenv.Log.Info("ClusterManager reached Ready phase", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase) DumpGetPods(testenv.GetName()) // In a steady state, cluster-manager should stay in Ready and not flip-flop around gomega.Consistently(func() enterpriseApi.Phase { _ = deployment.GetInstance(ctx, deployment.GetName(), cm) - testenv.Log.Info("Check for Consistency "+splcommon.ClusterManager+" phase to be ready", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase) + testenv.Log.Info("Check for Consistency "+splcommon.ClusterManager+" phase to be ready", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase) DumpGetSplunkVersion(ctx, testenv.GetName(), deployment, "cluster-manager") - testenv.Log.Info("Check for Consistency cluster-manager phase to be ready", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase) + testenv.Log.Info("Check for Consistency cluster-manager phase to be ready", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase) return cm.Status.Phase }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(enterpriseApi.PhaseReady)) } @@ -221,13 +221,13 @@ func (testenv *TestCaseEnv) VerifyClusterMasterReady(ctx context.Context, deploy cm := &enterpriseApiV3.ClusterMaster{} err = deployment.GetInstance(ctx, deployment.GetName(), cm) gomega.Expect(err).To(gomega.Succeed()) - testenv.Log.Info("ClusterMaster reached Ready phase", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase) + testenv.Log.Info("ClusterMaster reached Ready phase", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase) DumpGetPods(testenv.GetName()) // In a steady state, cluster-master should stay in Ready and not flip-flop around gomega.Consistently(func() enterpriseApi.Phase { _ = deployment.GetInstance(ctx, deployment.GetName(), cm) - testenv.Log.Info("Check for Consistency cluster-master phase to be ready", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase) + testenv.Log.Info("Check for Consistency cluster-master phase to be ready", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase) return cm.Status.Phase }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(enterpriseApi.PhaseReady)) } @@ -246,7 +246,7 @@ func (testenv *TestCaseEnv) VerifyIndexersReady(ctx context.Context, deployment if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for indexer site instance phase to be ready", "instance", instanceName, "Phase", idc.Status.Phase) + testenv.Log.Info("Waiting for indexer site instance phase to be ready", "instance", instanceName, "phase", idc.Status.Phase) DumpGetPods(testenv.GetName()) return idc.Status.Phase @@ -255,14 +255,14 @@ func (testenv *TestCaseEnv) VerifyIndexersReady(ctx context.Context, deployment // In a steady state, we should stay in Ready and not flip-flop around gomega.Consistently(func() enterpriseApi.Phase { _ = deployment.GetInstance(ctx, instanceName, idc) - testenv.Log.Info("Check for Consistency indexer site instance phase to be ready", "instance", instanceName, "Phase", idc.Status.Phase) + testenv.Log.Info("Check for Consistency indexer site instance phase to be ready", "instance", instanceName, "phase", idc.Status.Phase) DumpGetSplunkVersion(ctx, testenv.GetName(), deployment, "-idxc-indexer-") return idc.Status.Phase }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(enterpriseApi.PhaseReady)) } } -// VerifyIndexerClusterMultisiteStatus verify indexer Cluster is configured as multisite +// VerifyIndexerClusterMultisiteStatus verify Indexer Cluster is configured as multisite func (testenv *TestCaseEnv) VerifyIndexerClusterMultisiteStatus(ctx context.Context, deployment *Deployment, siteCount int) { siteIndexerMap := map[string][]string{} for site := 1; site <= siteCount; site++ { @@ -281,10 +281,10 @@ func (testenv *TestCaseEnv) VerifyIndexerClusterMultisiteStatus(ctx context.Cont command := []string{"/bin/sh"} stdout, stderr, err := deployment.PodExecCommand(ctx, podName, command, stdin, false) if err != nil { - testenv.Log.Error(err, "Failed to execute command", "on pod", podName, "command", command) + testenv.Log.Error(err, "Failed to execute command", "onPod", podName, "command", command) return map[string][]string{} } - testenv.Log.Info("Command executed", "on pod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) + testenv.Log.Info("Command executed", "onPod", podName, "command", command, "stdin", stdin, "stdout", stdout, "stderr", stderr) siteIndexerResponse := ClusterManagerSitesResponse{} json.Unmarshal([]byte(stdout), &siteIndexerResponse) siteIndexerStatus := map[string][]string{} @@ -298,20 +298,20 @@ func (testenv *TestCaseEnv) VerifyIndexerClusterMultisiteStatus(ctx context.Cont }, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(siteIndexerMap)) } -// VerifyRFSFMet verify RF SF is met on cluster manager +// VerifyRFSFMet verify RF SF is met on Cluster Manager func (testenv *TestCaseEnv) VerifyRFSFMet(ctx context.Context, deployment *Deployment) { gomega.Eventually(func() bool { rfSfStatus := CheckRFSF(ctx, deployment) - testenv.Log.Info("Verifying RF SF is met", "Status", rfSfStatus) + testenv.Log.Info("Verifying RF SF is met", "status", rfSfStatus) return rfSfStatus }, deployment.GetTimeout(), ShortPollInterval).Should(gomega.Equal(true)) } -// VerifyNoDisconnectedSHPresentOnCM is present on cluster manager +// VerifyNoDisconnectedSHPresentOnCM verifies no disconnected SH is present on Cluster Manager func (testenv *TestCaseEnv) VerifyNoDisconnectedSHPresentOnCM(ctx context.Context, deployment *Deployment) { gomega.Consistently(func() bool { shStatus := CheckSearchHeadRemoved(ctx, deployment) - testenv.Log.Info("Verifying no Search Head in DISCONNECTED state present on Cluster Manager", "Status", shStatus) + testenv.Log.Info("Verifying no Search Head in DISCONNECTED state present on Cluster Manager", "status", shStatus) return shStatus }, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(true)) } @@ -327,7 +327,7 @@ func (testenv *TestCaseEnv) VerifyLicenseManagerReady(ctx context.Context, deplo return enterpriseApi.PhaseError } testenv.Log.Info("Waiting for License Manager instance status to be ready", - "instance", LicenseManager.ObjectMeta.Name, "Phase", LicenseManager.Status.Phase) + "instance", LicenseManager.ObjectMeta.Name, "phase", LicenseManager.Status.Phase) DumpGetPods(testenv.GetName()) return LicenseManager.Status.Phase @@ -351,7 +351,7 @@ func (testenv *TestCaseEnv) VerifyLicenseMasterReady(ctx context.Context, deploy return enterpriseApi.PhaseError } testenv.Log.Info("Waiting for License Master instance status to be ready", - "instance", LicenseMaster.ObjectMeta.Name, "Phase", LicenseMaster.Status.Phase) + "instance", LicenseMaster.ObjectMeta.Name, "phase", LicenseMaster.Status.Phase) DumpGetPods(testenv.GetName()) return LicenseMaster.Status.Phase @@ -384,7 +384,7 @@ func (testenv *TestCaseEnv) VerifyServiceAccountConfiguredOnPod(deployment *Depl restResponse := PodDetailsStruct{} err = json.Unmarshal([]byte(output), &restResponse) if err != nil { - testenv.Log.Error(err, "Failed to parse cluster Search heads") + testenv.Log.Error(err, "Failed to parse cluster Search Heads") return false } testenv.Log.Info("Service Account on Pod", "found", restResponse.Spec.ServiceAccount, "expected", serviceAccount) @@ -456,7 +456,7 @@ func (testenv *TestCaseEnv) VerifySearchHeadClusterPhase(ctx context.Context, de if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for Search Head Cluster Phase", "instance", shc.ObjectMeta.Name, "Expected", phase, "Phase", shc.Status.Phase) + testenv.Log.Info("Waiting for Search Head Cluster Phase", "instance", shc.ObjectMeta.Name, "expected", phase, "phase", shc.Status.Phase) DumpGetPods(testenv.GetName()) return shc.Status.Phase @@ -471,7 +471,7 @@ func (testenv *TestCaseEnv) VerifyIndexerClusterPhase(ctx context.Context, deplo if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for Indexer Cluster Phase", "instance", idxc.ObjectMeta.Name, "Expected", phase, "Phase", idxc.Status.Phase) + testenv.Log.Info("Waiting for Indexer Cluster Phase", "instance", idxc.ObjectMeta.Name, "expected", phase, "phase", idxc.Status.Phase) DumpGetPods(testenv.GetName()) return idxc.Status.Phase @@ -486,7 +486,7 @@ func (testenv *TestCaseEnv) VerifyStandalonePhase(ctx context.Context, deploymen if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for Standalone status", "instance", standalone.ObjectMeta.Name, "Expected", phase, " Actual Phase", standalone.Status.Phase) + testenv.Log.Info("Waiting for Standalone status", "instance", standalone.ObjectMeta.Name, "expected", phase, "actualPhase", standalone.Status.Phase) DumpGetPods(testenv.GetName()) return standalone.Status.Phase @@ -501,7 +501,7 @@ func (testenv *TestCaseEnv) VerifyMonitoringConsolePhase(ctx context.Context, de if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for Monitoring Console CR status", "instance", mc.ObjectMeta.Name, "Expected", phase, " Actual Phase", mc.Status.Phase) + testenv.Log.Info("Waiting for Monitoring Console CR status", "instance", mc.ObjectMeta.Name, "expected", phase, "actualPhase", mc.Status.Phase) DumpGetPods(testenv.GetName()) return mc.Status.Phase @@ -596,7 +596,7 @@ func (testenv *TestCaseEnv) VerifyCustomResourceVersionChanged(ctx context.Conte if err != nil { return "-1" } - testenv.Log.Info("Waiting for ", kind, " CR status", "instance", name, "Not Expected", resourceVersion, " Actual Resource Version", newResourceVersion) + testenv.Log.Info("Waiting for ", kind, " CR status", "instance", name, "notExpected", resourceVersion, "actualResourceVersion", newResourceVersion) DumpGetPods(testenv.GetName()) return newResourceVersion @@ -674,7 +674,7 @@ func (testenv *TestCaseEnv) VerifyResourceConstraints(deployment *Deployment, po }, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(true)) } -// VerifyClusterManagerPhase verify phase of cluster manager +// VerifyClusterManagerPhase verify phase of Cluster Manager func (testenv *TestCaseEnv) VerifyClusterManagerPhase(ctx context.Context, deployment *Deployment, phase enterpriseApi.Phase) { cm := &enterpriseApi.ClusterManager{} gomega.Eventually(func() enterpriseApi.Phase { @@ -682,7 +682,7 @@ func (testenv *TestCaseEnv) VerifyClusterManagerPhase(ctx context.Context, deplo if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for cluster-manager Phase", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase, "Expected", phase) + testenv.Log.Info("Waiting for Cluster Manager Phase", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase, "expected", phase) DumpGetPods(testenv.GetName()) // Test ClusterManager Phase to see if its ready @@ -690,7 +690,7 @@ func (testenv *TestCaseEnv) VerifyClusterManagerPhase(ctx context.Context, deplo }, deployment.GetTimeout(), ShortPollInterval).Should(gomega.Equal(phase)) } -// VerifyClusterMasterPhase verify phase of cluster manager +// VerifyClusterMasterPhase verify phase of Cluster Master func (testenv *TestCaseEnv) VerifyClusterMasterPhase(ctx context.Context, deployment *Deployment, phase enterpriseApi.Phase) { cm := &enterpriseApiV3.ClusterMaster{} gomega.Eventually(func() enterpriseApi.Phase { @@ -698,7 +698,7 @@ func (testenv *TestCaseEnv) VerifyClusterMasterPhase(ctx context.Context, deploy if err != nil { return enterpriseApi.PhaseError } - testenv.Log.Info("Waiting for cluster-manager Phase", "instance", cm.ObjectMeta.Name, "Phase", cm.Status.Phase, "Expected", phase) + testenv.Log.Info("Waiting for Cluster Master Phase", "instance", cm.ObjectMeta.Name, "phase", cm.Status.Phase, "expected", phase) DumpGetPods(testenv.GetName()) // Test ClusterManager Phase to see if its ready @@ -716,9 +716,9 @@ func (testenv *TestCaseEnv) VerifySecretsOnPods(ctx context.Context, deployment comparsion := bytes.Compare([]byte(currentValue), secretValue) if comparsion == 0 { found = true - testenv.Log.Info("Secret Values on POD Match", "Match Expected", match, "Pod Name ", pod, "Secret Key", secretKey, "Given Value of Key", string(secretValue), "Key Value found", currentValue) + testenv.Log.Info("Secret Values on POD Match", "matchExpected", match, "podName", pod, "secretKey", secretKey, "givenValue", string(secretValue), "foundValue", currentValue) } else { - testenv.Log.Info("Secret Values on POD DONOT Match", "Match Expected", match, "Pod Name ", pod, "Secret Key", secretKey, "Given Value of Key", string(secretValue), "Key Value found", currentValue) + testenv.Log.Info("Secret Values on POD DONOT Match", "matchExpected", match, "podName", pod, "secretKey", secretKey, "givenValue", string(secretValue), "foundValue", currentValue) } gomega.Expect(found).Should(gomega.Equal(match)) } @@ -736,10 +736,10 @@ func (testenv *TestCaseEnv) VerifySecretsOnSecretObjects(ctx context.Context, de secretValueOnSecretObject := currentSecretData.Data[secretKey] comparsion := bytes.Compare(secretValueOnSecretObject, secretValue) if comparsion == 0 { - testenv.Log.Info("Secret Values on Secret Object Match", "Match Expected", match, "Secret Object Name", secretName, "Secret Key", secretKey, "Given Value of Key", string(secretValue), "Key Value found", string(secretValueOnSecretObject)) + testenv.Log.Info("Secret Values on Secret Object Match", "matchExpected", match, "secretObjectName", secretName, "secretKey", secretKey, "givenValue", string(secretValue), "foundValue", string(secretValueOnSecretObject)) found = true } else { - testenv.Log.Info("Secret Values on Secret Object DONOT match", "Match Expected", match, "Secret Object Name", secretName, "Secret Key", secretKey, "Given Value of Key", string(secretValue), "Key Value found", string(secretValueOnSecretObject)) + testenv.Log.Info("Secret Values on Secret Object DONOT match", "matchExpected", match, "secretObjectName", secretName, "secretKey", secretKey, "givenValue", string(secretValue), "foundValue", string(secretValueOnSecretObject)) } gomega.Expect(found).Should(gomega.Equal(match)) } @@ -751,7 +751,7 @@ func (testenv *TestCaseEnv) VerifySecretsOnSecretObjects(ctx context.Context, de func (testenv *TestCaseEnv) VerifySplunkServerConfSecrets(ctx context.Context, deployment *Deployment, verificationPods []string, data map[string][]byte, match bool) { for _, podName := range verificationPods { keysToMatch := GetKeysToMatch(podName) - testenv.Log.Info("Verificaton Keys Set", "Pod Name", podName, "Keys To Compare", keysToMatch) + testenv.Log.Info("Verificaton Keys Set", "podName", podName, "keysToCompare", keysToMatch) for _, secretName := range keysToMatch { found := false stanza := SecretKeytoServerConfStanza[secretName] @@ -759,10 +759,10 @@ func (testenv *TestCaseEnv) VerifySplunkServerConfSecrets(ctx context.Context, d gomega.Expect(err).To(gomega.Succeed(), "Secret not found in conf file", "Secret Name", secretName) comparsion := strings.Compare(value, string(data[secretName])) if comparsion == 0 { - testenv.Log.Info("Secret Values on server.conf Match", "Match Expected", match, "Pod Name", podName, "Secret Key", secretName, "Given Value of Key", string(data[secretName]), "Key Value found", value) + testenv.Log.Info("Secret Values on server.conf Match", "matchExpected", match, "podName", podName, "secretKey", secretName, "givenValue", string(data[secretName]), "foundValue", value) found = true } else { - testenv.Log.Info("Secret Values on server.conf DONOT MATCH", "Match Expected", match, "Pod Name", podName, "Secret Key", secretName, "Given Value of Key", string(data[secretName]), "Key Value found", value) + testenv.Log.Info("Secret Values on server.conf DONOT MATCH", "matchExpected", match, "podName", podName, "secretKey", secretName, "givenValue", string(data[secretName]), "foundValue", value) } gomega.Expect(found).Should(gomega.Equal(match)) } @@ -776,16 +776,16 @@ func (testenv *TestCaseEnv) VerifySplunkInputConfSecrets(deployment *Deployment, for _, podName := range verificationPods { if strings.Contains(podName, "standalone") || strings.Contains(podName, "indexer") { found := false - testenv.Log.Info("Key Verificaton", "Pod Name", podName, "Key", secretName) + testenv.Log.Info("Key Verificaton", "podName", podName, "key", secretName) stanza := SecretKeytoServerConfStanza[secretName] _, value, err := GetSecretFromInputsConf(deployment, podName, testenv.GetName(), "token", stanza) gomega.Expect(err).To(gomega.Succeed(), "Secret not found in conf file", "Secret Name", secretName) comparsion := strings.Compare(value, string(data[secretName])) if comparsion == 0 { - testenv.Log.Info("Secret Values on input.conf Match", "Match Expected", match, "Pod Name", podName, "Secret Key", secretName, "Given Value of Key", string(data[secretName]), "Key Value found", value) + testenv.Log.Info("Secret Values on input.conf Match", "matchExpected", match, "podName", podName, "secretKey", secretName, "givenValue", string(data[secretName]), "foundValue", value) found = true } else { - testenv.Log.Info("Secret Values on input.conf DONOT MATCH", "Match Expected", match, "Pod Name", podName, "Secret Key", secretName, "Given Value of Key", string(data[secretName]), "Key Value found", value) + testenv.Log.Info("Secret Values on input.conf DONOT MATCH", "matchExpected", match, "podName", podName, "secretKey", secretName, "givenValue", string(data[secretName]), "foundValue", value) } gomega.Expect(found).Should(gomega.Equal(match)) } @@ -803,7 +803,7 @@ func (testenv *TestCaseEnv) VerifySplunkSecretViaAPI(ctx context.Context, deploy } for _, secretName := range keysToMatch { validKey := false - testenv.Log.Info("Key Verificaton", "Pod Name", podName, "Key", secretName) + testenv.Log.Info("Key Verificaton", "podName", podName, "key", secretName) validKey = CheckSecretViaAPI(ctx, deployment, podName, secretName, string(data[secretName])) gomega.Expect(validKey).Should(gomega.Equal(match)) } @@ -822,7 +822,7 @@ func (testenv *TestCaseEnv) VerifyPVC(deployment *Deployment, ns string, pvcName break } } - testenv.Log.Info("PVC Status Verified", "PVC", pvcName, "STATUS", pvcExists, "EXPECTED", expectedToExist) + testenv.Log.Info("PVC Status Verified", "pvc", pvcName, "status", pvcExists, "expected", expectedToExist) return pvcExists }, verificationTimeout, PollInterval).Should(gomega.Equal(expectedToExist)) } @@ -920,7 +920,7 @@ func (testenv *TestCaseEnv) VerifyAppsInFolder(ctx context.Context, deployment * gomega.Eventually(func() bool { // Using checkAppDirectory here to get all files in case of negative check. GetDirsOrFilesInPath will return files/directory when checkAppDirecotry is FALSE appList, err := GetDirsOrFilesInPath(ctx, deployment, podName, path, checkAppDirectory) - gomega.Expect(err).To(gomega.Succeed(), "Unable to get apps on pod", "Pod", podName) + gomega.Expect(err).To(gomega.Succeed(), "Unable to get apps on pod", "pod", podName) for _, app := range apps { folderName := app + "/" found := CheckStringInSlice(appList, folderName) @@ -938,10 +938,10 @@ func (testenv *TestCaseEnv) VerifyAppsDownloadedOnContainer(ctx context.Context, for _, podName := range pods { appList, err := GetDirsOrFilesInPath(ctx, deployment, podName, path, false) - gomega.Expect(err).To(gomega.Succeed(), "Unable to get apps on pod", "Pod", podName) + gomega.Expect(err).To(gomega.Succeed(), "Unable to get apps on pod", "pod", podName) for _, app := range apps { found := CheckStringInSlice(appList, app) - testenv.Log.Info("Check App files present on the pod", "Pod Name", podName, "App Name", app, "directory", path, "Status", found) + testenv.Log.Info("Check App files present on the pod", "podName", podName, "appName", app, "directory", path, "status", found) gomega.Expect(found).Should(gomega.Equal(true)) } } @@ -954,7 +954,7 @@ func (testenv *TestCaseEnv) VerifyAppsPackageDeletedOnOperatorContainer(ctx cont gomega.Eventually(func() bool { appList, err := GetOperatorDirsOrFilesInPath(ctx, deployment, podName, path, false) if err != nil { - testenv.Log.Error(err, "Unable to get apps on operator pod", "Pod", podName) + testenv.Log.Error(err, "Unable to get apps on operator pod", "pod", podName) return true } found := CheckStringInSlice(appList, app+"_") @@ -972,7 +972,7 @@ func (testenv *TestCaseEnv) VerifyAppsPackageDeletedOnContainer(ctx context.Cont gomega.Eventually(func() bool { appList, err := GetDirsOrFilesInPath(ctx, deployment, podName, path, false) if err != nil { - testenv.Log.Error(err, "Unable to get apps on pod", "Pod", podName) + testenv.Log.Error(err, "Unable to get apps on pod", "pod", podName) return true } found := CheckStringInSlice(appList, app+"_") @@ -998,7 +998,7 @@ func (testenv *TestCaseEnv) VerifyAppListPhase(ctx context.Context, deployment * testenv.Log.Info(fmt.Sprintf("App deployment info not found yet for app %s (CR %s/%s, AppSource %s), continuing to poll", appName, crKind, name, appSourceName)) return phase // Continue polling } - testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected Phase should not be %s", crKind, name, appName, phase), "Actual Phase", appDeploymentInfo.PhaseInfo.Phase, "App State", appDeploymentInfo) + testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected Phase should not be %s", crKind, name, appName, phase), "actualPhase", appDeploymentInfo.PhaseInfo.Phase, "appState", appDeploymentInfo) return appDeploymentInfo.PhaseInfo.Phase }, deployment.GetTimeout(), PollInterval).ShouldNot(gomega.Equal(phase)) } @@ -1015,9 +1015,9 @@ func (testenv *TestCaseEnv) VerifyAppListPhase(ctx context.Context, deployment * testenv.Log.Info(fmt.Sprintf("App deployment info not found yet for app %s (CR %s/%s, AppSource %s), continuing to poll", appName, crKind, name, appSourceName)) return enterpriseApi.PhaseDownload // Continue polling } - testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected Phase %s", crKind, name, appName, phase), "Actual Phase", appDeploymentInfo.PhaseInfo.Phase, "App Phase Status", appDeploymentInfo.PhaseInfo.Status, "App State", appDeploymentInfo) + testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected Phase %s", crKind, name, appName, phase), "actualPhase", appDeploymentInfo.PhaseInfo.Phase, "appPhaseStatus", appDeploymentInfo.PhaseInfo.Status, "appState", appDeploymentInfo) if appDeploymentInfo.PhaseInfo.Status != enterpriseApi.AppPkgInstallComplete { - testenv.Log.Info("Phase Install Not Complete.", "Phase Found", appDeploymentInfo.PhaseInfo.Phase, "Phase Status Found", appDeploymentInfo.PhaseInfo.Status) + testenv.Log.Info("Phase Install Not Complete.", "phaseFound", appDeploymentInfo.PhaseInfo.Phase, "phaseStatusFound", appDeploymentInfo.PhaseInfo.Status) return enterpriseApi.PhaseDownload } return appDeploymentInfo.PhaseInfo.Phase @@ -1053,7 +1053,7 @@ func (testenv *TestCaseEnv) VerifyPodsInMCConfigMap(ctx context.Context, deploym mcConfigMap, err := GetMCConfigMap(ctx, deployment, testenv.GetName(), mcName) gomega.Expect(err).To(gomega.Succeed(), "Unable to get MC config map") for _, podName := range pods { - testenv.Log.Info("Checking for POD on MC Config Map", "POD Name", podName, "DATA", mcConfigMap.Data) + testenv.Log.Info("Checking for POD on MC Config Map", "podName", podName, "data", mcConfigMap.Data) gomega.Expect(expected).To(gomega.Equal(CheckPodNameInString(podName, mcConfigMap.Data[key])), "Verify Pod in MC Config Map. Pod Name %s.", podName) } } @@ -1061,7 +1061,7 @@ func (testenv *TestCaseEnv) VerifyPodsInMCConfigMap(ctx context.Context, deploym // VerifyPodsInMCConfigString checks if given pod names are present in given KEY of given MC's Config Map func (testenv *TestCaseEnv) VerifyPodsInMCConfigString(ctx context.Context, deployment *Deployment, pods []string, mcName string, expected bool, checkPodIP bool) { for _, podName := range pods { - testenv.Log.Info("Checking pod configured in MC POD Peers String", "Pod Name", podName) + testenv.Log.Info("Checking pod configured in MC POD Peers String", "podName", podName) var found bool if checkPodIP { podIP := GetPodIP(testenv.GetName(), podName) @@ -1082,7 +1082,7 @@ func (testenv *TestCaseEnv) VerifyClusterManagerBundlePush(ctx context.Context, clusterManagerBundleStatus = CMBundlePushstatus(ctx, deployment, previousBundleHash, "cmaster") } if len(clusterManagerBundleStatus) < replicas { - testenv.Log.Info("Bundle push on Pod not complete on all pods", "Pod with bundle push", clusterManagerBundleStatus) + testenv.Log.Info("Bundle push on Pod not complete on all pods", "podWithBundlePush", clusterManagerBundleStatus) return false } clusterPodNames := DumpGetPods(testenv.GetName()) @@ -1091,11 +1091,11 @@ func (testenv *TestCaseEnv) VerifyClusterManagerBundlePush(ctx context.Context, if strings.Contains(podName, "-indexer-") { if _, present := clusterManagerBundleStatus[podName]; present { if clusterManagerBundleStatus[podName] != "Up" { - testenv.Log.Info("Bundle push on Pod not complete", "Pod Name", podName, "Status", clusterManagerBundleStatus[podName]) + testenv.Log.Info("Bundle push on Pod not complete", "podName", podName, "status", clusterManagerBundleStatus[podName]) return false } } else { - testenv.Log.Info("Bundle push not found on pod", "Podname", podName) + testenv.Log.Info("Bundle push not found on pod", "podName", podName) return false } } @@ -1116,7 +1116,7 @@ func (testenv *TestCaseEnv) VerifyDeployerBundlePush(ctx context.Context, deploy } for appName, val := range deployerAppPushStatus { if val < replicas { - testenv.Log.Info("Bundle push not complete on all pods for", "App Name", appName, "Replicas with bundle push", val, "Expected replicas", replicas) + testenv.Log.Info("Bundle push not complete on all pods for", "appName", appName, "replicasWithBundlePush", val, "expectedReplicas", replicas) DumpGetPods(testenv.GetName()) return false @@ -1175,21 +1175,21 @@ func (testenv *TestCaseEnv) VerifyAppRepoState(ctx context.Context, deployment * testenv.Log.Error(err, "Failed to get app deployment info") return 0 } - testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected repo value %d", crKind, name, appName, repoValue), "Actual Value", appDeploymentInfo.RepoState, "App State", appDeploymentInfo) + testenv.Log.Info(fmt.Sprintf("App State found for CR %s NAME %s APP NAME %s Expected repo value %d", crKind, name, appName, repoValue), "actualValue", appDeploymentInfo.RepoState, "appState", appDeploymentInfo) return int(appDeploymentInfo.RepoState) }, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(repoValue)) } // VerifyIsDeploymentInProgressFlagIsSet verify IsDeploymentInProgress flag is set to true func (testenv *TestCaseEnv) VerifyIsDeploymentInProgressFlagIsSet(ctx context.Context, deployment *Deployment, name string, crKind string) { - testenv.Log.Info("Check IsDeploymentInProgress Flag is set", "CR NAME", name, "CR Kind", crKind) + testenv.Log.Info("Check IsDeploymentInProgress Flag is set", "crName", name, "crKind", crKind) gomega.Eventually(func() bool { isDeploymentInProgress, err := GetIsDeploymentInProgressFlag(ctx, deployment, testenv, name, crKind) if err != nil { testenv.Log.Error(err, "Failed to get isDeploymentInProgress Flag") return false } - testenv.Log.Info("IsDeploymentInProgress Flag status found", "CR NAME", name, "CR Kind", crKind, "IsDeploymentInProgress", isDeploymentInProgress) + testenv.Log.Info("IsDeploymentInProgress Flag status found", "crName", name, "crKind", crKind, "isDeploymentInProgress", isDeploymentInProgress) return isDeploymentInProgress }, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(true)) } @@ -1200,7 +1200,7 @@ func (testenv *TestCaseEnv) VerifyFilesInDirectoryOnPod(ctx context.Context, dep gomega.Eventually(func() bool { // Using checkDirectory here to get all files in case of negative check. GetDirsOrFilesInPath will return files/directory when checkDirecotry is FALSE filelist, err := GetDirsOrFilesInPath(ctx, deployment, podName, path, checkDirectory) - gomega.Expect(err).To(gomega.Succeed(), "Unable to get files on pod", "Pod", podName) + gomega.Expect(err).To(gomega.Succeed(), "Unable to get files on pod", "pod", podName) for _, file := range files { found := CheckStringInSlice(filelist, file) testenv.Log.Info("File check", "pod", podName, "filename", file, "path", path, "status", found) From 4bac134f1aaa034032e0a5df246c39a77c9af9d7 Mon Sep 17 00:00:00 2001 From: Kasia Koziol Date: Tue, 31 Mar 2026 11:06:58 +0200 Subject: [PATCH 20/20] CSPL-3775 Eliminate duplicated verification patterns, fix redundant code, and standardize naming, godoc comments, and constants for consistency --- test/custom_resource_crud/crud_test_shared.go | 25 +- .../custom_resource_crud_test.go | 45 +- ...dex_and_ingestion_separation_suite_test.go | 2 +- .../ingest_search_test_shared.go | 8 +- test/licensemanager/lm_test_shared.go | 85 +-- .../monitoring_console_test.go | 526 ++++-------------- .../monitoring_console_test_shared.go | 164 +++++- test/secret/secret_test.go | 41 +- test/secret/secret_test_shared.go | 166 +++--- test/smartstore/smartstore_test.go | 40 +- test/smartstore/smartstore_test_shared.go | 7 +- test/testenv/assertion_helpers.go | 25 +- test/testenv/common_test_patterns.go | 17 + test/testenv/testcaseenv.go | 4 +- 14 files changed, 477 insertions(+), 678 deletions(-) diff --git a/test/custom_resource_crud/crud_test_shared.go b/test/custom_resource_crud/crud_test_shared.go index 50e1d1248..e7a625e91 100644 --- a/test/custom_resource_crud/crud_test_shared.go +++ b/test/custom_resource_crud/crud_test_shared.go @@ -71,9 +71,7 @@ func RunC3CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes Expect(err).To(Succeed(), "Unable to deploy cluster") // Verify cluster is ready - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { - config.ClusterManagerReady(ctx, d, testcaseEnvInst) - }) + config.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst) // Verify telemetry testcaseEnvInst.TriggerAndVerifyTelemetry(ctx, deployment, prevTelemetrySubmissionTime) @@ -140,9 +138,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t Expect(err).To(Succeed(), "Unable to deploy cluster") // Verify cluster is ready and RF/SF is met - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { - config.ClusterManagerReady(ctx, d, testcaseEnvInst) - }) + config.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst) testcaseEnvInst.VerifyRFSFMet(ctx, deployment) // Deploy and verify Monitoring Console @@ -177,6 +173,7 @@ func RunC3PVCDeletionTest(ctx context.Context, deployment *testenv.Deployment, t testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "monitoring-console", 1, false, verificationTimeout) } +// verifyC3ClusterPVCs verifies that PVCs for SHC, deployer, indexers, and cluster manager exist or are deleted. func verifyC3ClusterPVCs(testcaseEnvInst *testenv.TestCaseEnv, deployment *testenv.Deployment, clusterManagerType string, exists bool, timeout time.Duration) { testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-search-head", 3, exists, timeout) testcaseEnvInst.VerifyPVCsPerDeployment(deployment, "shc-deployer", 1, exists, timeout) @@ -189,16 +186,14 @@ func verifyC3ClusterPVCs(testcaseEnvInst *testenv.TestCaseEnv, deployment *teste func RunSHCDeployerResourceSpecTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, defaultCPULimits string) { shcName := fmt.Sprintf("%s-shc", deployment.GetName()) _, err := deployment.DeploySearchHeadCluster(ctx, shcName, "", "", "", "") - if err != nil { - Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster", "shc", shcName) - } + Expect(err).To(Succeed(), "Unable to deploy Search Head Cluster", "shc", shcName) // Verify CPU limits on Search Heads and deployer before updating CR searchHeadCount := 3 testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) - DeployerPodName := fmt.Sprintf(testenv.DeployerPod, deployment.GetName()) - testcaseEnvInst.VerifyCPULimits(deployment, DeployerPodName, defaultCPULimits) + deployerPodName := fmt.Sprintf(testenv.DeployerPod, deployment.GetName()) + testcaseEnvInst.VerifyCPULimits(deployment, deployerPodName, defaultCPULimits) shc := &enterpriseApi.SearchHeadCluster{} testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Unable to fetch Search Head Cluster deployment") @@ -230,7 +225,7 @@ func RunSHCDeployerResourceSpecTest(ctx context.Context, deployment *testenv.Dep testcaseEnvInst.VerifySearchHeadCPULimits(deployment, deployment.GetName(), searchHeadCount, defaultCPULimits) // Verify modified deployer spec - testcaseEnvInst.VerifyResourceConstraints(deployment, DeployerPodName, depResSpec) + testcaseEnvInst.VerifyResourceConstraints(deployment, deployerPodName, depResSpec) } // RunM4CPUUpdateTest runs the standard M4 CPU limit update test workflow @@ -239,9 +234,7 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes mcRef := deployment.GetName() prevTelemetrySubmissionTime := testcaseEnvInst.GetTelemetryLastSubmissionTime(ctx, deployment) siteCount := 3 - var err error - - err = config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) + err := config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") // Ensure that the cluster-manager goes to Ready phase @@ -273,7 +266,7 @@ func RunM4CPUUpdateTest(ctx context.Context, deployment *testenv.Deployment, tes } // Verify Indexer Cluster is updating - idxcName := deployment.GetName() + "-" + "site1" + idxcName := deployment.GetName() + "-site1" testcaseEnvInst.VerifyIndexerClusterPhase(ctx, deployment, enterpriseApi.PhaseUpdating, idxcName) // Verify Indexers go to ready state diff --git a/test/custom_resource_crud/custom_resource_crud_test.go b/test/custom_resource_crud/custom_resource_crud_test.go index f01200b58..2c5c069d6 100644 --- a/test/custom_resource_crud/custom_resource_crud_test.go +++ b/test/custom_resource_crud/custom_resource_crud_test.go @@ -21,6 +21,13 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) +// masterManagerCrudConfigs defines the V3 (master) and V4 (manager) variants +// shared by the C3 and M4 CRUD test tables. +var masterManagerCrudConfigs = []testenv.MasterManagerTestConfig{ + {NamePrefix: "master", Label: "mastercrcrud", NewConfig: testenv.NewClusterReadinessConfigV3}, + {NamePrefix: "", Label: "managercrcrud", NewConfig: testenv.NewClusterReadinessConfigV4}, +} + var _ = Describe("Custom Resource CRUD test", func() { var testcaseEnvInst *testenv.TestCaseEnv @@ -49,36 +56,27 @@ var _ = Describe("Custom Resource CRUD test", func() { }) // C3 tests — V3 (master) and V4 (manager) variants - c3CrudConfigs := []struct { - namePrefix string - label string - newConfig func() *testenv.ClusterReadinessConfig - }{ - {"master", "mastercrcrud", testenv.NewClusterReadinessConfigV3}, - {"", "managercrcrud", testenv.NewClusterReadinessConfigV4}, - } - - for _, tc := range c3CrudConfigs { + for _, tc := range masterManagerCrudConfigs { tc := tc Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { BeforeEach(func() { defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits verificationTimeout = DefaultVerificationTimeout - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, c3: can deploy Indexer and Search Head Cluster, change their CR, update the instances", func() { - config := tc.newConfig() + It(tc.Label+", integration, c3: can deploy Indexer and Search Head Cluster, change their CR, update the instances", func() { + config := tc.NewConfig() RunC3CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) - It(tc.label+", integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { - config := tc.newConfig() + It(tc.Label+", integration, c3: can verify IDXC, CM and SHC PVCs are correctly deleted after the CRs deletion", func() { + config := tc.NewConfig() RunC3PVCDeletionTest(ctx, deployment, testcaseEnvInst, config, verificationTimeout) }) }) @@ -101,30 +99,21 @@ var _ = Describe("Custom Resource CRUD test", func() { }) // M4 tests — V3 (master) and V4 (manager) variants - m4CrudConfigs := []struct { - namePrefix string - label string - newConfig func() *testenv.ClusterReadinessConfig - }{ - {"master", "mastercrcrud", testenv.NewClusterReadinessConfigV3}, - {"", "managercrcrud", testenv.NewClusterReadinessConfigV4}, - } - - for _, tc := range m4CrudConfigs { + for _, tc := range masterManagerCrudConfigs { tc := tc Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster)", func() { BeforeEach(func() { defaultCPULimits = DefaultCPULimits newCPULimits = UpdatedCPULimits - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, m4: can deploy multisite Indexer and Search Head Clusters, change their CR, update the instances", func() { - config := tc.newConfig() + It(tc.Label+", integration, m4: can deploy multisite Indexer and Search Head Clusters, change their CR, update the instances", func() { + config := tc.NewConfig() RunM4CPUUpdateTest(ctx, deployment, testcaseEnvInst, config, defaultCPULimits, newCPULimits) }) }) diff --git a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go index 3a57cf228..4b2732a69 100644 --- a/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go +++ b/test/index_and_ingestion_separation/index_and_ingestion_separation_suite_test.go @@ -27,7 +27,7 @@ import ( var ( testenvInstance *testenv.TestEnv - testSuiteName = "indexingestionsep-" + testenv.RandomDNSName(3) + testSuiteName = "idxingsep-" + testenv.RandomDNSName(3) queue = enterpriseApi.QueueSpec{ Provider: "sqs", diff --git a/test/ingest_search/ingest_search_test_shared.go b/test/ingest_search/ingest_search_test_shared.go index 6873c3558..441ecaa91 100644 --- a/test/ingest_search/ingest_search_test_shared.go +++ b/test/ingest_search/ingest_search_test_shared.go @@ -35,7 +35,7 @@ func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deploym standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) searchString := "index=_internal | stats count by host" searchResultsResp, err := testenv.PerformSearchSync(ctx, podName, searchString, deployment) @@ -62,7 +62,7 @@ func RunS1InternalLogSearchTest(ctx context.Context, deployment *testenv.Deploym }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) searchString := "index=_internal GUID component=ServerConfig" sid, reqErr := testenv.PerformSearchReq(ctx, podName, searchString, deployment) @@ -102,7 +102,7 @@ func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deploymen standalone := testcaseEnvInst.DeployAndVerifyStandalone(ctx, deployment, deployment.GetName(), "", "") Eventually(func() enterpriseApi.Phase { - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) splunkBin := "/opt/splunk/bin/splunk" username := "admin" @@ -126,7 +126,7 @@ func RunS1IngestAndSearchTest(ctx context.Context, deployment *testenv.Deploymen return standalone.Status.Phase }, deployment.GetTimeout(), testenv.PollInterval).Should(Equal(enterpriseApi.PhaseReady)) - podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName()) + podName := fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0) indexName := "myTestIndex" err := testenv.CreateAnIndexStandalone(ctx, indexName, podName, deployment) diff --git a/test/licensemanager/lm_test_shared.go b/test/licensemanager/lm_test_shared.go index 31d2c17f0..0da5f6916 100644 --- a/test/licensemanager/lm_test_shared.go +++ b/test/licensemanager/lm_test_shared.go @@ -28,6 +28,8 @@ import ( corev1 "k8s.io/api/core/v1" ) +// LicenseTestConfig holds the version-specific (V3/V4) deployment and verification +// callbacks used by the license manager test functions. type LicenseTestConfig struct { *testenv.ClusterReadinessConfig DeployLicenseManagerWithGivenSpec func(ctx context.Context, deployment *testenv.Deployment, name string, spec interface{}) (interface{}, error) @@ -35,6 +37,8 @@ type LicenseTestConfig struct { LicenseManagerPodName string } +// newLicenseCommonSplunkSpec returns a CommonSplunkSpec pre-configured with the +// license config map volume and license URL. func newLicenseCommonSplunkSpec(testcaseEnvInst *testenv.TestCaseEnv) enterpriseApi.CommonSplunkSpec { return enterpriseApi.CommonSplunkSpec{ Volumes: []corev1.Volume{{ @@ -52,6 +56,7 @@ func newLicenseCommonSplunkSpec(testcaseEnvInst *testenv.TestCaseEnv) enterprise } } +// NewLicenseMasterConfig returns a LicenseTestConfig for V3 (LicenseMaster) tests. func NewLicenseMasterConfig() *LicenseTestConfig { return &LicenseTestConfig{ ClusterReadinessConfig: testenv.NewClusterReadinessConfigV3(), @@ -68,6 +73,7 @@ func NewLicenseMasterConfig() *LicenseTestConfig { } } +// NewLicenseManagerConfig returns a LicenseTestConfig for V4 (LicenseManager) tests. func NewLicenseManagerConfig() *LicenseTestConfig { return &LicenseTestConfig{ ClusterReadinessConfig: testenv.NewClusterReadinessConfigV4(), @@ -84,6 +90,7 @@ func NewLicenseManagerConfig() *LicenseTestConfig { } } +// downloadAppFiles downloads app files from the appropriate cloud provider. func downloadAppFiles(ctx context.Context, testDataS3Bucket, azureDataContainer, appDir, downloadDir string, appFileList []string, version string) { var err error @@ -100,6 +107,7 @@ func downloadAppFiles(ctx context.Context, testDataS3Bucket, azureDataContainer, Expect(err).To(Succeed(), fmt.Sprintf("Unable to download %s app files", version)) } +// uploadAppFiles uploads app files to the appropriate cloud provider and returns the uploaded file paths. func uploadAppFiles(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, testS3Bucket, testDir, downloadDir string, appFileList []string, version string) []string { var uploadedFiles []string var err error @@ -122,6 +130,7 @@ func uploadAppFiles(ctx context.Context, testcaseEnvInst *testenv.TestCaseEnv, t return uploadedFiles } +// deleteUploadedFiles removes previously uploaded app files from the appropriate cloud provider. func deleteUploadedFiles(ctx context.Context, testS3Bucket string, uploadedApps []string) { switch testenv.ClusterProvider { case "eks": @@ -134,8 +143,25 @@ func deleteUploadedFiles(ctx context.Context, testS3Bucket string, uploadedApps } } +// verifyLMAppsOnPod verifies that apps are copied and installed on the License Manager pod. +// The updated flag controls whether apps are expected to be updated versions. +func verifyLMAppsOnPod(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, testenvInstance *testenv.TestEnv, podName []string, appList []string, updated bool) { + testcaseEnvInst.VerifyAppsCopied(ctx, deployment, testenvInstance.GetName(), podName, appList, true, enterpriseApi.ScopeLocal) + testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), podName, appList, updated, "enabled", updated, false) +} + +// verifyLMConfiguredOnCluster verifies that the License Manager is configured on +// the given indexer pods, on search head pods, and on the Monitoring Console. +func verifyLMConfiguredOnCluster(ctx context.Context, deployment *testenv.Deployment, indexerPods []string) { + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), 3, false, 0) + testenv.VerifyLMConfiguredOnPods(ctx, deployment, append(indexerPods, shPods...)) + testenv.VerifyLMConfiguredOnMC(ctx, deployment) +} + +// RunLMS1Test deploys a Standalone with License Manager and Monitoring Console, +// then verifies LM is configured on the standalone and MC pods. func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download license file + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create Standalone deployment with License Manager/Master @@ -160,12 +186,13 @@ func RunLMS1Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn testenv.VerifyLMConfiguredOnPod(ctx, deployment, standalonePodName) // Verify License Manager/Master is configured on Monitoring Console - monitoringConsolePodName := fmt.Sprintf(testenv.MonitoringConsolePod, deployment.GetName()) - testenv.VerifyLMConfiguredOnPod(ctx, deployment, monitoringConsolePodName) + testenv.VerifyLMConfiguredOnMC(ctx, deployment) } +// RunLMC3Test deploys a C3 cluster with License Manager and Monitoring Console, +// then verifies LM is configured on indexers, search heads, and MC. func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download license file + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Deploy single site Cluster with License Manager/Master @@ -173,27 +200,24 @@ func RunLMC3Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn err := deployment.DeploySingleSiteCluster(ctx, deployment.GetName(), 3, true, mcRef) Expect(err).To(Succeed(), "Unable to deploy cluster") - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { - config.ClusterManagerReady(ctx, d, testcaseEnvInst) - }) + config.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst) deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) - // Verify License Manager/Master is configured on indexers and search heads + // Verify License Manager/Master is configured on indexers, search heads, and MC indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), 3, false, 0) - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), 3, false, 0) - testenv.VerifyLMConfiguredOnPods(ctx, deployment, append(indexerPods, shPods...)) - - testenv.VerifyLMConfiguredOnMC(ctx, deployment) + verifyLMConfiguredOnCluster(ctx, deployment, indexerPods) } +// RunLMC3AppFrameworkTest deploys a License Manager with App Framework, verifies V1 apps +// are installed, upgrades to V2 apps, and verifies the updated apps. func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, testenvInstance *testenv.TestEnv, config *LicenseTestConfig) { var ( appListV1 []string appListV2 []string testS3Bucket = os.Getenv("TEST_INDEXES_S3_BUCKET") testDataS3Bucket = os.Getenv("TEST_BUCKET") - AzureDataContainer = os.Getenv("TEST_CONTAINER") + azureDataContainer = os.Getenv("TEST_CONTAINER") appDirV1 = testenv.AppLocationV1 appDirV2 = testenv.AppLocationV2 currDir, _ = os.Getwd() @@ -209,14 +233,14 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment appFileList := testenv.GetAppFileList(appListV1) // Download V1 Apps - downloadAppFiles(ctx, testDataS3Bucket, AzureDataContainer, appDirV1, downloadDirV1, appFileList, appVersion) + downloadAppFiles(ctx, testDataS3Bucket, azureDataContainer, appDirV1, downloadDirV1, appFileList, appVersion) // Upload V1 apps testDir = "lm-" + testenv.RandomDNSName(4) uploadedFiles := uploadAppFiles(ctx, testcaseEnvInst, testS3Bucket, testDir, downloadDirV1, appFileList, appVersion) uploadedApps = append(uploadedApps, uploadedFiles...) - // Download license file + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Create app framework spec @@ -252,19 +276,15 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment spec := config.BuildLMAppFrameworkSpec(testcaseEnvInst, appFrameworkSpec) // Deploy the License Manager/Master with App Framework - var err error - _, err = config.DeployLicenseManagerWithGivenSpec(ctx, deployment, deployment.GetName(), spec) + _, err := config.DeployLicenseManagerWithGivenSpec(ctx, deployment, deployment.GetName(), spec) Expect(err).To(Succeed(), "Unable to deploy LM with App Framework") // Wait for License Manager/Master to be in READY status config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - // Verify apps are copied at the correct location on License Manager/Master (/etc/apps/) + // Verify apps are copied and installed on License Manager/Master podName := []string{fmt.Sprintf(config.LicenseManagerPodName, deployment.GetName(), 0)} - testcaseEnvInst.VerifyAppsCopied(ctx, deployment, testenvInstance.GetName(), podName, appListV1, true, enterpriseApi.ScopeLocal) - - // Verify apps are installed on License Manager/Master - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), podName, appListV1, false, "enabled", false, false) + verifyLMAppsOnPod(ctx, deployment, testcaseEnvInst, testenvInstance, podName, appListV1, false) // Delete files uploaded deleteUploadedFiles(ctx, testS3Bucket, uploadedApps) @@ -276,7 +296,7 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment appVersion = "V2" // Download V2 Apps - downloadAppFiles(ctx, testDataS3Bucket, AzureDataContainer, appDirV2, downloadDirV2, appFileList, appVersion) + downloadAppFiles(ctx, testDataS3Bucket, azureDataContainer, appDirV2, downloadDirV2, appFileList, appVersion) // Upload V2 apps uploadedFiles = uploadAppFiles(ctx, testcaseEnvInst, testS3Bucket, testDir, downloadDirV2, appFileList, appVersion) @@ -288,11 +308,8 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment // Verify LM stays in ready state config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - // Verify apps are copied at the correct location on License Manager/Master (/etc/apps/) - testcaseEnvInst.VerifyAppsCopied(ctx, deployment, testenvInstance.GetName(), podName, appListV2, true, enterpriseApi.ScopeLocal) - - // Verify apps are installed on License Manager/Master - testcaseEnvInst.VerifyAppInstalled(ctx, deployment, testcaseEnvInst.GetName(), podName, appListV2, true, "enabled", true, false) + // Verify apps are copied and installed on License Manager/Master + verifyLMAppsOnPod(ctx, deployment, testcaseEnvInst, testenvInstance, podName, appListV2, true) // Delete files uploaded deleteUploadedFiles(ctx, testS3Bucket, uploadedApps) @@ -302,8 +319,10 @@ func RunLMC3AppFrameworkTest(ctx context.Context, deployment *testenv.Deployment os.RemoveAll(downloadDirV2) } +// RunLMM4Test deploys a multisite cluster with License Manager and Monitoring Console, +// then verifies LM is configured on indexers, search heads, and MC. func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *LicenseTestConfig) { - // Download license file + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) // Deploy Multisite Cluster with License Manager/Master and Search Head @@ -317,14 +336,12 @@ func RunLMM4Test(ctx context.Context, deployment *testenv.Deployment, testcaseEn deployMCAndVerifyRFSF(ctx, deployment, testcaseEnvInst, mcRef) - // Verify License Manager/Master is configured on indexers and search heads + // Verify License Manager/Master is configured on indexers, search heads, and MC indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), 1, true, siteCount) - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), 3, false, 0) - testenv.VerifyLMConfiguredOnPods(ctx, deployment, append(indexerPods, shPods...)) - - testenv.VerifyLMConfiguredOnMC(ctx, deployment) + verifyLMConfiguredOnCluster(ctx, deployment, indexerPods) } +// deployMCAndVerifyRFSF deploys a Monitoring Console and verifies RF/SF is met. func deployMCAndVerifyRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, mcRef string) { _ = testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcRef, deployment.GetName()) testcaseEnvInst.VerifyRFSFMet(ctx, deployment) diff --git a/test/monitoring_console/monitoring_console_test.go b/test/monitoring_console/monitoring_console_test.go index 67104889b..702927551 100644 --- a/test/monitoring_console/monitoring_console_test.go +++ b/test/monitoring_console/monitoring_console_test.go @@ -27,6 +27,45 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) +// masterManagerMCConfigs defines the V3 (master) and V4 (manager) variants +// shared by the C3 reconfig and M4 MC reconfig test tables. +var masterManagerMCConfigs = []MCVersionConfig{ + { + MCReconfigParams: MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"}, + NamePrefix: "master", + Label: "mastermc", + DeployC3WithMC: func(ctx context.Context, d *testenv.Deployment, name string, replicas int, shc bool, mcRef string) error { + return d.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, name, replicas, shc, mcRef) + }, + DeployM4WithMC: func(ctx context.Context, d *testenv.Deployment, name string, replicas int, siteCount int, mcRef string, shc bool) error { + return d.DeployMultisiteClusterMasterWithMonitoringConsole(ctx, name, replicas, siteCount, mcRef, shc) + }, + NewCMObject: func() interface{} { return &enterpriseApiV3.ClusterMaster{} }, + VerifyCMReady: func(ctx context.Context, te *testenv.TestCaseEnv, d *testenv.Deployment) { + te.VerifyClusterMasterReady(ctx, d) + }, + SHCReconfigTimeout: 0, + VerifyMCTwoReadyAfterSHC: true, + }, + { + MCReconfigParams: MCReconfigParams{CMServiceNameFmt: testenv.ClusterManagerServiceName, CMURLKey: splcommon.ClusterManagerURL}, + NamePrefix: "", + Label: "managermc", + DeployC3WithMC: func(ctx context.Context, d *testenv.Deployment, name string, replicas int, shc bool, mcRef string) error { + return d.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, name, replicas, shc, mcRef) + }, + DeployM4WithMC: func(ctx context.Context, d *testenv.Deployment, name string, replicas int, siteCount int, mcRef string, shc bool) error { + return d.DeployMultisiteClusterWithMonitoringConsole(ctx, name, replicas, siteCount, mcRef, shc) + }, + NewCMObject: func() interface{} { return &enterpriseApi.ClusterManager{} }, + VerifyCMReady: func(ctx context.Context, te *testenv.TestCaseEnv, d *testenv.Deployment) { + te.VerifyClusterManagerReady(ctx, d) + }, + SHCReconfigTimeout: 5 * time.Minute, + VerifyMCTwoReadyAfterSHC: false, + }, +} + // Master (V3) Monitoring Console tests var _ = Describe("Monitoring Console test (master)", func() { @@ -102,11 +141,8 @@ var _ = Describe("Monitoring Console test (master)", func() { // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // wait for custom resource resource version to change and verify MC is ready + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Verify Standalone configured on Monitoring Console testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") @@ -116,171 +152,6 @@ var _ = Describe("Monitoring Console test (master)", func() { testcaseEnvInst.Log.Info("Verify MC configuration after Scale Up") testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, scaledSHReplicas, scaledIndexerReplicas, true) }) - - It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { - /* - Test Steps - 1. Deploy Single Site Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Monitoring Console Pod has peers in Peer string on MC Pod - --------------- RECONFIG CLUSTER MANAGER WITH NEW MC -------------------------- - 13. Reconfigure CM with Second MC - 14. Verify CM in config map of Second MC - 15. Create Second MC Pod - 16. Verify Indexers in second MC Pod - 17. Verify SHC not in second MC - 18. Verify SHC still present in first MC - 19. Verify CM and Indexers not in first MC Pod - ---------------- RECONFIG SHC WITH NEW MC - 20. Configure SHC with Second MC - 21. Verify CM, DEPLOYER, Search Heads in config map of second MC - 22. Verify SHC in second MC pod - 23. Verify Indexers in Second MC Pod - 24. Verify CM and Deployer not in first MC CONFIG MAP - 24. Verify SHC, Indexers not in first MC Pod - */ - - defaultSHReplicas := 3 - defaultIndexerReplicas := 3 - mcName := deployment.GetName() - - // Deploy Monitoring Console Pod - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") - - err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Master") - - // Ensure C3 cluster is ready - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterMasterReady) - - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - // Verify MC configuration for C3 cluster - testcaseEnvInst.VerifyMCConfigForC3Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, true) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Generate pod name slices for later verification - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) - - // ################# Update Monitoring Console In Cluster Master CR ################################## - - mcTwoName := deployment.GetName() + "-two" - cm := &enterpriseApiV3.ClusterMaster{} - testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) - - cm.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, cm) - - Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Ensure indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Deploy and verify Monitoring Console Two - mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### - masterParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"} - VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, true) - - // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### - VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, false) - - // ################# Update Monitoring Console In SHC CR ################################## - - // Update SHC to use 2nd Monitoring Console - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) - - // Ensure Search Head Cluster goes to Ready Phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) - - // ############################ VERIFICATOIN FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### - VerifyMCTwoAfterSHCReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, 0) - - // ############################ VERIFICATOIN FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### - VerifyMCOneAfterSHCReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, 0) - }) - }) - - Context("Multisite Clustered deployment (M4 - 3 Site Clustered Indexer, Search Head Cluster)", func() { - It("mastermc, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { - /* - Test Steps - 1. Deploy Multisite Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Indexers are configured in MC Config Map - 7. Verify Monitoring Console Pod has peers in Peer string on MC Pod - ############ CLUSTER MANAGER MC RECONFIG ################################# - 8. Configure Cluster Master to use 2nd Monitoring Console - 9. Verify Cluster Master is configured Config Maps of Second MC - 10. Deploy 2nd MC pod - 11. Verify Indexers in 2nd MC Pod - 12. Verify SHC not in 2nd MC CM - 13. Verify SHC not in 2nd MC Pod - 14. Verify Cluster Master not 1st MC Config Map - 15. Verify Indexers not in 1st MC Pod - */ - defaultSHReplicas := 3 - defaultIndexerReplicas := 1 - siteCount := 3 - mcName := deployment.GetName() - err := deployment.DeployMultisiteClusterMasterWithMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, siteCount, mcName, true) - Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with SHC") - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - - // Deploy and verify Monitoring Console - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // Verify MC configuration for M4 cluster - testcaseEnvInst.VerifyMCConfigForM4Cluster(ctx, deployment, deployment.GetName(), mcName, defaultSHReplicas, defaultIndexerReplicas, siteCount, true) - - // Generate pod name slices for later verification - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), defaultIndexerReplicas, true, siteCount) - - // ############ CLUSTER MANAGER MC RECONFIG ################################# - mcTwoName := deployment.GetName() + "-two" - // Update Cluster Manager to use 2nd Monitoring Console - cm := &enterpriseApiV3.ClusterMaster{} - testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) - - // Ensure that the cluster-master goes to Ready phase - testcaseEnvInst.VerifyClusterMasterReady(ctx, deployment) - - // Deploy and verify Monitoring Console Two - testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - masterParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterMasterServiceName, CMURLKey: "SPLUNK_CLUSTER_MASTER_URL"} - VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcTwoName, shPods, indexerPods, false) - VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, masterParams, mcName, mc, shPods, true) - - }) }) }) @@ -323,23 +194,14 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Create Standalone Spec and apply standaloneOneName := deployment.GetName() mcName := deployment.GetName() - spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) - standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") + standaloneOne := testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, standaloneOneName, mcName) - // Wait for standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standaloneOne) - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // wait for custom resource resource version to change and verify MC is ready + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Check Standalone is configured in MC - standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneOneName, 1, false, 0) testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") - verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, standaloneOneName, mcName, true) // ######################### RECONFIGURE STANDALONE WITH SECOND MC ####################################### @@ -349,7 +211,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { standaloneOne.Spec.MonitoringConsoleRef.Name = mcTwoName // Update Standalone with 2nd MC - err = deployment.UpdateCR(ctx, standaloneOne) + err := deployment.UpdateCR(ctx, standaloneOne) Expect(err).To(Succeed(), "Unable to update Standalone with new MC Name") // Deploy 2nd MC Pod @@ -357,14 +219,14 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Check Standalone is configured in MC Two testcaseEnvInst.Log.Info("Checking for Standalone on SECOND MC after Standalone RECONFIG") - verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcTwoName, true) + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, standaloneOneName, mcTwoName, true) // Verify Monitoring Console One is Ready and stays in ready state testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) // Check Standalone is NOT configured in MC One testcaseEnvInst.Log.Info("Checking for Standalone NOT ON FIRST MC after Standalone RECONFIG") - verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, false) + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, standaloneOneName, mcName, false) }) }) @@ -394,21 +256,14 @@ var _ = Describe("Monitoring Console test (manager)", func() { standaloneName := deployment.GetName() mcName := deployment.GetName() - spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) - - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneName, spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + standalone := testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, standaloneName, mcName) // Deploy MC and wait for MC to be READY mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") // Check Standalone is configured in MC - standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 1, false, 0) testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") - verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, standaloneName, mcName, true) // get revision number of the resource resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) @@ -421,7 +276,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { standalone.Spec.Replicas = int32(scaledReplicaCount) - err = deployment.UpdateCR(ctx, standalone) + err := deployment.UpdateCR(ctx, standalone) Expect(err).To(Succeed(), "Failed to scale Standalone") // Ensure standalone is scaling up @@ -430,13 +285,10 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Wait for Standalone to be in READY status testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify MC is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // wait for custom resource resource version to change and verify MC is ready + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - standalonePods = testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 2, false, 0) + standalonePods := testenv.GeneratePodNameSlice(testenv.StandalonePod, standaloneName, 2, false, 0) // Check both Standalone pods are configured in MC after scale up testcaseEnvInst.Log.Info("Checking for Standalone Pods on MC after scale up") @@ -510,12 +362,7 @@ var _ = Describe("Monitoring Console test (manager)", func() { resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, mc) // Deploy Standalone Pod - spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) - standalone, err := deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) // Ensure Indexer Cluster goes to Ready phase testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) @@ -524,16 +371,12 @@ var _ = Describe("Monitoring Console test (manager)", func() { // Adding this check in the end as SHC take the longest time to scale up due recycle of SHC members testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, mc, resourceVersion) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + // wait for custom resource resource version to change and verify MC is ready + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) // Check Standalone configured on Monitoring Console - standalonePods := []string{fmt.Sprintf(testenv.StandalonePod, deployment.GetName(), 0)} testcaseEnvInst.Log.Info("Checking for Standalone Pod on MC") - verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, true) + testcaseEnvInst.VerifyStandaloneInMC(ctx, deployment, deployment.GetName(), mcName, true) // Verify all Search Head Members are configured on Monitoring Console shPods = testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), scaledSHReplicas, false, 0) @@ -549,223 +392,56 @@ var _ = Describe("Monitoring Console test (manager)", func() { indexerPods = testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), scaledIndexerReplicas, false, 0) testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) }) + }) - It("managermc1, integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { - /* - Test Steps - 1. Deploy Single Site Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Monitoring Console Pod has peers in Peer string on MC Pod - --------------- RECONFIG CLUSTER MANAGER WITH NEW MC -------------------------- - 13. Reconfigure CM with Second MC - 14. Verify CM in config map of Second MC - 15. Create Second MC Pod - 16. Verify Indexers in second MC Pod - 17. Verify SHC not in second MC - 18. Verify SHC still present in first MC - 19. Verify CM and Indexers not in first MC Pod - ---------------- RECONFIG SHC WITH NEW MC - 20. Configure SHC with Second MC - 21. Verify CM, DEPLOYER, Search Heads in config map of second MC - 22. Verify SHC in second MC pod - 23. Verify Indexers in Second MC Pod - 24. Verify CM and Deployer not in first MC CONFIG MAP - 24. Verify SHC, Indexers not in first MC Pod - */ - - defaultSHReplicas := 3 - defaultIndexerReplicas := 3 - mcName := deployment.GetName() - - // Deploy Monitoring Console Pod - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") - - err := deployment.DeploySingleSiteClusterWithGivenMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, true, mcName) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Ensure C3 cluster is ready - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst.VerifyClusterManagerReady) - - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - // Check Cluster Manager in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, true) - - // Check Deployer in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Check Search Head Pods in Monitoring Console Config Map - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - // Verify Monitoring Console is Ready and stays in ready state - testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) - - // Wait for Monitoring console Pod to be configured with all search head - err = testcaseEnvInst.WaitForPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false, 5*time.Minute) - Expect(err).To(Succeed(), "Timed out waiting for search heads in MC config") - - // Check Monitoring console is configured with all Indexer in Name Space - indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) - - // ################# Update Monitoring Console In Cluster Manager CR ################################## - - mcTwoName := deployment.GetName() + "-two" - cm := &enterpriseApi.ClusterManager{} - testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") - - // get revision number of the resource - resourceVersion = testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) - - cm.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, cm) - - Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure indexers go to Ready phase - testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) - - // Deploy Monitoring Console Pod - testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") - - // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### - managerParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterManagerServiceName, CMURLKey: splcommon.ClusterManagerURL} - VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, true) - - // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### - VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, false) - - // ################# Update Monitoring Console In SHC CR ################################## - - // Get instance of current SHC CR with latest config - shc := &enterpriseApi.SearchHeadCluster{} - shcName := deployment.GetName() + "-shc" - testenv.GetInstanceWithExpect(ctx, deployment, shc, shcName, "Failed to get instance of Search Head Cluster") - - // Update SHC to use 2nd Monitoring Console - shc.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, shc) - Expect(err).To(Succeed(), "Failed to update Monitoring Console in Search Head Cluster CRD") - - // Ensure Search Head Cluster goes to Ready Phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Verify MC is Ready and stays in ready state - // testenv.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo, testcaseEnvInst) - - // ############################ VERIFICATION FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### - VerifyMCTwoAfterSHCReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, 5*time.Minute) - - // ############################ VERIFICATION FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### - VerifyMCOneAfterSHCReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, 5*time.Minute) + Context("Standalone deployment (S1)", func() { + It("managermc2, integration: can deploy a MC with standalone instance and update MC with new standalone deployment of similar names", func() { + RunS1StandaloneAddDeleteMCTest(ctx, deployment, testcaseEnvInst, "search-head-adhoc", "search-head") }) }) - Context("Multisite Clustered deployment (M4 - 3 Site Clustered Indexer, Search Head Cluster)", func() { - It("managermc2, integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { - /* - Test Steps - 1. Deploy Multisite Indexer Cluster - 2. Deploy Monitoring Console - 3. Wait for Monitoring Console status to go back to READY - 4. Verify SH are configured in MC Config Map - 5. Verify SH are configured in peer strings on MC Pod - 6. Verify Indexers are configured in MC Config Map - 7. Verify Monitoring Console Pod has peers in Peer string on MC Pod - ############ CLUSTER MANAGER MC RECONFIG ################################# - 8. Configure Cluster Manager to use 2nd Monitoring Console - 9. Verify Cluster Manager is configured Config Maps of Second MC - 10. Deploy 2nd MC pod - 11. Verify Indexers in 2nd MC Pod - 12. Verify SHC not in 2nd MC CM - 13. Verify SHC not in 2nd MC Pod - 14. Verify Cluster Manager not 1st MC Config Map - 15. Verify Indexers not in 1st MC Pod - */ - defaultSHReplicas := 3 - defaultIndexerReplicas := 1 - siteCount := 3 - mcName := deployment.GetName() - err := deployment.DeployMultisiteClusterWithMonitoringConsole(ctx, deployment.GetName(), defaultIndexerReplicas, siteCount, mcName, true) - Expect(err).To(Succeed(), "Unable to deploy Cluster Manager") - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) - - // Ensure indexers go to Ready phase - testcaseEnvInst.VerifyIndexersReady(ctx, deployment, siteCount) - - // Ensure indexer clustered is configured as multisite - testcaseEnvInst.VerifyIndexerClusterMultisiteStatus(ctx, deployment, siteCount) - - // Ensure search head cluster go to Ready phase - testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) - - // Check Cluster Manager in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.ClusterManagerServiceName, deployment.GetName())}, splcommon.ClusterManagerURL, mcName, true) - - // Check Deployer in Monitoring Console Config Map - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) - - // Deploy Monitoring Console Pod - mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") - - // Check Monitoring console is configured with all search head instances in namespace - shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC Config Map") - testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) - - testcaseEnvInst.Log.Info("Checking for Search Head on MC Pod") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) - - // Check Monitoring console is configured with all Indexer in Name Space - indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), 1, true, 3) - testcaseEnvInst.Log.Info("Checking for Indexer Pods on MC POD") - testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) - - // ############ CLUSTER MANAGER MC RECONFIG ################################# - mcTwoName := deployment.GetName() + "-two" - cm := &enterpriseApi.ClusterManager{} - testenv.GetInstanceWithExpect(ctx, deployment, cm, deployment.GetName(), "Failed to get instance of Cluster Manager") - - // get revision number of the resource - resourceVersion := testcaseEnvInst.GetResourceVersion(ctx, deployment, cm) - - cm.Spec.MonitoringConsoleRef.Name = mcTwoName - err = deployment.UpdateCR(ctx, cm) - Expect(err).To(Succeed(), "Failed to update mcRef in Cluster Manager") - - // wait for custom resource resource version to change - testcaseEnvInst.VerifyCustomResourceVersionChanged(ctx, deployment, cm, resourceVersion) - - // Ensure that the cluster-manager goes to Ready phase - testcaseEnvInst.VerifyClusterManagerReady(ctx, deployment) +}) - // Deploy Monitoring Console Pod - testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") +// C3 reconfig and M4 tests — V3 (master) and V4 (manager) variants +var _ = Describe("Monitoring Console reconfig tests", func() { - managerParams := MCReconfigParams{CMServiceNameFmt: testenv.ClusterManagerServiceName, CMURLKey: splcommon.ClusterManagerURL} - VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcTwoName, shPods, indexerPods, false) - VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, managerParams, mcName, mc, shPods, true) + var testcaseEnvInst *testenv.TestCaseEnv + var deployment *testenv.Deployment + ctx := context.TODO() + // C3 reconfig tests + for _, cfg := range masterManagerMCConfigs { + cfg := cfg + Context("Clustered deployment C3 reconfig ("+cfg.Label+")", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, cfg.NamePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(cfg.Label+", integration: MC can configure SHC, indexer instances and reconfigure to new MC", func() { + RunC3MCReconfigTest(ctx, deployment, testcaseEnvInst, cfg) + }) }) - }) - - Context("Standalone deployment (S1)", func() { - It("managermc2, integration: can deploy a MC with standalone instance and update MC with new standalone deployment of similar names", func() { - RunS1StandaloneAddDeleteMCTest(ctx, deployment, testcaseEnvInst, "search-head-adhoc", "search-head") + } + + // M4 reconfig tests + for _, cfg := range masterManagerMCConfigs { + cfg := cfg + Context("Multisite Clustered deployment M4 reconfig ("+cfg.Label+")", func() { + BeforeEach(func() { + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, cfg.NamePrefix) + }) + + AfterEach(func() { + testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) + }) + + It(cfg.Label+", integration: MC can configure SHC, indexer instances and reconfigure Cluster Manager to new Monitoring Console", func() { + RunM4MCReconfigTest(ctx, deployment, testcaseEnvInst, cfg) + }) }) - }) - + } }) diff --git a/test/monitoring_console/monitoring_console_test_shared.go b/test/monitoring_console/monitoring_console_test_shared.go index 7cf06c586..ce911a3e7 100644 --- a/test/monitoring_console/monitoring_console_test_shared.go +++ b/test/monitoring_console/monitoring_console_test_shared.go @@ -26,6 +26,159 @@ import ( "k8s.io/apimachinery/pkg/api/resource" ) +// MCVersionConfig captures the API-version-specific behaviour that differs +// between V3 (master) and V4 (manager) monitoring console tests. +type MCVersionConfig struct { + MCReconfigParams + + NamePrefix string + Label string + + // DeployC3WithMC deploys a C3 single-site cluster with the given MC ref. + DeployC3WithMC func(ctx context.Context, d *testenv.Deployment, name string, replicas int, shc bool, mcRef string) error + + // DeployM4WithMC deploys an M4 multisite cluster with the given MC ref. + DeployM4WithMC func(ctx context.Context, d *testenv.Deployment, name string, replicas int, siteCount int, mcRef string, shc bool) error + + // NewCMObject returns a new, empty cluster-coordinator CR + // (*ClusterMaster for V3, *ClusterManager for V4). + NewCMObject func() interface{} + + // VerifyCMReady asserts the cluster coordinator has reached Ready phase. + VerifyCMReady func(ctx context.Context, te *testenv.TestCaseEnv, d *testenv.Deployment) + + // SHCReconfigTimeout is the timeout used when verifying MC config strings + // after an SHC MC-ref reconfig (0 means use the synchronous check). + SHCReconfigTimeout time.Duration + + // VerifyMCTwoReadyAfterSHC controls whether MC Two is explicitly + // verified ready after the SHC reconfig step. + VerifyMCTwoReadyAfterSHC bool +} + +// verifyMCConfigForCluster verifies that the CM, deployer, search heads, and indexers +// are all correctly registered in the MC config map and pod config string. +// It uses the service name and URL key from the MCVersionConfig so it works for both V3 and V4. +func verifyMCConfigForCluster(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, + cfg MCVersionConfig, mcName string, shPods, indexerPods []string) { + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(cfg.CMServiceNameFmt, deployment.GetName())}, cfg.CMURLKey, mcName, true) + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, + []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, true) + testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, true) + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, true, false) + testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, true, true) +} + +// RunM4MCReconfigTest deploys an M4 multisite cluster with a Monitoring Console, +// verifies the MC configuration, then reconfigures the Cluster Manager to point +// to a second MC and verifies both MCs are updated correctly. +func RunM4MCReconfigTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, cfg MCVersionConfig) { + defaultSHReplicas := 3 + defaultIndexerReplicas := 1 + siteCount := 3 + mcName := deployment.GetName() + + err := cfg.DeployM4WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, siteCount, mcName, true) + Expect(err).To(Succeed(), "Unable to deploy multisite cluster") + + // Ensure cluster coordinator and all M4 components are ready + cfg.VerifyCMReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) + + // Deploy and verify Monitoring Console + mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") + + // Generate pod name slices for verification + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) + indexerPods := testenv.GeneratePodNameSlice(testenv.MultiSiteIndexerPod, deployment.GetName(), defaultIndexerReplicas, true, siteCount) + + // Verify MC configuration for M4 cluster + verifyMCConfigForCluster(ctx, deployment, testcaseEnvInst, cfg, mcName, shPods, indexerPods) + + // ############ CLUSTER MANAGER MC RECONFIG ################################# + mcTwoName := deployment.GetName() + "-two" + cm := cfg.NewCMObject() + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) + + cfg.VerifyCMReady(ctx, testcaseEnvInst, deployment) + + // Deploy and verify Monitoring Console Two + testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") + + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcTwoName, shPods, indexerPods, false) + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcName, mc, shPods, true) +} + +// RunC3MCReconfigTest deploys a C3 single-site cluster with a Monitoring Console, +// verifies the MC configuration, then reconfigures the Cluster Manager and SHC +// to point to a second MC and verifies both MCs are updated correctly. +func RunC3MCReconfigTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, cfg MCVersionConfig) { + defaultSHReplicas := 3 + defaultIndexerReplicas := 3 + mcName := deployment.GetName() + + // Deploy Monitoring Console Pod + mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), "") + + err := cfg.DeployC3WithMC(ctx, deployment, deployment.GetName(), defaultIndexerReplicas, true, mcName) + Expect(err).To(Succeed(), "Unable to deploy cluster") + + // Ensure C3 cluster is ready + testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx2 context.Context, d *testenv.Deployment) { + cfg.VerifyCMReady(ctx2, testcaseEnvInst, d) + }) + + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) + + // Generate pod name slices for verification + shPods := testenv.GeneratePodNameSlice(testenv.SearchHeadPod, deployment.GetName(), defaultSHReplicas, false, 0) + indexerPods := testenv.GeneratePodNameSlice(testenv.IndexerPod, deployment.GetName(), defaultIndexerReplicas, false, 0) + + // Verify MC configuration for C3 cluster + verifyMCConfigForCluster(ctx, deployment, testcaseEnvInst, cfg, mcName, shPods, indexerPods) + + // Verify Monitoring Console is Ready and stays in ready state + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, deployment.GetName(), mc) + + // ################# Update Monitoring Console In Cluster Manager CR ################################## + + mcTwoName := deployment.GetName() + "-two" + cm := cfg.NewCMObject() + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, cm, deployment.GetName(), mcTwoName) + + cfg.VerifyCMReady(ctx, testcaseEnvInst, deployment) + testcaseEnvInst.VerifySingleSiteIndexersReady(ctx, deployment) + + // Deploy and verify Monitoring Console Two + mcTwo := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, mcTwoName, "") + + // ########### VERIFY MONITORING CONSOLE TWO AFTER CLUSTER MANAGER RECONFIG ################################### + VerifyMCTwoAfterCMReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcTwoName, shPods, indexerPods, true) + + // ############## VERIFY MONITORING CONSOLE ONE AFTER CLUSTER MANAGER RECONFIG ####################### + VerifyMCOneAfterCMReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcName, mc, shPods, false) + + // ################# Update Monitoring Console In SHC CR ################################## + + shc := &enterpriseApi.SearchHeadCluster{} + shcName := deployment.GetName() + "-shc" + testenv.UpdateMonitoringConsoleRefAndVerify(ctx, deployment, testcaseEnvInst, shc, shcName, mcTwoName) + + // Ensure Search Head Cluster goes to Ready Phase + testcaseEnvInst.VerifySearchHeadClusterReady(ctx, deployment) + + if cfg.VerifyMCTwoReadyAfterSHC { + testcaseEnvInst.VerifyMonitoringConsoleReady(ctx, deployment, mcTwoName, mcTwo) + } + + // ############################ VERIFICATION FOR MONITORING CONSOLE TWO POST SHC RECONFIG ############################### + VerifyMCTwoAfterSHCReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcTwoName, shPods, indexerPods, cfg.SHCReconfigTimeout) + + // ############################ VERIFICATION FOR MONITORING CONSOLE ONE POST SHC RECONFIG ############################### + VerifyMCOneAfterSHCReconfig(ctx, deployment, testcaseEnvInst, cfg.MCReconfigParams, mcName, mc, shPods, cfg.SHCReconfigTimeout) +} + // RunS1StandaloneAddDeleteMCTest deploys two standalone instances with a Monitoring Console, // verifies both are registered, then deletes the second standalone and verifies the MC // config map and peer list are updated correctly. @@ -33,12 +186,7 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep mcName := deployment.GetName() // Deploy Standalone one with MCRef - spec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) - standaloneOne, err := deployment.DeployStandaloneWithGivenSpec(ctx, standaloneOneName, spec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance") - - // Wait for Standalone to be in READY Status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, standaloneOneName, standaloneOne) + testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, standaloneOneName, mcName) // Deploy MC and wait for MC to be READY mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") @@ -114,6 +262,8 @@ func RunS1StandaloneAddDeleteMCTest(ctx context.Context, deployment *testenv.Dep verifyStandaloneInMC(ctx, deployment, testcaseEnvInst, standalonePods, mcName, false) } +// verifyStandaloneInMC verifies that the given standalone pods are present (or absent) in the +// MC config map and pod config string. func verifyStandaloneInMC(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, pods []string, mcName string, shouldExist bool) { testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, pods, "SPLUNK_STANDALONE_URL", mcName, shouldExist) testcaseEnvInst.VerifyPodsInMCConfigString(ctx, deployment, pods, mcName, shouldExist, false) @@ -227,7 +377,7 @@ func VerifyMCOneAfterSHCReconfig(ctx context.Context, deployment *testenv.Deploy testcaseEnvInst.Log.Info("Verify Deployer NOT in MC One Config Map after SHC Reconfig") testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, - []string{fmt.Sprintf(params.CMServiceNameFmt, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, false) + []string{fmt.Sprintf(testenv.DeployerServiceName, deployment.GetName())}, "SPLUNK_DEPLOYER_URL", mcName, false) testcaseEnvInst.Log.Info("Verify SH Pods NOT in MC One Config Map after SHC Reconfig") testcaseEnvInst.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, false) diff --git a/test/secret/secret_test.go b/test/secret/secret_test.go index f2e6d01d7..34a32edd3 100644 --- a/test/secret/secret_test.go +++ b/test/secret/secret_test.go @@ -21,6 +21,13 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) +// masterManagerConfigs defines the V3 (master) and V4 (manager) variants +// shared by the C3 and M4 secret test tables. +var masterManagerConfigs = []testenv.MasterManagerTestConfig{ + {NamePrefix: "master", Label: "mastersecret", NewConfig: testenv.NewClusterReadinessConfigV3}, + {NamePrefix: "", Label: "managersecret", NewConfig: testenv.NewClusterReadinessConfigV4}, +} + var _ = Describe("Secret test", func() { var testcaseEnvInst *testenv.TestCaseEnv @@ -59,57 +66,39 @@ var _ = Describe("Secret test", func() { } // C3 tests — V3 (master) and V4 (manager) variants - c3SecretConfigs := []struct { - namePrefix string - label string - newConfig func() *testenv.ClusterReadinessConfig - }{ - {"master", "mastersecret", testenv.NewClusterReadinessConfigV3}, - {"", "managersecret", testenv.NewClusterReadinessConfigV4}, - } - - for _, tc := range c3SecretConfigs { + for _, tc := range masterManagerConfigs { tc := tc Context("Clustered deployment (C3 - Clustered Indexer, Search Head Cluster)", func() { BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", smoke, c3: secret update on Indexers and Search Head Cluster", func() { - config := tc.newConfig() + It(tc.Label+", smoke, c3: secret update on Indexers and Search Head Cluster", func() { + config := tc.NewConfig() RunC3SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) } // M4 tests — V3 (master) and V4 (manager) variants - m4SecretConfigs := []struct { - namePrefix string - label string - newConfig func() *testenv.ClusterReadinessConfig - }{ - {"master", "mastersecret", testenv.NewClusterReadinessConfigV3}, - {"", "managersecret", testenv.NewClusterReadinessConfigV4}, - } - - for _, tc := range m4SecretConfigs { + for _, tc := range masterManagerConfigs { tc := tc Context("Multisite cluster deployment (M4 - Multisite Indexer Cluster, Search Head Cluster)", func() { BeforeEach(func() { testenv.SpecifiedTestTimeout = 40000 - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration, m4: secret update on multisite Indexers and Search Head Cluster", func() { - config := tc.newConfig() + It(tc.Label+", integration, m4: secret update on multisite Indexers and Search Head Cluster", func() { + config := tc.NewConfig() RunM4SecretUpdateTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/secret/secret_test_shared.go b/test/secret/secret_test_shared.go index f575a401e..75bc62cb3 100644 --- a/test/secret/secret_test_shared.go +++ b/test/secret/secret_test_shared.go @@ -61,103 +61,92 @@ func verifyLMAndClusterManagerReady(ctx context.Context, deployment *testenv.Dep config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) } -// generateAndApplySecretUpdate creates randomized secret data and applies it to the namespace-scoped -// secret object, returning the updated data map for subsequent verification. -func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, namespaceScopedSecretName string) map[string][]byte { - modifiedHecToken := testenv.GetRandomHECToken() - modifiedValue := testenv.RandomDNSName(10) - updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) - err := testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) - Expect(err).To(Succeed(), "Unable to update secret Object") - return updatedSecretData +// s1WithLMSetup holds the resources created by setupS1WithLMAndMC so that +// individual test functions can operate on them without repeating the setup. +type s1WithLMSetup struct { + standalone *enterpriseApi.Standalone + mc *enterpriseApi.MonitoringConsole + resourceVersion string + namespaceScopedSecretName string } -// RunS1SecretUpdateTest runs the standard S1 secret update test workflow -func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { - // Download License File and create config map +// setupS1WithLMAndMC performs the common S1 setup shared by the secret-update +// and secret-delete tests: license config map, standalone with LM, MC, and +// initial secret verification. +func setupS1WithLMAndMC(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) s1WithLMSetup { testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - // Create standalone Deployment with License Manager mcRef := deployment.GetName() - var standalone *enterpriseApi.Standalone - var err error - - standalone, err = config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) + standalone, err := config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) - // Deploy and verify Monitoring Console mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) - // Get Current Secrets Struct namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) _, err = testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) Expect(err).To(Succeed(), "Unable to get secret struct") - // Update Secret Value on Secret Object - updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) + return s1WithLMSetup{ + standalone: standalone, + mc: mc, + resourceVersion: resourceVersion, + namespaceScopedSecretName: namespaceScopedSecretName, + } +} - // Ensure standalone is updating +// verifyS1SecretChangeApplied verifies that a secret change (update or delete) +// has been applied to the S1 stack: standalone enters Updating phase, LM and +// standalone return to Ready, MC version changes, and secrets are propagated. +func verifyS1SecretChangeApplied(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, setup s1WithLMSetup, secretData map[string][]byte, updated bool) { testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) + verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, setup.standalone) + testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, setup.mc, setup.resourceVersion) + verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretData, updated) +} - verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) +// generateAndApplySecretUpdate creates randomized secret data and applies it to the namespace-scoped +// secret object, returning the updated data map for subsequent verification. +func generateAndApplySecretUpdate(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, namespaceScopedSecretName string) map[string][]byte { + modifiedHecToken := testenv.GetRandomHECToken() + modifiedValue := testenv.RandomDNSName(10) + updatedSecretData := testenv.GetSecretDataMap(modifiedHecToken, modifiedValue, modifiedValue, modifiedValue, modifiedValue) + err := testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, updatedSecretData) + Expect(err).To(Succeed(), "Unable to update secret Object") + return updatedSecretData +} - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) +// RunS1SecretUpdateTest runs the standard S1 secret update test workflow +func RunS1SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { + setup := setupS1WithLMAndMC(ctx, deployment, testcaseEnvInst, config) - verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) + // Update Secret Value on Secret Object + updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, setup.namespaceScopedSecretName) + + verifyS1SecretChangeApplied(ctx, deployment, testcaseEnvInst, config, setup, updatedSecretData, true) } // RunS1SecretDeleteTest runs the standard S1 secret delete test workflow func RunS1SecretDeleteTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { - // Download License File and create config map - testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) - - // Create standalone Deployment with License Manager - mcRef := deployment.GetName() - var standalone *enterpriseApi.Standalone - var err error - - standalone, err = config.DeployStandaloneWithLM(ctx, deployment, deployment.GetName(), mcRef) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with LM") + setup := setupS1WithLMAndMC(ctx, deployment, testcaseEnvInst, config) - verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) - - // Deploy and verify Monitoring Console - mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) - - // Get Current Secrets Struct - namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) - secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + // Re-fetch secret struct so we can verify its data is restored after deletion + secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), setup.namespaceScopedSecretName) Expect(err).To(Succeed(), "Unable to get secret struct") // Delete Secret Object - err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), setup.namespaceScopedSecretName) Expect(err).To(Succeed(), "Unable to delete secret Object") - // Ensure standalone is updating - testcaseEnvInst.VerifyStandalonePhase(ctx, deployment, deployment.GetName(), enterpriseApi.PhaseUpdating) - - verifyLMAndStandaloneReady(ctx, deployment, testcaseEnvInst, config, standalone) - - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - verifySecretsPropagated(ctx, deployment, testcaseEnvInst, secretStruct.Data, false) + verifyS1SecretChangeApplied(ctx, deployment, testcaseEnvInst, config, setup, secretStruct.Data, false) } // RunS1SecretDeleteWithMCRefTest runs the S1 secret delete test with MC reference workflow func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { // Create standalone Deployment with MonitoringConsoleRef - var standalone *enterpriseApi.Standalone - var err error - mcName := deployment.GetName() - standaloneSpec := testenv.NewStandaloneSpecWithMCRef(testcaseEnvInst.GetSplunkImage(), mcName) - standalone, err = deployment.DeployStandaloneWithGivenSpec(ctx, deployment.GetName(), standaloneSpec) - Expect(err).To(Succeed(), "Unable to deploy standalone instance with MonitoringConsoleRef") - - // Wait for Standalone to be in READY status - testcaseEnvInst.VerifyStandaloneReady(ctx, deployment, deployment.GetName(), standalone) + standalone := testcaseEnvInst.DeployStandaloneWithMCRef(ctx, deployment, deployment.GetName(), mcName) // Deploy and verify Monitoring Console mc := testcaseEnvInst.DeployAndVerifyMonitoringConsole(ctx, deployment, deployment.GetName(), "") @@ -168,10 +157,11 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // Get Current Secrets Struct namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) secretStruct, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + testcaseEnvInst.Log.Info("Data in secret object", "data", secretStruct.Data) Expect(err).To(Succeed(), "Unable to get secret struct") - // Delete Secret Object - err = testenv.DeleteSecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) + // Delete secret by passing empty Data Map + err = testenv.ModifySecretObject(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName, map[string][]byte{}) Expect(err).To(Succeed(), "Unable to delete secret Object") // Ensure standalone is updating @@ -187,7 +177,7 @@ func RunS1SecretDeleteWithMCRefTest(ctx context.Context, deployment *testenv.Dep // RunC3SecretUpdateTest runs the standard C3 secret update test workflow func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { - // Download License File and create config map + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) mcRef := deployment.GetName() @@ -195,16 +185,9 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, Expect(err).To(Succeed(), "Unable to deploy cluster") config.LicenseManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *testenv.Deployment) { - config.ClusterManagerReady(ctx, d, testcaseEnvInst) - }) + config.VerifyC3ClusterReady(ctx, deployment, testcaseEnvInst) - mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) - - // Update Secret Value on Secret Object - updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) - - config.VerifyClusterManagerPhaseUpdating(ctx, deployment, testcaseEnvInst) + mc, resourceVersion, updatedSecretData := applySecretUpdateAndVerifyCMUpdating(ctx, deployment, testcaseEnvInst, config) verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) @@ -224,55 +207,54 @@ func RunC3SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, err = testcaseEnvInst.WaitForPasswordSyncCompleted(ctx, deployment, testcaseEnvInst.GetName(), idxcName, 2*time.Minute) Expect(err).To(Succeed(), "Timed out waiting for PasswordSyncCompleted event on IndexerCluster") + verifyPostSecretChangeCluster(ctx, deployment, testcaseEnvInst, mc, resourceVersion, updatedSecretData) +} + +// verifyPostSecretChangeCluster performs the common tail verification after a +// secret change on a clustered deployment: MC version changed, RF/SF met, and +// secrets propagated to all pods. +func verifyPostSecretChangeCluster(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, mc *enterpriseApi.MonitoringConsole, resourceVersion string, updatedSecretData map[string][]byte) { testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - // Verify RF SF is met testcaseEnvInst.Log.Info("Checking RF SF after secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) } -func deployMCAndVerifyInitialSecret(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv) (*enterpriseApi.MonitoringConsole, string, string) { +// applySecretUpdateAndVerifyCMUpdating deploys MC, verifies RF/SF and initial secret state, +// applies a secret update, and confirms the Cluster Manager enters the Updating phase. +// Returns the MC, its resource version, and the updated secret data for post-change verification. +func applySecretUpdateAndVerifyCMUpdating(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) (*enterpriseApi.MonitoringConsole, string, map[string][]byte) { mc, resourceVersion := testcaseEnvInst.DeployMCAndGetVersion(ctx, deployment, deployment.GetName(), deployment.GetName()) testcaseEnvInst.Log.Info("Checking RF SF before secret change") testcaseEnvInst.VerifyRFSFMet(ctx, deployment) namespaceScopedSecretName := fmt.Sprintf(testenv.NamespaceScopedSecretObjectName, testcaseEnvInst.GetName()) _, err := testenv.GetSecretStruct(ctx, deployment, testcaseEnvInst.GetName(), namespaceScopedSecretName) Expect(err).To(Succeed(), "Unable to get secret struct") - return mc, resourceVersion, namespaceScopedSecretName + updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) + config.VerifyClusterManagerPhaseUpdating(ctx, deployment, testcaseEnvInst) + return mc, resourceVersion, updatedSecretData } // RunM4SecretUpdateTest runs the standard M4 secret update test workflow func RunM4SecretUpdateTest(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig) { - // Download License File and create config map + // Set up license config map testenv.SetupLicenseConfigMap(ctx, testcaseEnvInst) siteCount := 3 mcName := deployment.GetName() - var err error - err = config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcName) + err := config.DeployMultisiteCluster(ctx, deployment, deployment.GetName(), 1, siteCount, mcName) Expect(err).To(Succeed(), "Unable to deploy cluster") verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - mc, resourceVersion, namespaceScopedSecretName := deployMCAndVerifyInitialSecret(ctx, deployment, testcaseEnvInst) - - // Update Secret Value on Secret Object - updatedSecretData := generateAndApplySecretUpdate(ctx, deployment, testcaseEnvInst, namespaceScopedSecretName) - - config.VerifyClusterManagerPhaseUpdating(ctx, deployment, testcaseEnvInst) + mc, resourceVersion, updatedSecretData := applySecretUpdateAndVerifyCMUpdating(ctx, deployment, testcaseEnvInst, config) verifyLMAndClusterManagerReady(ctx, deployment, testcaseEnvInst, config) testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) - testcaseEnvInst.VerifyMCVersionChangedAndReady(ctx, deployment, mc, resourceVersion) - - // Verify RF SF is met - testcaseEnvInst.Log.Info("Checking RF SF after secret change") - testcaseEnvInst.VerifyRFSFMet(ctx, deployment) - - verifySecretsPropagated(ctx, deployment, testcaseEnvInst, updatedSecretData, true) + verifyPostSecretChangeCluster(ctx, deployment, testcaseEnvInst, mc, resourceVersion, updatedSecretData) } diff --git a/test/smartstore/smartstore_test.go b/test/smartstore/smartstore_test.go index d9a7a7148..f9f598dde 100644 --- a/test/smartstore/smartstore_test.go +++ b/test/smartstore/smartstore_test.go @@ -23,53 +23,57 @@ import ( "github.com/splunk/splunk-operator/test/testenv" ) +// smartstoreTestConfig extends MasterManagerTestConfig with a per-variant +// timeout used by the S1 multiple-indexes test. +type smartstoreTestConfig struct { + testenv.MasterManagerTestConfig + S1IndexesTimeout time.Duration +} + +// masterManagerSmartstoreConfigs defines the V3 (master) and V4 (manager) variants +// shared by the S1 and M4 smartstore test tables. +var masterManagerSmartstoreConfigs = []smartstoreTestConfig{ + {testenv.MasterManagerTestConfig{NamePrefix: "master", Label: "mastersmartstore", NewConfig: testenv.NewClusterReadinessConfigV3}, 2 * time.Minute}, + {testenv.MasterManagerTestConfig{NamePrefix: "", Label: "managersmartstore", NewConfig: testenv.NewClusterReadinessConfigV4}, 5 * time.Minute}, +} + var _ = Describe("Smartstore test", func() { var testcaseEnvInst *testenv.TestCaseEnv var deployment *testenv.Deployment ctx := context.TODO() - smartstoreConfigs := []struct { - namePrefix string - label string - s1IndexesTimeout time.Duration - newConfig func() *testenv.ClusterReadinessConfig - }{ - {"master", "mastersmartstore", 2 * time.Minute, testenv.NewClusterReadinessConfigV3}, - {"", "managersmartstore", 5 * time.Minute, testenv.NewClusterReadinessConfigV4}, - } - - for _, tc := range smartstoreConfigs { + for _, tc := range masterManagerSmartstoreConfigs { tc := tc Context("Standalone deployment (S1)", func() { BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", integration: Can configure multiple indexes through app", func() { - RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, tc.s1IndexesTimeout) + It(tc.Label+", integration: Can configure multiple indexes through app", func() { + RunS1MultipleIndexesTest(ctx, deployment, testcaseEnvInst, tc.S1IndexesTimeout) }) - It(tc.label+", integration: Can configure indexes which use default volumes through app", func() { + It(tc.Label+", integration: Can configure indexes which use default volumes through app", func() { RunS1DefaultVolumesTest(ctx, deployment, testcaseEnvInst) }) }) Context("Multisite Indexer Cluster with Search Head Cluster (M4)", func() { BeforeEach(func() { - testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.namePrefix) + testcaseEnvInst, deployment = testenv.SetupTestCaseEnv(testenvInstance, tc.NamePrefix) }) AfterEach(func() { testenv.TeardownTestCaseEnv(testcaseEnvInst, deployment) }) - It(tc.label+", m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { - config := tc.newConfig() + It(tc.Label+", m4, integration: Can configure indexes and volumes on Multisite Indexer Cluster through app", func() { + config := tc.NewConfig() RunM4MultisiteSmartStoreTest(ctx, deployment, testcaseEnvInst, config) }) }) diff --git a/test/smartstore/smartstore_test_shared.go b/test/smartstore/smartstore_test_shared.go index 17d1d2eb7..ca5981a2c 100644 --- a/test/smartstore/smartstore_test_shared.go +++ b/test/smartstore/smartstore_test_shared.go @@ -170,7 +170,8 @@ func RunS1EphemeralStorageTest(ctx context.Context, deployment *testenv.Deployme // verifyM4ClusterAndRFSF verifies cluster manager and multisite cluster are ready and RF/SF is met. func verifyM4ClusterAndRFSF(ctx context.Context, deployment *testenv.Deployment, testcaseEnvInst *testenv.TestCaseEnv, config *testenv.ClusterReadinessConfig, siteCount int) { config.ClusterManagerReady(ctx, deployment, testcaseEnvInst) - testcaseEnvInst.VerifyMultisiteClusterReadyAndRFSF(ctx, deployment, siteCount) + testcaseEnvInst.VerifyM4ComponentsReady(ctx, deployment, siteCount) + testcaseEnvInst.VerifyRFSFMet(ctx, deployment) } // RunM4MultisiteSmartStoreTest runs the standard M4 multisite SmartStore test workflow @@ -186,9 +187,7 @@ func RunM4MultisiteSmartStoreTest(ctx context.Context, deployment *testenv.Deplo } siteCount := 3 - var err error - - err = config.DeployMultisiteClusterWithIndexes(ctx, deployment, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) + err := config.DeployMultisiteClusterWithIndexes(ctx, deployment, deployment.GetName(), 1, siteCount, testcaseEnvInst.GetIndexSecretName(), smartStoreSpec) Expect(err).To(Succeed(), "Unable to deploy cluster") verifyM4ClusterAndRFSF(ctx, deployment, testcaseEnvInst, config, siteCount) diff --git a/test/testenv/assertion_helpers.go b/test/testenv/assertion_helpers.go index c274a5dc4..c69a92b12 100644 --- a/test/testenv/assertion_helpers.go +++ b/test/testenv/assertion_helpers.go @@ -19,6 +19,7 @@ import ( "fmt" . "github.com/onsi/gomega" + enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3" enterpriseApi "github.com/splunk/splunk-operator/api/v4" corev1 "k8s.io/api/core/v1" ) @@ -66,6 +67,10 @@ func UpdateMonitoringConsoleRefAndVerify(ctx context.Context, deployment *Deploy GetInstanceWithExpect(ctx, deployment, cr, instanceName, "Failed to get instance") cr.Spec.MonitoringConsoleRef.Name = newMCName UpdateCRWithExpect(ctx, deployment, cr, "Failed to update MonitoringConsoleRef") + case *enterpriseApiV3.ClusterMaster: + GetInstanceWithExpect(ctx, deployment, cr, instanceName, "Failed to get instance") + cr.Spec.MonitoringConsoleRef.Name = newMCName + UpdateCRWithExpect(ctx, deployment, cr, "Failed to update MonitoringConsoleRef") case *enterpriseApi.SearchHeadCluster: GetInstanceWithExpect(ctx, deployment, cr, instanceName, "Failed to get instance") cr.Spec.MonitoringConsoleRef.Name = newMCName @@ -96,26 +101,6 @@ func (testcaseenv *TestCaseEnv) VerifyMCConfigForC3Cluster(ctx context.Context, testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, shouldExist, true) } -// VerifyMCConfigForM4Cluster verifies the standard MC configuration for an M4 multisite cluster -func (testcaseenv *TestCaseEnv) VerifyMCConfigForM4Cluster(ctx context.Context, deployment *Deployment, deploymentName string, mcName string, shReplicas int, indexerReplicas int, siteCount int, shouldExist bool) { - // Check cluster manager in MC Config Map - testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(ClusterMasterServiceName, deploymentName)}, "SPLUNK_CLUSTER_MASTER_URL", mcName, shouldExist) - - // Check deployer in MC Config Map - testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, []string{fmt.Sprintf(DeployerServiceName, deploymentName)}, "SPLUNK_DEPLOYER_URL", mcName, shouldExist) - - // Check Search Head Pods in MC Config Map - shPods := GeneratePodNameSlice(SearchHeadPod, deploymentName, shReplicas, false, 0) - testcaseenv.VerifyPodsInMCConfigMap(ctx, deployment, shPods, "SPLUNK_SEARCH_HEAD_URL", mcName, shouldExist) - - // Check Search Heads in MC Pod config string - testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, shPods, mcName, shouldExist, false) - - // Check Indexers in MC Pod config string - indexerPods := GeneratePodNameSlice(MultiSiteIndexerPod, deploymentName, indexerReplicas, true, siteCount) - testcaseenv.VerifyPodsInMCConfigString(ctx, deployment, indexerPods, mcName, shouldExist, true) -} - // DeployAndVerifyC3WithMC deploys a C3 cluster with a given MC and verifies all components are ready func (testcaseenv *TestCaseEnv) DeployAndVerifyC3WithMC(ctx context.Context, deployment *Deployment, deploymentName string, indexerReplicas int, mcName string) { err := deployment.DeploySingleSiteClusterMasterWithGivenMonitoringConsole(ctx, deploymentName, indexerReplicas, true, mcName) diff --git a/test/testenv/common_test_patterns.go b/test/testenv/common_test_patterns.go index 6c2aa043a..05453692b 100644 --- a/test/testenv/common_test_patterns.go +++ b/test/testenv/common_test_patterns.go @@ -33,6 +33,16 @@ type ClusterReadinessConfig struct { APIVersion string } +// MasterManagerTestConfig pairs a name prefix and test label with a factory +// function that returns the appropriate ClusterReadinessConfig. +// This is the standard config type shared by test packages that loop over +// V3 (master) and V4 (manager) variants. +type MasterManagerTestConfig struct { + NamePrefix string + Label string + NewConfig func() *ClusterReadinessConfig +} + // NewClusterReadinessConfigV3 creates a ClusterReadinessConfig for v3 API (LicenseMaster/ClusterMaster) func NewClusterReadinessConfigV3() *ClusterReadinessConfig { return &ClusterReadinessConfig{ @@ -77,6 +87,13 @@ func (c *ClusterReadinessConfig) DeployMultisiteCluster(ctx context.Context, dep return deployment.DeployMultisiteClusterWithSearchHead(ctx, name, indexerReplicas, siteCount, mcRef) } +// VerifyC3ClusterReady verifies the C3 cluster is ready using the config's ClusterManagerReady callback. +func (c *ClusterReadinessConfig) VerifyC3ClusterReady(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { + testcaseEnv.VerifyC3ClusterReady(ctx, deployment, func(ctx context.Context, d *Deployment) { + c.ClusterManagerReady(ctx, d, testcaseEnv) + }) +} + // VerifyClusterManagerPhaseUpdating asserts the Cluster Manager (or ClusterMaster for v3) // has entered the Updating phase. func (c *ClusterReadinessConfig) VerifyClusterManagerPhaseUpdating(ctx context.Context, deployment *Deployment, testcaseEnv *TestCaseEnv) { diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index 93f114406..baddffc17 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -72,10 +72,8 @@ func NewDefaultTestCaseEnv(kubeClient client.Client, name string) (*TestCaseEnv, // NewTestCaseEnv creates a new test environment to run tests againsts func NewTestCaseEnv(kubeClient client.Client, name string, operatorImage string, splunkImage string, licenseFilePath string) (*TestCaseEnv, error) { - var envName string - // The name are used in various resource label and there is a 63 char limit. Do our part to make sure we do not exceed that limit - if len(envName) > 24 { + if len(name) > 24 { return nil, fmt.Errorf("name %s has exceeded 24 chars", name) }