From 23ddee8023bae3d069d2097f518905f4bb217fa8 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 17 Dec 2024 18:16:58 +0100 Subject: [PATCH] Skip job runs during integration testing for PRs (#2024) ## Changes A small subset of tests trigger cluster creation to run jobs. These tests comprise a substantial amount of the total integration test runtime. We can skip them on PRs and only run them on the main branch. ## Tests Confirmed the short runtime is ~20 mins. --- Makefile | 11 ++++++++--- integration/bundle/clusters_test.go | 5 +++++ integration/bundle/python_wheel_test.go | 5 +++++ integration/bundle/spark_jar_test.go | 5 +++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6c849986e..a7c0584fa 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,12 @@ vendor: @echo "✓ Filling vendor folder with library code ..." @go mod vendor -integration: - gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h +INTEGRATION = gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h -.PHONY: lint lintcheck test testonly coverage build snapshot vendor integration +integration: + $(INTEGRATION) + +integration-short: + $(INTEGRATION) -short + +.PHONY: lint lintcheck test testonly coverage build snapshot vendor integration integration-short diff --git a/integration/bundle/clusters_test.go b/integration/bundle/clusters_test.go index f9e5c9b64..c153b8733 100644 --- a/integration/bundle/clusters_test.go +++ b/integration/bundle/clusters_test.go @@ -44,6 +44,11 @@ func TestDeployBundleWithCluster(t *testing.T) { require.NoError(t, err) require.NotNil(t, cluster) + if testing.Short() { + t.Log("Skip the job run in short mode") + return + } + out, err := runResource(t, ctx, root, "foo") require.NoError(t, err) require.Contains(t, out, "Hello World!") diff --git a/integration/bundle/python_wheel_test.go b/integration/bundle/python_wheel_test.go index 5cca1cb53..f7fb1ff3f 100644 --- a/integration/bundle/python_wheel_test.go +++ b/integration/bundle/python_wheel_test.go @@ -29,6 +29,11 @@ func runPythonWheelTest(t *testing.T, templateName, sparkVersion string, pythonW destroyBundle(t, ctx, bundleRoot) }) + if testing.Short() { + t.Log("Skip the job run in short mode") + return + } + out, err := runResource(t, ctx, bundleRoot, "some_other_job") require.NoError(t, err) require.Contains(t, out, "Hello from my func") diff --git a/integration/bundle/spark_jar_test.go b/integration/bundle/spark_jar_test.go index 65893052e..cbdf5a00c 100644 --- a/integration/bundle/spark_jar_test.go +++ b/integration/bundle/spark_jar_test.go @@ -30,6 +30,11 @@ func runSparkJarTestCommon(t *testing.T, ctx context.Context, sparkVersion, arti destroyBundle(t, ctx, bundleRoot) }) + if testing.Short() { + t.Log("Skip the job run in short mode") + return + } + out, err := runResource(t, ctx, bundleRoot, "jar_job") require.NoError(t, err) require.Contains(t, out, "Hello from Jar!")