Skip to content

Commit

Permalink
tests/operator: define usesSha as a static function
Browse files Browse the repository at this point in the history
usesSha() is a single static function. Defining it as a named lambda
needlessly adds mental burden, as the read need to keep in mind that it
may change in the future.

With this change, there is no need to declare usesSha in one place, and
define it elsewhere, and indentation level is reduced.

Signed-off-by: Dan Kenigsberg <[email protected]>
  • Loading branch information
dankenigsberg committed Jan 1, 2024
1 parent 225ee58 commit 5adff31
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ var _ = Describe("[Serial][sig-operator]Operator", Serial, decorators.SigOperato
deleteOperator func(string)
deleteTestingManifests func(string)
deleteAllKvAndWait func(bool)
usesSha func(string) bool
ensureShasums func()
getVirtLauncherSha func() string
generatePreviousVersionVmYamls func(string, string)
Expand Down Expand Up @@ -674,10 +673,6 @@ var _ = Describe("[Serial][sig-operator]Operator", Serial, decorators.SigOperato

}

usesSha = func(image string) bool {
return strings.Contains(image, "@sha256:")
}

ensureShasums = func() {
if flags.SkipShasumCheck {
log.Log.Warning("Cannot use shasums, skipping")
Expand Down Expand Up @@ -3481,3 +3476,7 @@ func nodeSelectorExistInDeployment(virtClient kubecli.KubevirtClient, deployment
}
return true
}

func usesSha(image string) bool {
return strings.Contains(image, "@sha256:")
}

0 comments on commit 5adff31

Please sign in to comment.