Skip to content

Run all bundle tests twice; once within a subdir #2680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func testAccept(t *testing.T, InprocessMode bool, singleTest string) int {
execPath = BuildCLI(t, buildDir, coverDir)
}

t.Setenv("CLI", execPath)
repls.SetPath(execPath, "[CLI]")
t.Setenv("CLI_BINARY", execPath)
repls.SetPath(execPath, "[CLI_BINARY]")

// Make helper scripts available
t.Setenv("PATH", fmt.Sprintf("%s%c%s", filepath.Join(cwd, "bin"), os.PathListSeparator, os.Getenv("PATH")))
Expand Down Expand Up @@ -233,6 +233,12 @@ func testAccept(t *testing.T, InprocessMode bool, singleTest string) int {
} else {
for _, envset := range expanded {
envname := strings.Join(envset, "/")
// Presence of $ in PATH confuses Python when building Python artifacts
// File "/private/var/folders/5y/9kkdnjw91p11vsqwk0cvmk200000gp/T/TestAcceptbundleartifactswhl_dynamicCLI=$CLI_BINARYUV_PYTHON=3.102963127949/001/.venv/lib/python3.10/site-packages/setuptools/_distutils/util.py", line 204, in subst_vars
// raise ValueError(f"invalid variable {var}")
// ValueError: invalid variable 'CLI_BINARYUV_PYTHON'
envname = strings.ReplaceAll(envname, "$", "_")

t.Run(envname, func(t *testing.T) {
if !InprocessMode {
t.Parallel()
Expand Down
3 changes: 3 additions & 0 deletions acceptance/bundle/debug/test.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[EnvMatrix]
CLI = ["$CLI_BINARY"]

[[Repls]]
# The keys are unsorted and also vary per OS
Old = 'Environment variables for Terraform: ([A-Z_ ,]+) '
Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/deploy/experimental-python/test.toml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# need deterministic ids and clean workspace
[EnvMatrix]
CLI = ["$CLI_BINARY"]
2 changes: 2 additions & 0 deletions acceptance/bundle/deployment/bind/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[EnvMatrix]
CLI = ["$CLI_BINARY"]
6 changes: 6 additions & 0 deletions acceptance/bundle/generate/git_job/output.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@

>>> [CLI] bundle generate job --existing-job-id 1234 --config-dir . --key out
Job is using Git source, skipping downloading files
Job configuration successfully saved to out.job.yml

>>> [CLI] bundle generate job --existing-job-id 1234 --config-dir . --key out
Job is using Git source, skipping downloading files
Job configuration successfully saved to out.job.yml
8 changes: 7 additions & 1 deletion acceptance/bundle/generate/git_job/script
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
$CLI bundle generate job --existing-job-id 1234 --config-dir . --key out
trace $CLI bundle generate job --existing-job-id 1234 --config-dir . --key out

mkdir subdir1
cd subdir1
trace $CLI bundle generate job --existing-job-id 1234 --config-dir . --key out
diff.py out.job.yml $TESTDIR/out.job.yml
rm out.job.yml
3 changes: 3 additions & 0 deletions acceptance/bundle/generate/git_job/test.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[EnvMatrix]
CLI = ["$CLI_BINARY"]

[[Server]]
Pattern = "GET /api/2.2/jobs/get"
Response.Body = '''
Expand Down
1 change: 1 addition & 0 deletions acceptance/bundle/python/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ UV_ARGS = [
"--with databricks-bundles==0.7.3",
"--with-requirements requirements-latest.txt --no-cache",
]
CLI = ["$CLI_BINARY"]
3 changes: 3 additions & 0 deletions acceptance/bundle/templates-machinery/test.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[EnvMatrix]
CLI = ["$CLI_BINARY"]

[[Server]]
Pattern = "POST /telemetry-ext"
Response.Body = '''
Expand Down
3 changes: 3 additions & 0 deletions acceptance/bundle/templates/test.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Local-only: At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on.

[EnvMatrix]
CLI = ["$CLI_BINARY"]

[[Server]]
Pattern = "POST /telemetry-ext"
Response.Body = '''
Expand Down
1 change: 1 addition & 0 deletions acceptance/bundle/test.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[EnvMatrix]
# The lowest Python version we support. Alternative to "uv run --python 3.10"
UV_PYTHON = ["3.10"]
CLI = ["$CLI_BINARY", "cli_subdir"]

[[Repls]]
Old = '1\d{18}'
Expand Down
11 changes: 11 additions & 0 deletions acceptance/script.prepare
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ withdir() {
return $exit_code
}

cli_subdir() {
local orig_dir="$(pwd)"
mkdir -p subdir1
cd subdir1 || return $?
$CLI_BINARY "$@"
local exit_code=$?
cd "$orig_dir" || return $?
return $exit_code
}


uuid() {
python3 -c 'import uuid; print(uuid.uuid4())'
}
Expand Down
3 changes: 3 additions & 0 deletions acceptance/test.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Default settings that apply to all tests unless overriden by test.toml files in inner directories.
Local = true
Cloud = false

[EnvMatrix]
CLI = ["$CLI_BINARY"]
Loading