Skip to content

Commit e42a70b

Browse files
Modified GetoperatorPodName to take into consideration clusterwide install
1 parent 813c894 commit e42a70b

File tree

7 files changed

+47
-64
lines changed

7 files changed

+47
-64
lines changed

.github/workflows/int-test-workflow.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- develop
66
- master
7-
- CSPL-1598
87
jobs:
98
int-tests:
109
strategy:

test/c3/appframework/appframework_test.go

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
. "github.com/onsi/gomega"
2626

2727
enterpriseApi "github.com/splunk/splunk-operator/api/v3"
28+
splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
2829
testenv "github.com/splunk/splunk-operator/test/testenv"
2930
corev1 "k8s.io/api/core/v1"
3031
)
@@ -2887,14 +2888,14 @@ var _ = Describe("c3appfw test", func() {
28872888
})
28882889

28892890
Context("Single Site Indexer Cluster with Search Head Cluster (C3) and App Framework", func() {
2890-
It("integration, c3, appframeworkc3, appframework: can deploy a C3 SVA with App Framework enabled and delete apps from init-apps when download is compelte", func() {
2891+
It("integration, c3, appframeworkc3, appframework: can deploy a C3 SVA with App Framework enabled and delete apps from app directory when download is complete", func() {
28912892

28922893
/* Test Steps
28932894
################## SETUP ####################
2894-
* Upload V1 apps to S3 for Indexer Cluster and Search Head Cluster
2895+
* Upload big-size app to S3 for Indexer Cluster and Search Head Cluster
28952896
* Create app sources for Cluster Manager and Deployer
28962897
* Prepare and deploy C3 CRD with app framework and wait for the pods to be ready
2897-
* When app download is complete, delete apps from init-apps
2898+
* When app download is complete, delete apps from app directory
28982899
######### VERIFICATIONS #############
28992900
* Verify Apps are Downloaded in App Deployment Info
29002901
* Verify Apps Copied in App Deployment Info
@@ -2906,25 +2907,25 @@ var _ = Describe("c3appfw test", func() {
29062907
*/
29072908

29082909
//################## SETUP ####################
2909-
// Download all apps from S3
2910+
// Download big size apps from S3
29102911
appList := testenv.BigSingleApp
29112912
appFileList := testenv.GetAppFileList(appList)
29122913
err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList)
29132914
Expect(err).To(Succeed(), "Unable to download big-size app")
29142915

2915-
// Upload V1 apps to S3 for Indexer Cluster
2916+
// Upload big size app to S3 for Indexer Cluster
29162917
appVersion := "V1"
2917-
testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Indexer Cluster", appVersion))
2918+
testcaseEnvInst.Log.Info("Upload big size app to S3 for Indexer Cluster")
29182919
s3TestDirIdxc = "c3appfw-idxc-" + testenv.RandomDNSName(4)
29192920
uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1)
2920-
Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Indexer Cluster", appVersion))
2921+
Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Indexer Cluster")
29212922
uploadedApps = append(uploadedApps, uploadedFiles...)
29222923

2923-
// Upload V1 apps to S3 for Search Head Cluster
2924-
testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion))
2924+
// Upload big size app to S3 for Search Head Cluster
2925+
testcaseEnvInst.Log.Info("Upload big size app to S3 for Search Head Cluster")
29252926
s3TestDirShc = "c3appfw-shc-" + testenv.RandomDNSName(4)
29262927
uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1)
2927-
Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion))
2928+
Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster")
29282929
uploadedApps = append(uploadedApps, uploadedFiles...)
29292930

29302931
// Create App framework Spec for C3
@@ -2945,13 +2946,8 @@ var _ = Describe("c3appfw test", func() {
29452946
// Verify App Download is completed on Cluster Manager
29462947
testenv.VerifyAppState(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending)
29472948

2948-
//Delete apps from init-apps when app download is complete
2949-
var opPod string
2950-
if testcaseEnvInst.IsOperatorInstalledClusterWide() != "true" {
2951-
opPod = testenv.GetOperatorPodName(testcaseEnvInst.GetName())
2952-
} else {
2953-
opPod = testenv.GetOperatorPodName("splunk-operator")
2954-
}
2949+
//Delete apps from app directory when app download is complete
2950+
opPod := testenv.GetOperatorPodName(testcaseEnvInst)
29552951
podDownloadPath := filepath.Join(splcommon.AppDownloadVolume, "downloadedApps", testenvInstance.GetName(), cm.Kind, deployment.GetName(), enterpriseApi.ScopeCluster, appSourceNameIdxc, testenv.AppInfo[appList[0]]["filename"])
29562952
err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath})
29572953
Expect(err).To(Succeed(), "Unable to delete file on pod")

test/m4/appframework/appframework_test.go

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
. "github.com/onsi/ginkgo"
2525
. "github.com/onsi/gomega"
2626

27-
testenv "github.com/splunk/splunk-operator/test/testenv"
28-
2927
enterpriseApi "github.com/splunk/splunk-operator/api/v3"
28+
splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
29+
testenv "github.com/splunk/splunk-operator/test/testenv"
3030
corev1 "k8s.io/api/core/v1"
3131
)
3232

@@ -2455,13 +2455,13 @@ var _ = Describe("m4appfw test", func() {
24552455
})
24562456

24572457
Context("Multisite Indexer Cluster with Search Head Cluster (m4) with App Framework", func() {
2458-
It("integration, m4, appframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from init-apps when download is compelte", func() {
2458+
It("integration, m4, appframeworkm4, appframework: can deploy a M4 SVA with App Framework enabled and delete apps from app directory when download is complete", func() {
24592459

24602460
/* Test Steps
24612461
################## SETUP ##################
2462-
* Upload V1 apps to S3 for Indexer Cluster and Search Head Cluster
2462+
* Upload big-size app to S3 for Indexer Cluster and Search Head Cluster
24632463
* Prepare and deploy M4 CRD with app framework and wait for the pods to be ready
2464-
* When app download is complete, delete apps from init-apps
2464+
* When app download is complete, delete apps from app directory
24652465
########## VERIFICATIONS ##########
24662466
* Verify Apps Downloaded in App Deployment Info
24672467
* Verify Apps Copied in App Deployment Info
@@ -2473,23 +2473,23 @@ var _ = Describe("m4appfw test", func() {
24732473
*/
24742474

24752475
//################## SETUP ##################
2476-
// Download all apps from S3
2477-
appList := append(testenv.BigSingleApp, testenv.ExtraApps...)
2476+
// Download big size apps from S3
2477+
appList := testenv.BigSingleApp
24782478
appFileList := testenv.GetAppFileList(appList)
24792479
err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList)
24802480
Expect(err).To(Succeed(), "Unable to download big-size app")
24812481

2482-
// Upload V1 apps to S3 for Indexer Cluster
2482+
// Upload big size app to S3 for Indexer Cluster
24832483
appVersion := "V1"
2484-
testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Indexer Cluster", appVersion))
2484+
testcaseEnvInst.Log.Info("Upload big size app to S3 for Indexer Cluster")
24852485
uploadedFiles, err := testenv.UploadFilesToS3(testS3Bucket, s3TestDirIdxc, appFileList, downloadDirV1)
2486-
Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Indexer Cluster", appVersion))
2486+
Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Indexer Cluster")
24872487
uploadedApps = append(uploadedApps, uploadedFiles...)
24882488

2489-
// Upload V1 apps to S3 for Search Head Cluster
2490-
testcaseEnvInst.Log.Info(fmt.Sprintf("Upload %s apps to S3 for Search Head Cluster", appVersion))
2489+
// Upload big size app to S3 for Search Head Cluster
2490+
testcaseEnvInst.Log.Info("Upload big size app to S3 for Search Head Cluster")
24912491
uploadedFiles, err = testenv.UploadFilesToS3(testS3Bucket, s3TestDirShc, appFileList, downloadDirV1)
2492-
Expect(err).To(Succeed(), fmt.Sprintf("Unable to upload %s apps to S3 test directory for Search Head Cluster", appVersion))
2492+
Expect(err).To(Succeed(), "Unable to upload big size to S3 test directory for Search Head Cluster")
24932493
uploadedApps = append(uploadedApps, uploadedFiles...)
24942494

24952495
// Create App framework Spec for M4
@@ -2509,13 +2509,8 @@ var _ = Describe("m4appfw test", func() {
25092509
// Verify App Download is completed on Cluster Manager
25102510
testenv.VerifyAppState(ctx, deployment, testcaseEnvInst, deployment.GetName(), cm.Kind, appSourceNameIdxc, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending)
25112511

2512-
//Delete apps from init-apps when app download is complete
2513-
var opPod string
2514-
if testcaseEnvInst.IsOperatorInstalledClusterWide() != "true" {
2515-
opPod = testenv.GetOperatorPodName(testcaseEnvInst.GetName())
2516-
} else {
2517-
opPod = testenv.GetOperatorPodName("splunk-operator")
2518-
}
2512+
//Delete apps from app directory when app download is complete
2513+
opPod := testenv.GetOperatorPodName(testcaseEnvInst)
25192514
podDownloadPath := filepath.Join(splcommon.AppDownloadVolume, "downloadedApps", testenvInstance.GetName(), cm.Kind, deployment.GetName(), enterpriseApi.ScopeCluster, appSourceNameIdxc, testenv.AppInfo[appList[0]]["filename"])
25202515
err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath})
25212516
Expect(err).To(Succeed(), "Unable to delete file on pod")

test/s1/appframework/appframework_test.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323
. "github.com/onsi/ginkgo"
2424
. "github.com/onsi/gomega"
2525

26-
testenv "github.com/splunk/splunk-operator/test/testenv"
27-
2826
enterpriseApi "github.com/splunk/splunk-operator/api/v3"
27+
splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
28+
testenv "github.com/splunk/splunk-operator/test/testenv"
2929
corev1 "k8s.io/api/core/v1"
3030
)
3131

@@ -1781,14 +1781,14 @@ var _ = Describe("s1appfw test", func() {
17811781
})
17821782

17831783
Context("Standalone deployment (S1) with App Framework", func() {
1784-
It("integration, s1, appframeworks1, appframework: Deploy a Standalone instance with App Framework enabled and delete apps from init-apps when app download is complete", func() {
1784+
It("integration, s1, appframeworks1, appframework: Deploy a Standalone instance with App Framework enabled and delete apps from app directory when app download is complete", func() {
17851785

17861786
/* Test Steps
17871787
################## SETUP ####################
17881788
* Upload big-size app to S3 for Standalone
17891789
* Create app source for Standalone
17901790
* Prepare and deploy Standalone
1791-
* When app download is complete, delete apps from init-apps
1791+
* When app download is complete, delete apps from app directory
17921792
############## VERIFICATIONS ################
17931793
* Verify App installation is in progress on Standalone
17941794
* Upload more apps from S3 during bigger app install
@@ -1797,12 +1797,12 @@ var _ = Describe("s1appfw test", func() {
17971797
*/
17981798

17991799
// ################## SETUP FOR STANDALONE ####################
1800-
// Download all test apps from S3
1800+
// Download big size apps from S3
18011801
appVersion := "V1"
18021802
appList := testenv.BigSingleApp
18031803
appFileList := testenv.GetAppFileList(appList)
18041804
err := testenv.DownloadFilesFromS3(testDataS3Bucket, s3AppDirV1, downloadDirV1, appFileList)
1805-
Expect(err).To(Succeed(), "Unable to download apps")
1805+
Expect(err).To(Succeed(), "Unable to download big app")
18061806

18071807
// Upload big-size app to S3 for Standalone
18081808
testcaseEnvInst.Log.Info("Upload big-size app to S3 for Standalone")
@@ -1815,7 +1815,7 @@ var _ = Describe("s1appfw test", func() {
18151815
appFrameworkSpec := testenv.GenerateAppFrameworkSpec(testcaseEnvInst, appSourceVolumeName, enterpriseApi.ScopeLocal, appSourceName, s3TestDir, 60)
18161816
spec := enterpriseApi.StandaloneSpec{
18171817
CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{
1818-
Spec: splcommon.Spec{
1818+
Spec: enterpriseApi.Spec{
18191819
ImagePullPolicy: "Always",
18201820
},
18211821
Volumes: []corev1.Volume{},
@@ -1831,14 +1831,8 @@ var _ = Describe("s1appfw test", func() {
18311831
// Verify App Download is completed on Standalone
18321832
testenv.VerifyAppState(ctx, deployment, testcaseEnvInst, deployment.GetName(), standalone.Kind, appSourceName, appFileList, enterpriseApi.AppPkgPodCopyComplete, enterpriseApi.AppPkgPodCopyPending)
18331833

1834-
//Delete apps from init-apps when app download is complete
1835-
var opPod string
1836-
if testcaseEnvInst.IsOperatorInstalledClusterWide() != "true" {
1837-
opPod = testenv.GetOperatorPodName(testcaseEnvInst.GetName())
1838-
1839-
} else {
1840-
opPod = testenv.GetOperatorPodName("splunk-operator")
1841-
}
1834+
//Delete apps from app-directory when app download is complete
1835+
opPod := testenv.GetOperatorPodName(testcaseEnvInst)
18421836
podDownloadPath := filepath.Join(splcommon.AppDownloadVolume, "downloadedApps", testenvInstance.GetName(), standalone.Kind, deployment.GetName(), enterpriseApi.ScopeLocal, appSourceName, testenv.AppInfo[appList[0]]["filename"])
18431837
err = testenv.DeleteFilesOnOperatorPod(ctx, deployment, opPod, []string{podDownloadPath})
18441838
Expect(err).To(Succeed(), "Unable to delete file on pod")

test/testenv/appframework_utils.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,7 @@ func AppFrameWorkVerifications(ctx context.Context, deployment *Deployment, test
385385
}
386386

387387
// Verify apps packages are deleted from the operator pod for all CRs
388-
var opPod string
389-
if testenvInstance.clusterWideOperator != "true" {
390-
opPod = GetOperatorPodName(testenvInstance.GetName())
391-
} else {
392-
opPod = GetOperatorPodName("splunk-operator")
393-
}
388+
opPod := GetOperatorPodName(testenvInstance)
394389
for _, appSource := range appSource {
395390
testenvInstance.Log.Info(fmt.Sprintf("Verify apps %s packages are deleted from the operator pod for CR %v with name %v", appSource.CrAppVersion, appSource.CrKind, appSource.CrName))
396391
opPath := filepath.Join(splcommon.AppDownloadVolume, "downloadedApps", testenvInstance.GetName(), appSource.CrKind, deployment.GetName(), appSource.CrAppScope, appSource.CrAppSourceName)

test/testenv/deployment.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ func (d *Deployment) Teardown() error {
111111

112112
var err error
113113
var output []byte
114-
var podName string
114+
podName := GetOperatorPodName(d.testenv)
115115
if d.testenv.clusterWideOperator != "true" {
116-
podName = GetOperatorPodName(d.testenv.GetName())
117116
output, err = exec.Command("kubectl", "logs", "-n", d.testenv.GetName(), podName).Output()
118117
} else {
119-
podName = GetOperatorPodName("splunk-operator")
120118
output, err = exec.Command("kubectl", "logs", "-n", "splunk-operator", podName, "manager").Output()
121119
}
122120
if err != nil {

test/testenv/util.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,13 @@ func DumpGetTopPods(ns string) []string {
603603
}
604604

605605
// GetOperatorPodName returns name of operator pod in the namespace
606-
func GetOperatorPodName(ns string) string {
606+
func GetOperatorPodName(testcaseEnvInst *TestCaseEnv) string {
607+
var ns string
608+
if testcaseEnvInst.clusterWideOperator != "true" {
609+
ns = testcaseEnvInst.GetName()
610+
} else {
611+
ns = "splunk-operator"
612+
}
607613
output, err := exec.Command("kubectl", "get", "pods", "-n", ns).Output()
608614
var splunkPods string
609615
if err != nil {
@@ -881,7 +887,7 @@ func DeleteOperatorPod(testcaseEnvInst *TestCaseEnv) error {
881887
} else {
882888
ns = "splunk-operator"
883889
}
884-
podName = GetOperatorPodName(ns)
890+
podName = GetOperatorPodName(testcaseEnvInst)
885891

886892
_, err := exec.Command("kubectl", "delete", "pod", "-n", ns, podName).Output()
887893
if err != nil {

0 commit comments

Comments
 (0)