diff --git a/analysis/analysis.go b/analysis/analysis.go index 3bb7d89731..e5c6fc907d 100644 --- a/analysis/analysis.go +++ b/analysis/analysis.go @@ -508,6 +508,11 @@ func (c *Controller) assessRunStatus(run *v1alpha1.AnalysisRun, metrics []v1alph runSummary.Successful++ } } else { + // We don't really care about the failures from dry-runs and hence, if there is no current status + // found then we just set it to `AnalysisPhaseSuccessful` + if worstStatus == "" { + worstStatus = v1alpha1.AnalysisPhaseSuccessful + } // Update metric result message if message != "" { result.Message = fmt.Sprintf("Metric assessed %s due to %s", metricStatus, message) diff --git a/analysis/analysis_test.go b/analysis/analysis_test.go index 30e3b7adb9..d4763f3e4b 100644 --- a/analysis/analysis_test.go +++ b/analysis/analysis_test.go @@ -1500,7 +1500,7 @@ func TestAssessRunStatusErrorMessageAnalysisPhaseFail(t *testing.T) { func TestAssessRunStatusErrorMessageAnalysisPhaseFailInDryRunMode(t *testing.T) { status, message, dryRunSummary := StartAssessRunStatusErrorMessageAnalysisPhaseFail(t, true) - assert.Equal(t, v1alpha1.AnalysisPhaseRunning, status) + assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, status) assert.Equal(t, "", message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2, @@ -1545,7 +1545,7 @@ func TestAssessRunStatusErrorMessageFromProvider(t *testing.T) { func TestAssessRunStatusErrorMessageFromProviderInDryRunMode(t *testing.T) { providerMessage := "Provider Error" status, message, dryRunSummary := StartAssessRunStatusErrorMessageFromProvider(t, providerMessage, true) - assert.Equal(t, v1alpha1.AnalysisPhaseRunning, status) + assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, status) assert.Equal(t, "", message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2, @@ -1587,7 +1587,7 @@ func TestAssessRunStatusMultipleFailures(t *testing.T) { func TestAssessRunStatusMultipleFailuresInDryRunMode(t *testing.T) { status, message, dryRunSummary := StartAssessRunStatusMultipleFailures(t, true) - assert.Equal(t, v1alpha1.AnalysisPhaseRunning, status) + assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, status) assert.Equal(t, "", message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2, @@ -1623,7 +1623,7 @@ func TestAssessRunStatusWorstMessageInReconcileAnalysisRun(t *testing.T) { func TestAssessRunStatusWorstMessageInReconcileAnalysisRunInDryRunMode(t *testing.T) { newRun := StartAssessRunStatusWorstMessageInReconcileAnalysisRun(t, true) - assert.Equal(t, v1alpha1.AnalysisPhaseRunning, newRun.Status.Phase) + assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, newRun.Status.Phase) assert.Equal(t, "", newRun.Status.Message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2,