Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions test/c3/appframework/appframework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package c3appfw

import (
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -724,4 +725,158 @@ var _ = Describe("c3appfw test", func() {
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), clusterPodNames, appListCluster, true, "enabled", false, true)
})
})

Context("Single Site Indexer Cluster with SHC (C3) with App Framework", func() {
It("integration, c3, appframework: can deploy a C3 SVA with App Framework enabled for manual update", func() {

// Create App framework Spec
volumeName := "appframework-test-volume-" + testenv.RandomDNSName(3)
volumeSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volumeName, testenv.GetS3Endpoint(), testenvInstance.GetIndexSecretName(), "aws", "s3")}

// AppSourceDefaultSpec: Remote Storage volume name and Scope of App deployment
appSourceDefaultSpec := enterpriseApi.AppSourceDefaultSpec{
VolName: volumeName,
Scope: enterpriseApi.ScopeCluster,
}

// appSourceSpec: App source name, location and volume name and scope from appSourceDefaultSpec
appSourceName := "appframework" + testenv.RandomDNSName(3)
appSourceSpec := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceName, s3TestDir, appSourceDefaultSpec)}

// appFrameworkSpec: AppSource settings, Poll Interval, volumes, appSources on volumes
appFrameworkSpec := enterpriseApi.AppFrameworkSpec{
Defaults: appSourceDefaultSpec,
AppsRepoPollInterval: 0,
VolList: volumeSpec,
AppSources: appSourceSpec,
}

indexerReplicas := 3

testenvInstance.Log.Info("Deploy Single Site Indexer Cluster")
err := deployment.DeploySingleSiteClusterWithGivenAppFrameworkSpec(deployment.GetName(), indexerReplicas, true, appFrameworkSpec, 10)
Expect(err).To(Succeed(), "Unable to deploy Single Site Indexer Cluster with App framework")

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure indexers go to Ready phase
testenv.SingleSiteIndexersReady(deployment, testenvInstance)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify MC Pod is Ready
testenv.MCPodReady(testenvInstance.GetName(), deployment)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

// Verify Apps are downloaded by init-container
initContDownloadLocation := "/init-apps/" + appSourceName
podNames := []string{fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName()), fmt.Sprintf(testenv.DeployerPod, deployment.GetName())}
appFileList := testenv.GetAppFileList(appListV1, 1)
appVersion := "V1"
testenvInstance.Log.Info("Verify Apps are downloaded by init container for apps", "version", appVersion)
testenv.VerifyAppsDownloadedByInitContainer(deployment, testenvInstance, testenvInstance.GetName(), podNames, appFileList, initContDownloadLocation)

//Verify Apps are copied to location
allPodNames := testenv.DumpGetPods(testenvInstance.GetName())
testenvInstance.Log.Info("Verify Apps are copied to correct location based on Pod KIND for app", "version", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, true)

// Verify apps are not copied in /etc/apps/ on CM and on Deployer (therefore not installed on Deployer and on CM)
testenvInstance.Log.Info("Verify Apps are NOT copied to /etc/apps on CM and Deployer for app", "verison", appVersion, "App List", appFileList)
masterPodNames := []string{fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName()), fmt.Sprintf(testenv.DeployerPod, deployment.GetName())}
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), masterPodNames, appListV1, false, false)

//Verify Apps are installed
testenvInstance.Log.Info("Verify Apps are installed on the pods by running Splunk CLI commands for app", "version", appVersion)
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, "enabled", false, true)

//Delete apps on S3 for new Apps
testenvInstance.Log.Info("Delete Apps on S3 for", "Version", appVersion)
testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps)
uploadedApps = nil

//Upload new Versioned Apps to S3
appFileList = testenv.GetAppFileList(appListV2, 2)
appVersion = "V2"
testenvInstance.Log.Info("Uploading apps S3 for", "Verison", appVersion)
uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDir, appFileList, downloadDirV2)
Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory")
uploadedApps = append(uploadedApps, uploadedFiles...)

// Wait for the poll period for the apps to be downloaded
time.Sleep(2 * time.Minute)

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure indexers go to Ready phase
testenv.SingleSiteIndexersReady(deployment, testenvInstance)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify MC Pod is Ready
testenv.MCPodReady(testenvInstance.GetName(), deployment)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

//Verify Apps are not updated
testenvInstance.Log.Info("Verify Apps are installed on the pods by running Splunk CLI commands for app", "version", appVersion)
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, "enabled", false, true)

testenvInstance.Log.Info("Get config map for triggering manual update")
config, err := testenv.GetAppframeworkManualUpdateConfigMap(deployment, testenvInstance.GetName())
Expect(err).To(Succeed(), "Unable to get config map for manual poll")

testenvInstance.Log.Info("Modify config map to trigger manual update")
config.Data["ClusterMaster"] = strings.Replace(config.Data["ClusterMaster"], "off", "on", 1)
config.Data["SearchHeadCluster"] = strings.Replace(config.Data["SearchHeadCluster"], "off", "on", 1)
err = deployment.UpdateCR(config)
Expect(err).To(Succeed(), "Unable to update config map")

// Ensure standalone is updating
testenv.VerifyClusterMasterPhase(deployment, testenvInstance, splcommon.PhaseUpdating)

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure indexers go to Ready phase
testenv.SingleSiteIndexersReady(deployment, testenvInstance)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify MC Pod is Ready
testenv.MCPodReady(testenvInstance.GetName(), deployment)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

//Verify config map set back to off after poll trigger
testenvInstance.Log.Info("Verify config map set back to off after poll trigger for app", "version", appVersion)
config, _ = testenv.GetAppframeworkManualUpdateConfigMap(deployment, testenvInstance.GetName())
Expect(strings.Contains(config.Data["ClusterMaster"], "status: off") && strings.Contains(config.Data["SearchHeadCluster"], "status: off")).To(Equal(true), "Config map update not complete")

// Verify Apps are downloaded by init-container
testenvInstance.Log.Info("Verify Apps are downloaded by init container for apps", "version", appVersion)
testenv.VerifyAppsDownloadedByInitContainer(deployment, testenvInstance, testenvInstance.GetName(), podNames, appFileList, initContDownloadLocation)

//Verify Apps are copied to location
testenvInstance.Log.Info("Verify Apps are copied to correct location based on Pod KIND for app", "version", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV2, true, true)

// Verify apps are not copied in /etc/apps/ on CM and on Deployer (therefore not installed on Deployer and on CM)
testenvInstance.Log.Info("Verify Apps are NOT copied to /etc/apps on CM and Deployer for app", "verison", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), masterPodNames, appListV2, false, false)

//Verify Apps are updated
testenvInstance.Log.Info("Verify Apps are installed on the pods by running Splunk CLI commands for app", "version", appVersion)
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV2, true, "enabled", true, true)
})
})
})
155 changes: 155 additions & 0 deletions test/m4/appframework/appframework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package m4appfw

import (
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -367,4 +368,158 @@ var _ = Describe("m4appfw test", func() {
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), podNames, appListV2, false, true)
})
})

Context("Multi Site Indexer Cluster with SHC (m4) with App Framework", func() {
It("integration, m4, appframework: can deploy a M4 SVA with App Framework enabled for manual poll", func() {

// Create App framework Spec
volumeName := "appframework-test-volume-" + testenv.RandomDNSName(3)
volumeSpec := []enterpriseApi.VolumeSpec{testenv.GenerateIndexVolumeSpec(volumeName, testenv.GetS3Endpoint(), testenvInstance.GetIndexSecretName(), "aws", "s3")}

// AppSourceDefaultSpec: Remote Storage volume name and Scope of App deployment
appSourceDefaultSpec := enterpriseApi.AppSourceDefaultSpec{
VolName: volumeName,
Scope: enterpriseApi.ScopeCluster,
}

// appSourceSpec: App source name, location and volume name and scope from appSourceDefaultSpec
appSourceName := "appframework" + testenv.RandomDNSName(3)
appSourceSpec := []enterpriseApi.AppSourceSpec{testenv.GenerateAppSourceSpec(appSourceName, s3TestDir, appSourceDefaultSpec)}

// appFrameworkSpec: AppSource settings, Poll Interval, volumes, appSources on volumes
appFrameworkSpec := enterpriseApi.AppFrameworkSpec{
Defaults: appSourceDefaultSpec,
AppsRepoPollInterval: 0,
VolList: volumeSpec,
AppSources: appSourceSpec,
}

siteCount := 3
indexersPerSite := 1

testenvInstance.Log.Info("Deploy Multisite Indexer Cluster")
err := deployment.DeployMultisiteClusterWithSearchHeadAndAppFramework(deployment.GetName(), indexersPerSite, siteCount, appFrameworkSpec, true, 10)
Expect(err).To(Succeed(), "Unable to deploy Multi Site Indexer Cluster with App framework")

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure the indexers of all sites go to Ready phase
testenv.IndexersReady(deployment, testenvInstance, siteCount)

// Ensure cluster configured as multisite
testenv.IndexerClusterMultisiteStatus(deployment, testenvInstance, siteCount)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

// Verify Apps are downloaded by init-container
appVersion := "V1"
initContDownloadLocation := "/init-apps/" + appSourceName
podNames := []string{fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName()), fmt.Sprintf(testenv.DeployerPod, deployment.GetName())}
appFileList := testenv.GetAppFileList(appListV1, 1)
testenvInstance.Log.Info("Verify Apps are downloaded by init container for apps", "version", appVersion)
testenv.VerifyAppsDownloadedByInitContainer(deployment, testenvInstance, testenvInstance.GetName(), podNames, appFileList, initContDownloadLocation)

//Verify Apps are copied to location
allPodNames := testenv.DumpGetPods(testenvInstance.GetName())
testenvInstance.Log.Info("Verify Apps are copied to correct location based on Pod KIND for app", "version", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, true)

// Verify apps are not copied in /etc/apps/ on CM and on Deployer (therefore not installed on Deployer and on CM)
masterPodNames := []string{fmt.Sprintf(testenv.ClusterMasterPod, deployment.GetName()), fmt.Sprintf(testenv.DeployerPod, deployment.GetName())}
testenvInstance.Log.Info("Verify Apps are NOT copied to /etc/apps on CM and Deployer for app", "verison", appVersion, "App List", appFileList)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), masterPodNames, appListV1, false, false)

//Verify Apps are installed cluster-wide
testenvInstance.Log.Info("Verify Apps are installed on the pods by runnign Splunk CLI commands for app", "version", appVersion)
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, "enabled", false, true)

//Delete apps on S3 for new Apps
testenvInstance.Log.Info("Delete Apps on S3 for Version", appVersion)
testenv.DeleteFilesOnS3(testS3Bucket, uploadedApps)
uploadedApps = nil

//Upload new Versioned Apps to S3
appFileList = testenv.GetAppFileList(appListV2, 2)
appVersion = "V2"
testenvInstance.Log.Info("Uploading apps S3 for", "verison", appVersion)
uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDir, appFileList, downloadDirV2)
Expect(err).To(Succeed(), "Unable to upload apps to S3 test directory")
uploadedApps = append(uploadedApps, uploadedFiles...)

// Wait for the poll period for the apps to be downloaded
time.Sleep(2 * time.Minute)

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure the indexers of all sites go to Ready phase
testenv.IndexersReady(deployment, testenvInstance, siteCount)

// Ensure cluster configured as multisite
testenv.IndexerClusterMultisiteStatus(deployment, testenvInstance, siteCount)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

//Verify Apps are not updated cluster-wide
testenvInstance.Log.Info("Verify Apps are not updated on the pods by running Splunk CLI commands for app", "version", appVersion)
testenv.VerifyAppInstalled(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV1, true, "enabled", false, true)

testenvInstance.Log.Info("Get config map for triggering manual update")
config, err := testenv.GetAppframeworkManualUpdateConfigMap(deployment, testenvInstance.GetName())
Expect(err).To(Succeed(), "Unable to get config map for manual poll")

testenvInstance.Log.Info("Modify config map to trigger manual update")
config.Data["ClusterMaster"] = strings.Replace(config.Data["ClusterMaster"], "off", "on", 1)
config.Data["SearchHeadCluster"] = strings.Replace(config.Data["SearchHeadCluster"], "off", "on", 1)
err = deployment.UpdateCR(config)
Expect(err).To(Succeed(), "Unable to update config map")

// Ensure standalone is updating
testenv.VerifyClusterMasterPhase(deployment, testenvInstance, splcommon.PhaseUpdating)

// Ensure that the cluster-master goes to Ready phase
testenv.ClusterMasterReady(deployment, testenvInstance)

// Ensure the indexers of all sites go to Ready phase
testenv.IndexersReady(deployment, testenvInstance, siteCount)

// Ensure cluster configured as multisite
testenv.IndexerClusterMultisiteStatus(deployment, testenvInstance, siteCount)

// Ensure search head cluster go to Ready phase
testenv.SearchHeadClusterReady(deployment, testenvInstance)

// Verify RF SF is met
testenv.VerifyRFSFMet(deployment, testenvInstance)

//Verify config map set back to off after poll trigger
testenvInstance.Log.Info("Verify config map set back to off after poll trigger for app", "version", appVersion)
config, _ = testenv.GetAppframeworkManualUpdateConfigMap(deployment, testenvInstance.GetName())
Expect(strings.Contains(config.Data["ClusterMaster"], "status: off") && strings.Contains(config.Data["SearchHeadCluster"], "status: off")).To(Equal(true), "Config map update not complete")

// Verify Apps are downloaded by init-container
testenvInstance.Log.Info("Verify Apps are downloaded by init container for apps", "version", appVersion)
testenv.VerifyAppsDownloadedByInitContainer(deployment, testenvInstance, testenvInstance.GetName(), podNames, appFileList, initContDownloadLocation)

//Verify Apps are copied to location
testenvInstance.Log.Info("Verify Apps are copied to correct location based on Pod KIND for app", "version", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), allPodNames, appListV2, true, true)

// Verify apps are not copied in /etc/apps/ on CM and on Deployer (therefore not installed on Deployer and on CM)
testenvInstance.Log.Info("Verify Apps are NOT copied to /etc/apps on CM and Deployer for app", "verison", appVersion)
testenv.VerifyAppsCopied(deployment, testenvInstance, testenvInstance.GetName(), masterPodNames, appListV2, false, false)

//Verify Apps are installed cluster-wide
testenvInstance.Log.Info("Verify Apps are installed on the pods by running Splunk CLI commands for app", "version", appVersion)
})
})
})
Loading