Skip to content

Commit

Permalink
lint fix CheckImageRemoved ctx should be first arg
Browse files Browse the repository at this point in the history
Signed-off-by: ashnamehrotra <ashnamehrotra@gmail.com>
  • Loading branch information
ashnamehrotra committed Jan 10, 2024
1 parent 5aefb24 commit 12d0b9e
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/e2e/tests/collector_delete_deployment/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDeleteDeployment(t *testing.T) {
Assess("Non-vulnerable image successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.NonVulnerableImage)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.NonVulnerableImage)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/collector_disable_scan/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestDisableScanner(t *testing.T) {
Assess("Non-vulnerable image successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.NonVulnerableImage)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.NonVulnerableImage)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/collector_ensure_scan/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestEnsureScannerFunctions(t *testing.T) {
Assess("Vulnerable and EOL images are successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Alpine)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Alpine)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/collector_pipeline/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestCollectScanErasePipeline(t *testing.T) {
Assess("Vulnerable and EOL images are successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Alpine)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Alpine)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/collector_runtime_config/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestCustomRuntimeAddress(t *testing.T) {
Assess("Vulnerable and EOL images are successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Alpine)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Alpine)

return ctx
}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestCustomRuntimeAddress(t *testing.T) {
Assess("Vulnerable and EOL images are not successfully deleted from all nodes", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(true, ctxT, t, util.GetClusterNodes(t), util.Alpine)
util.CheckImageRemoved(ctxT, true, t, util.GetClusterNodes(t), util.Alpine)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/imagelist_alias/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestEnsureAliasedImageRemoved(t *testing.T) {

ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, []string{nodeName}, util.Nginx)
util.CheckImageRemoved(ctxT, false, t, []string{nodeName}, util.Nginx)

return ctx
}).
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/imagelist_change/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestUpdateImageList(t *testing.T) {

ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Nginx)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Nginx)

return ctx
}).
Expand All @@ -133,7 +133,7 @@ func TestUpdateImageList(t *testing.T) {

ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Redis)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Redis)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/imagelist_include_nodes/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestIncludeNodes(t *testing.T) {
defer cancel()

// ensure image is removed from filtered node.
util.CheckImageRemoved(false, ctxT, t, []string{util.FilterNodeName}, util.Nginx)
util.CheckImageRemoved(ctxT, false, t, []string{util.FilterNodeName}, util.Nginx)

// Wait for the imagejob to be completed by checking for its nonexistence in the cluster
err = wait.For(util.ImagejobNotInCluster(cfg.KubeconfigFile()), wait.WithTimeout(util.Timeout))
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/imagelist_prune_images/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ func TestPrune(t *testing.T) {
// So we'll give plenty of time and fail slow here.
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Redis)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Redis)

ctxT, cancel = context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Caddy)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Caddy)

// Make sure nginx is still there
util.CheckImagesExist(t, util.GetClusterNodes(t), util.Nginx)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/imagelist_rm_images/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestImageListTriggersRemoverImageJob(t *testing.T) {

ctxT, cancel := context.WithTimeout(ctx, time.Minute*3)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.Nginx)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.Nginx)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/imagelist_skip_nodes/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestSkipNodes(t *testing.T) {
defer cancel()

// ensure images are removed from all nodes except the one we are skipping. remove the node we are skipping from the list of nodes.
util.CheckImageRemoved(false, ctxT, t, clusterNodes, util.Nginx)
util.CheckImageRemoved(ctxT, false, t, clusterNodes, util.Nginx)

// get pod logs before imagejob is deleted
if err := util.GetPodLogs(t); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/metrics_test_disable_scanner/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMetricsWithScannerDisabled(t *testing.T) {
Assess("Alpine image is removed", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.VulnerableImage)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.VulnerableImage)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/metrics_test_eraser/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestMetricsEraserOnly(t *testing.T) {

ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(false, ctxT, t, util.GetClusterNodes(t), util.VulnerableImage)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.VulnerableImage)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/metrics_test_scanner/eraser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMetricsWithScanner(t *testing.T) {
Assess("Alpine image is removed", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctxT, cancel := context.WithTimeout(ctx, util.Timeout)
defer cancel()
util.CheckImageRemoved(ctxT, t, util.GetClusterNodes(t), util.VulnerableImage)
util.CheckImageRemoved(ctxT, false, t, util.GetClusterNodes(t), util.VulnerableImage)

return ctx
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func CheckDeploymentCleanedUp(ctx context.Context, t *testing.T, client klient.C
}
}

func CheckImageRemoved(shouldTimeout bool, ctx context.Context, t *testing.T, nodes []string, images ...string) {
func CheckImageRemoved(ctx context.Context, shouldTimeout bool, t *testing.T, nodes []string, images ...string) {
t.Helper()

cleaned := make(map[string]bool)
Expand Down

0 comments on commit 12d0b9e

Please sign in to comment.