diff --git a/api/v4/common_types.go b/api/v4/common_types.go index 5bba9c0cd..dcf94f1c2 100644 --- a/api/v4/common_types.go +++ b/api/v4/common_types.go @@ -572,8 +572,6 @@ type PhaseInfo struct { const ( // AppPkgDownloadPending indicates pending AppPkgDownloadPending AppPhaseStatusType = 101 - // AppPkgDownloadInProgress indicates in progress - AppPkgDownloadInProgress = 102 // AppPkgDownloadComplete indicates complete AppPkgDownloadComplete = 103 // AppPkgDownloadError indicates error after retries @@ -583,8 +581,6 @@ const ( const ( // AppPkgPodCopyPending indicates pending AppPkgPodCopyPending AppPhaseStatusType = 201 - // AppPkgPodCopyInProgress indicates in progress - AppPkgPodCopyInProgress = 202 // AppPkgPodCopyComplete indicates complete AppPkgPodCopyComplete = 203 // AppPkgMissingFromOperator indicates the downloaded app package is missing @@ -596,8 +592,6 @@ const ( const ( // AppPkgInstallPending indicates pending AppPkgInstallPending AppPhaseStatusType = 301 - // AppPkgInstallInProgress indicates in progress - AppPkgInstallInProgress = 302 // AppPkgInstallComplete indicates complete AppPkgInstallComplete = 303 // AppPkgMissingOnPodError indicates app pkg is not available on Pod for install diff --git a/pkg/splunk/enterprise/afwscheduler.go b/pkg/splunk/enterprise/afwscheduler.go index cc99eca0d..b0f0a4cdc 100644 --- a/pkg/splunk/enterprise/afwscheduler.go +++ b/pkg/splunk/enterprise/afwscheduler.go @@ -37,16 +37,13 @@ import ( var appPhaseInfoStatuses = map[enterpriseApi.AppPhaseStatusType]bool{ enterpriseApi.AppPkgDownloadPending: true, - enterpriseApi.AppPkgDownloadInProgress: true, enterpriseApi.AppPkgDownloadComplete: true, enterpriseApi.AppPkgDownloadError: true, enterpriseApi.AppPkgPodCopyPending: true, - enterpriseApi.AppPkgPodCopyInProgress: true, enterpriseApi.AppPkgPodCopyComplete: true, enterpriseApi.AppPkgMissingFromOperator: true, enterpriseApi.AppPkgPodCopyError: true, enterpriseApi.AppPkgInstallPending: true, - enterpriseApi.AppPkgInstallInProgress: true, enterpriseApi.AppPkgInstallComplete: true, enterpriseApi.AppPkgMissingOnPodError: true, enterpriseApi.AppPkgInstallError: true, @@ -557,37 +554,16 @@ downloadWork: continue } - // update the download state of app to be DownloadInProgress - updatePplnWorkerPhaseInfo(ctx, downloadWorker.appDeployInfo, downloadWorker.appDeployInfo.PhaseInfo.FailCount, enterpriseApi.AppPkgDownloadInProgress) + // increment the count in worker waitgroup + downloadWorker.waiter.Add(1) appDeployInfo := downloadWorker.appDeployInfo - // create the sub-directories on the volume for downloading scoped apps + remoteDataClientMgr, err := getRemoteDataClientMgr(ctx, downloadWorker.client, downloadWorker.cr, downloadWorker.afwConfig, downloadWorker.appSrcName) localPath, err := downloadWorker.createDownloadDirOnOperator(ctx) if err != nil { scopedLog.Error(err, "unable to create download directory on operator", "appSrcName", downloadWorker.appSrcName, "appName", appDeployInfo.AppName) - - // increment the retry count and mark this app as download pending - updatePplnWorkerPhaseInfo(ctx, appDeployInfo, appDeployInfo.PhaseInfo.FailCount+1, enterpriseApi.AppPkgDownloadPending) - - <-downloadWorkersRunPool - continue - } - - // get the remoteDataClientMgr instance - remoteDataClientMgr, err := getRemoteDataClientMgr(ctx, downloadWorker.client, downloadWorker.cr, downloadWorker.afwConfig, downloadWorker.appSrcName) - if err != nil { - scopedLog.Error(err, "unable to get remote data client manager") - // increment the retry count and mark this app as download error - updatePplnWorkerPhaseInfo(ctx, appDeployInfo, appDeployInfo.PhaseInfo.FailCount+1, enterpriseApi.AppPkgDownloadError) - - <-downloadWorkersRunPool - continue } - - // increment the count in worker waitgroup - downloadWorker.waiter.Add(1) - // start the actual download go downloadWorker.download(ctx, pplnPhase, *remoteDataClientMgr, localPath, downloadWorkersRunPool) diff --git a/pkg/splunk/enterprise/afwscheduler_test.go b/pkg/splunk/enterprise/afwscheduler_test.go index 87c5f2ba8..28b71381f 100644 --- a/pkg/splunk/enterprise/afwscheduler_test.go +++ b/pkg/splunk/enterprise/afwscheduler_test.go @@ -3739,8 +3739,8 @@ func TestHandleAppPkgInstallComplete(t *testing.T) { // Standalone with only one replicas // Case-1: App pkg should not be deleted, when the installation is not complete on the Pod. worker.appDeployInfo.AuxPhaseInfo = append(worker.appDeployInfo.AuxPhaseInfo, enterpriseApi.PhaseInfo{ - Phase: enterpriseApi.PhaseInstall, - Status: enterpriseApi.AppPkgInstallInProgress}) + Phase: enterpriseApi.PhaseInstall, + }) _, err = os.Create(appPkgLocalPath) if err != nil { diff --git a/pkg/splunk/enterprise/util.go b/pkg/splunk/enterprise/util.go index be352eb94..2b4de465d 100644 --- a/pkg/splunk/enterprise/util.go +++ b/pkg/splunk/enterprise/util.go @@ -426,24 +426,18 @@ func appPhaseStatusAsStr(status enterpriseApi.AppPhaseStatusType) string { switch status { case enterpriseApi.AppPkgDownloadPending: return "Download Pending" - case enterpriseApi.AppPkgDownloadInProgress: - return "Download In Progress" case enterpriseApi.AppPkgDownloadComplete: return "Download Complete" case enterpriseApi.AppPkgDownloadError: return "Download Error" case enterpriseApi.AppPkgPodCopyPending: return "Pod Copy Pending" - case enterpriseApi.AppPkgPodCopyInProgress: - return "Pod Copy In Progress" case enterpriseApi.AppPkgPodCopyComplete: return "Pod Copy Complete" case enterpriseApi.AppPkgPodCopyError: return "Pod Copy Error" case enterpriseApi.AppPkgInstallPending: return "Install Pending" - case enterpriseApi.AppPkgInstallInProgress: - return "Install In Progress" case enterpriseApi.AppPkgInstallComplete: return "Install Complete" case enterpriseApi.AppPkgInstallError: diff --git a/pkg/splunk/enterprise/util_test.go b/pkg/splunk/enterprise/util_test.go index 5e69bfdb7..eed45f4dc 100644 --- a/pkg/splunk/enterprise/util_test.go +++ b/pkg/splunk/enterprise/util_test.go @@ -1098,11 +1098,6 @@ func TestAppPhaseStatusAsStr(t *testing.T) { t.Errorf("Got wrong status. Expected status=Download Pending, Got = %s", status) } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgDownloadInProgress) - if status != "Download In Progress" { - t.Errorf("Got wrong status. Expected status=\"Download In Progress\", Got = %s", status) - } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgDownloadComplete) if status != "Download Complete" { t.Errorf("Got wrong status. Expected status=\"Download Complete\", Got = %s", status) @@ -1113,36 +1108,11 @@ func TestAppPhaseStatusAsStr(t *testing.T) { t.Errorf("Got wrong status. Expected status=\"Download Error\", Got = %s", status) } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyPending) - if status != "Pod Copy Pending" { - t.Errorf("Got wrong status. Expected status=Pod Copy Pending, Got = %s", status) - } - - status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyInProgress) - if status != "Pod Copy In Progress" { - t.Errorf("Got wrong status. Expected status=\"Pod Copy In Progress\", Got = %s", status) - } - - status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyComplete) - if status != "Pod Copy Complete" { - t.Errorf("Got wrong status. Expected status=\"Pod Copy Complete\", Got = %s", status) - } - - status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyError) - if status != "Pod Copy Error" { - t.Errorf("Got wrong status. Expected status=\"Pod Copy Error\", Got = %s", status) - } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallPending) if status != "Install Pending" { t.Errorf("Got wrong status. Expected status=Install Pending, Got = %s", status) } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallInProgress) - if status != "Install In Progress" { - t.Errorf("Got wrong status. Expected status=\"Install In Progress\", Got = %s", status) - } - status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallComplete) if status != "Install Complete" { t.Errorf("Got wrong status. Expected status=\"Install Complete\", Got = %s", status) @@ -1161,10 +1131,9 @@ func TestAppPhaseStatusAsStr(t *testing.T) { func TestBundlePushStateAsStr(t *testing.T) { bpsMap := map[enterpriseApi.BundlePushStageType]string{ - enterpriseApi.BundlePushPending: "Bundle Push Pending", - enterpriseApi.BundlePushInProgress: "Bundle Push In Progress", - enterpriseApi.BundlePushComplete: "Bundle Push Complete", - 4: "Invalid bundle push state", + enterpriseApi.BundlePushPending: "Bundle Push Pending", + enterpriseApi.BundlePushComplete: "Bundle Push Complete", + 4: "Invalid bundle push state", } for k, v := range bpsMap { got := bundlePushStateAsStr(context.TODO(), k) diff --git a/test/testenv/deployment.go b/test/testenv/deployment.go index 85e753a84..262b2ff78 100644 --- a/test/testenv/deployment.go +++ b/test/testenv/deployment.go @@ -77,6 +77,11 @@ func (d *Deployment) popCleanupFunc() (cleanupFunc, error) { // Teardown teardowns the deployment resources func (d *Deployment) Teardown() error { + defer func() { + if r := recover(); r != nil { + d.testenv.Log.Error(fmt.Errorf("panic: %v", r), "Recovered from panic in Deployment.Teardown") + } + }() // Formatted string for pod logs podLogFile := "%s-%s.log" diff --git a/test/testenv/testcaseenv.go b/test/testenv/testcaseenv.go index a1081e0a0..a1a28642f 100644 --- a/test/testenv/testcaseenv.go +++ b/test/testenv/testcaseenv.go @@ -177,6 +177,11 @@ func (testenv *TestCaseEnv) setup() error { // Teardown cleanup the resources use in this testenv func (testenv *TestCaseEnv) Teardown() error { + defer func() { + if r := recover(); r != nil { + testenv.Log.Error(fmt.Errorf("panic: %v", r), "Recovered from panic in TestCaseEnv.Teardown") + } + }() if testenv.SkipTeardown && testenv.debug == "True" { testenv.Log.Info("testenv teardown is skipped!\n") diff --git a/test/testenv/testenv.go b/test/testenv/testenv.go index 7e4579ee2..5c97f7140 100644 --- a/test/testenv/testenv.go +++ b/test/testenv/testenv.go @@ -296,6 +296,11 @@ func (testenv *TestEnv) GetName() string { // Teardown cleanup the resources use in this testenv func (testenv *TestEnv) Teardown() error { + defer func() { + if r := recover(); r != nil { + testenv.Log.Error(fmt.Errorf("panic: %v", r), "Recovered from panic in TestEnv.Teardown") + } + }() if testenv.SkipTeardown && testenv.debug == "True" { testenv.Log.Info("testenv teardown is skipped!\n")