Skip to content

Commit

Permalink
fixing code coverage error handling
Browse files Browse the repository at this point in the history
Signed-off-by: B Rahul <rahul20bollisetty@gmail.com>
  • Loading branch information
rahulbollisetty committed Oct 10, 2024
1 parent 9ac956b commit 94d1e8a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions util/argo/resource_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func (rt *resourceTracking) getAppInstanceValue(un *unstructured.Unstructured, i
return value
}

func (rt *resourceTracking) getAppInstanceIdValue(un *unstructured.Unstructured) string {
appInstanceIdValue, err := argokube.GetAppInstanceAnnotation(un, common.AnnotationKeyAppInstanceID)
if err != nil {
return ""
}
return appInstanceIdValue
func (rt *resourceTracking) getAppInstanceIdValue(un *unstructured.Unstructured) *string {
appInstanceIdValue, err := argokube.GetAppInstanceAnnotation(un, common.AnnotationKeyAppInstanceID)
if err != nil {
return nil
}
return &appInstanceIdValue
}

// GetAppName retrieve application name base on tracking method
Expand Down Expand Up @@ -133,7 +133,11 @@ func (rt *resourceTracking) GetAppInstance(un *unstructured.Unstructured, key st

// GetAppInstanceID retrieve instance ID of the resource.
func (rt *resourceTracking) GetAppInstanceID(un *unstructured.Unstructured) string {
return rt.getAppInstanceIdValue(un)
appInstanceIdValue := rt.getAppInstanceIdValue(un)
if appInstanceIdValue == nil {
return ""
}
return *appInstanceIdValue
}

// UnstructuredToAppInstanceValue will build the AppInstanceValue based
Expand Down

0 comments on commit 94d1e8a

Please sign in to comment.