Skip to content

Commit b134408

Browse files
authored
Fix 'Unable to retrieve current OCP version: Malformed version' when running unit tests (#729)
* Fix 'Unable to retrieve current OCP version: Malformed version' when running unit tests Signed-off-by: Jonathan West <[email protected]> * Fix 'Unable to retrieve current OCP version: Malformed version' when running unit tests Signed-off-by: Jonathan West <[email protected]> --------- Signed-off-by: Jonathan West <[email protected]>
1 parent e32261b commit b134408

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

controllers/argocd_metrics_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ func (r *ArgoCDMetricsReconciler) reconcileOperatorMetricsServiceMonitor(reqLogg
362362

363363
data, err := os.ReadFile(operatorPodNamespacePath)
364364
if err != nil {
365+
if os.IsNotExist(err) {
366+
reqLogger.Info(fmt.Sprintf("Unable to retrieve the operator's running namespace via '%s': you should only see this message when running within unit tests, otherwise it is an error.", operatorPodNamespacePath))
367+
return nil
368+
}
365369
reqLogger.Error(err, "Error retrieving operator's running namespace")
366370
return err
367371
}

0 commit comments

Comments
 (0)