databricks-cli/internal
Anton Nekipelov 3aef065c5c
Refactor TestSparkJarTask* tests to support test environments without Java 8 (#2385)
## Changes
1. Refactored `TestSparkJarTaskDeployAndRunOnVolumes` and
`TestSparkJarTaskDeployAndRunOnWorkspace` to use a table-driven approach
for better organization of similar tests
2. Implemented `testutil.HasJDK()` to replace `testutil.RequireJDK` to
be able to skip tests
3. Ensured the test suite properly fails if no compatible Java version
is found

## Why
It can be tricky to have Java 8 installed on modern dev environments
(e.g. Mac on Apple M3 chip). The absence of which previously caused the
Spark Jar task tests to fail when run locally. This refactoring allows
such environments to be able to run "SparkJar" tests using a newer
Databricks Runtime.

## Tests
1. Ran `TestSparkJarTaskDeployAndRunOnVolumes` and
`TestSparkJarTaskDeployAndRunOnWorkspace` locally on Mac with Java11
installed.
2. Checked that tests against older runtimes are still being run and
passing in CI/CD environments
2025-02-28 08:39:21 +00:00
..
bugbash Fixed downloading arm64 binaries (#2021) 2024-12-16 17:34:22 +01:00
build Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
mocks Rewrite 'interface{} -> any' (#1959) 2024-12-05 15:37:24 +00:00
testcli Add NoLog option on testcli.Runner (#2183) 2025-01-20 09:57:48 +01:00
testutil Refactor TestSparkJarTask* tests to support test environments without Java 8 (#2385) 2025-02-28 08:39:21 +00:00