From 1f49b2c0c0c63cc2d361c07156c50db46f17d699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 22 Aug 2024 22:37:26 +0200 Subject: [PATCH] Use slices.Backward MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miloslav Trmač --- integration/openshift.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/integration/openshift.go b/integration/openshift.go index 267b734c..b7a1792b 100644 --- a/integration/openshift.go +++ b/integration/openshift.go @@ -8,6 +8,7 @@ import ( "os" "os/exec" "path/filepath" + "slices" "strings" "testing" "time" @@ -253,10 +254,10 @@ func (cluster *openshiftCluster) relaxImageSignerPermissions(t *testing.T) { // tearDown stops the cluster services and deletes (only some!) of the state. func (cluster *openshiftCluster) tearDown(t *testing.T) { - for i := len(cluster.processes) - 1; i >= 0; i-- { + for _, process := range slices.Backward(cluster.processes) { // It’s undocumented what Kill() returns if the process has terminated, // so we couldn’t check just for that. This is running in a container anyway… - _ = cluster.processes[i].Process.Kill() + _ = process.Process.Kill() } if cluster.dockerDir != "" { err := os.RemoveAll(cluster.dockerDir)