From c1a82ba08697a20b8da1a6381c7a69ad06acecc3 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 26 Jun 2024 10:26:50 -0700 Subject: [PATCH] test(e2e): add ability to skip building docker image This allows you to run e2e tests without rebuilding the image by setting E2E_SKIP_BUILD environment variable. Signed-off-by: Adam Reese --- e2e/main_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/main_test.go b/e2e/main_test.go index 8d34102..e503476 100644 --- a/e2e/main_test.go +++ b/e2e/main_test.go @@ -48,9 +48,10 @@ func TestMain(m *testing.M) { // build and load spin operator image into cluster func(ctx context.Context, _ *envconf.Config) (context.Context, error) { - if p := utils.RunCommand(`bash -c "cd .. && IMG=ghcr.io/spinkube/spin-operator:dev make docker-build"`); p.Err() != nil { - - return ctx, fmt.Errorf(ErrFormat, p.Err(), p.Out()) + if os.Getenv("E2E_SKIP_BUILD") == "" { // nolint:forbidigo + if p := utils.RunCommand(`bash -c "cd .. && IMG=ghcr.io/spinkube/spin-operator:dev make docker-build"`); p.Err() != nil { + return ctx, fmt.Errorf(ErrFormat, p.Err(), p.Out()) + } } if p := utils.RunCommand(("k3d image import -c " + cluster.name + " ghcr.io/spinkube/spin-operator:dev")); p.Err() != nil {