From 6bb7042014f8bf92cc123edb201804a09427b597 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 17 Dec 2024 11:16:32 +0100 Subject: [PATCH 1/2] Skip job runs during integration testing for PRs --- Makefile | 2 +- integration/bundle/clusters_test.go | 5 +++++ integration/bundle/python_wheel_test.go | 5 +++++ integration/bundle/spark_jar_test.go | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b33e447c4..fb36b95de5 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,6 @@ vendor: @go mod vendor integration: - gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h + gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h -short .PHONY: fmt lint lintcheck test testonly coverage build snapshot vendor integration diff --git a/integration/bundle/clusters_test.go b/integration/bundle/clusters_test.go index f9e5c9b648..c153b87330 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 5cca1cb53f..f7fb1ff3f6 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 65893052e0..cbdf5a00c3 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!") From 9ffbdd16d48f1dfff974d7c378b9748d7d3f2e7a Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 17 Dec 2024 15:05:42 +0100 Subject: [PATCH 2/2] Add integration-short target --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fb36b95de5..c3a8f0c2fa 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,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 -short + $(INTEGRATION) + +integration-short: + $(INTEGRATION) -short -.PHONY: fmt lint lintcheck test testonly coverage build snapshot vendor integration +.PHONY: fmt lint lintcheck test testonly coverage build snapshot vendor integration integration-short