Skip to content

Commit

Permalink
e2e: Fix improper use of formatting
Browse files Browse the repository at this point in the history
When using fmt.Errorf(), we don't need to format the message with
fmt.Sprintf().

Fixes: #1618
Signed-off-by: alonso fabila <[email protected]>
  • Loading branch information
alonsofabila-dev authored and nirs committed Oct 29, 2024
1 parent 2886c64 commit 59a9b36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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
6 changes: 3 additions & 3 deletions e2e/dractions/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func waitPlacementDecision(client client.Client, namespace string, placementName

if time.Since(startTime) > time.Second*time.Duration(util.Timeout) {
return "", fmt.Errorf(
"could not get placement decision for " + placementName + " before timeout, fail")
"could not get placement decision for %q before timeout, fail", placementName)
}

time.Sleep(time.Second * time.Duration(util.TimeInterval))
Expand Down Expand Up @@ -78,7 +78,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(time.Second * time.Duration(util.TimeInterval))
Expand Down Expand Up @@ -206,7 +206,7 @@ func waitDRPCDeleted(client client.Client, namespace string, name string) error
}

if time.Since(startTime) > time.Second*time.Duration(util.Timeout) {
return fmt.Errorf(fmt.Sprintf("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(time.Second * time.Duration(util.TimeInterval))
Expand Down

0 comments on commit 59a9b36

Please sign in to comment.