Skip to content

Commit

Permalink
e2e: Fix improper use of formatting
Browse files Browse the repository at this point in the history
e2e: Fix improper use of formatting

When using fmt.Errorf(), we don't need to format the message with
fmt.Sprintf().

Fixes: RamenDR#1618
Signed-off-by: alonso fabila <[email protected]>
  • Loading branch information
alonsofabila-dev authored and raghavendra-talur committed Nov 19, 2024
1 parent f187fca commit 231dee3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/deployers/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func CreatePlacementDecisionConfigMap(cmName string, cmNamespace string) error {
err := util.Ctx.Hub.CtrlClient.Create(context.Background(), configMap)
if err != nil {
if !errors.IsAlreadyExists(err) {
return fmt.Errorf("could not create configMap " + cmName)
return fmt.Errorf("could not create configMap %q", cmName)
}

util.Ctx.Log.Info("configMap " + cmName + " already Exists")
Expand All @@ -271,7 +271,7 @@ func DeleteConfigMap(cmName string, cmNamespace string) error {
err := util.Ctx.Hub.CtrlClient.Delete(context.Background(), configMap)
if err != nil {
if !errors.IsNotFound(err) {
return fmt.Errorf("could not delete configMap " + cmName)
return fmt.Errorf("could not delete configMap %q", cmName)
}

util.Ctx.Log.Info("configMap " + cmName + " not found")
Expand Down
4 changes: 2 additions & 2 deletions e2e/deployers/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func waitSubscriptionPhase(namespace, name string, phase subscriptionv1.Subscrip
}

if time.Since(startTime) > util.Timeout {
return fmt.Errorf("subscription %s status is not %s yet before timeout", name, phase)
return fmt.Errorf("subscription %q status is not %q yet before timeout", name, phase)
}

time.Sleep(util.RetryInterval)
Expand All @@ -51,7 +51,7 @@ func WaitWorkloadHealth(client client.Client, namespace string, w workloads.Work
if time.Since(startTime) > util.Timeout {
util.Ctx.Log.Info(err.Error())

return fmt.Errorf("workload %s is not ready yet before timeout of %v",
return fmt.Errorf("workload %q is not ready yet before timeout of %v",
w.GetName(), util.Timeout)
}

Expand Down
8 changes: 4 additions & 4 deletions e2e/dractions/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func waitDRPCReady(client client.Client, namespace string, drpcName string) erro
util.Ctx.Log.Info("drpc " + drpcName + " LastGroupSyncTime is nil")
}

return fmt.Errorf("drpc " + drpcName + " is not ready yet before timeout, fail")
return fmt.Errorf("drpc %q is not ready yet before timeout, fail", drpcName)
}

time.Sleep(util.RetryInterval)
Expand Down Expand Up @@ -117,7 +117,7 @@ func waitDRPCPhase(client client.Client, namespace, name string, phase ramen.DRS
}

if time.Since(startTime) > util.Timeout {
return fmt.Errorf("drpc %s status is not %s yet before timeout, fail", name, phase)
return fmt.Errorf("drpc %q status is not %q yet before timeout, fail", name, phase)
}

time.Sleep(util.RetryInterval)
Expand Down Expand Up @@ -184,7 +184,7 @@ func waitDRPCDeleted(client client.Client, namespace string, name string) error
}

if time.Since(startTime) > util.Timeout {
return fmt.Errorf("drpc %s is not deleted yet before timeout, fail", name)
return fmt.Errorf("drpc %q is not deleted yet before timeout, fail", name)
}

time.Sleep(util.RetryInterval)
Expand All @@ -209,7 +209,7 @@ func waitDRPCProgression(client client.Client, namespace, name string, progressi
}

if time.Since(startTime) > util.Timeout {
return fmt.Errorf("drpc %s progression is not %s yet before timeout of %v",
return fmt.Errorf("drpc %q progression is not %q yet before timeout of %v",
name, progression, util.Timeout)
}

Expand Down

0 comments on commit 231dee3

Please sign in to comment.