databricks-cli/internal/testutil
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
..
cloud.go Remove superfluous helper (#2028) 2024-12-17 17:34:09 +00:00
copy.go Define and use `testutil.TestingT` interface (#2003) 2024-12-12 14:42:15 +00:00
env.go Add tests for default-python template on different Python versions (#2025) 2024-12-20 14:40:54 +00:00
file.go Set the write bit for files written during template initialization (#2068) 2025-01-08 13:18:28 +00:00
helpers.go Snooze mlops-stacks integration test (#2063) 2025-01-02 11:39:11 +00:00
interface.go Improve test output to include correct location (#2058) 2025-01-02 10:49:21 +01:00
jdk.go Refactor TestSparkJarTask* tests to support test environments without Java 8 (#2385) 2025-02-28 08:39:21 +00:00
requirement.go Define and use `testutil.TestingT` interface (#2003) 2024-12-12 14:42:15 +00:00
testutil_test.go Define and use `testutil.TestingT` interface (#2003) 2024-12-12 14:42:15 +00:00