Skip to content

Commit af8c7c6

Browse files
pieternclaude
andauthored
Fix acceptance tests to use explicit job ID replacements (#4225)
## Changes Captures job ID after deployment and adds to `ACC_REPLS` for runtime replacement. This prevents non-deterministic test failures when job IDs happen to match timestamp patterns (13-digit numbers starting with `1[78]`). ## Why Discovered in integration test run where job ID 1719463871887 matched the timestamp regex and was incorrectly replaced with `[UNIX_TIME_MILLIS]` instead of `[NUMID]`: ``` >>> [CLI] bundle run some_other_job --python-params param1,param2 -Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID] +Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[UNIX_TIME_MILLIS]/run/[NUMID] ``` ## Tests Updates 10 acceptance tests: - 9 in bundle/integration_whl/ - 1 in bundle/resources/clusters/run/spark_python_task Each test now: 1. Captures job ID with `read_id.py` after deployment 2. Adds `job_id:JOB_ID` mapping to `ACC_REPLS` 3. Expects `[JOB_ID]` instead of `[NUMID]` in Run URLs This follows the pattern established in bundle/resources/jobs/update. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 439c36c commit af8c7c6

File tree

20 files changed

+66
-17
lines changed

20 files changed

+66
-17
lines changed

acceptance/bundle/integration_whl/base/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Updating deployment state...
3939
Deployment complete!
4040

4141
>>> [CLI] bundle run some_other_job
42-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
42+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
4343

4444
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
4545
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS
@@ -57,7 +57,7 @@ Updating deployment state...
5757
Deployment complete!
5858

5959
>>> [CLI] bundle run some_other_job
60-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
60+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
6161

6262
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
6363
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS

acceptance/bundle/integration_whl/base/script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ envsubst < databricks.yml.tmpl > databricks.yml
33
trace cat databricks.yml
44
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
55
trace $CLI bundle deploy
6+
7+
# Capture job ID and add to runtime replacements to avoid pattern matching ambiguity
8+
job_id=$(read_id.py jobs some_other_job)
9+
echo "$job_id:JOB_ID" >> ACC_REPLS
10+
611
trace $CLI bundle run some_other_job
712

813
title "Make a change to code without version change and run the job again"

acceptance/bundle/integration_whl/custom_params/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Updating deployment state...
3939
Deployment complete!
4040

4141
>>> [CLI] bundle run some_other_job --python-params param1,param2
42-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
42+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
4343

4444
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
4545
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS

acceptance/bundle/integration_whl/custom_params/script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ cp -r $TESTDIR/../base/{$EXTRA_CONFIG,setup.py,my_test_code} .
44
trace cat databricks.yml
55
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
66
trace $CLI bundle deploy
7+
8+
# Capture job ID and add to runtime replacements to avoid pattern matching ambiguity
9+
job_id=$(read_id.py jobs some_other_job)
10+
echo "$job_id:JOB_ID" >> ACC_REPLS
11+
712
trace $CLI bundle run some_other_job --python-params param1,param2

acceptance/bundle/integration_whl/interactive_cluster/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Updating deployment state...
3939
Deployment complete!
4040

4141
>>> [CLI] bundle run some_other_job
42-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
42+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
4343

4444
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
4545
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS
@@ -57,7 +57,7 @@ Updating deployment state...
5757
Deployment complete!
5858

5959
>>> [CLI] bundle run some_other_job
60-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
60+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
6161

6262
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
6363
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS

acceptance/bundle/integration_whl/interactive_cluster/script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ envsubst < databricks.yml.tmpl > databricks.yml
33
trace cat databricks.yml
44
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
55
trace $CLI bundle deploy
6+
7+
# Capture job ID and add to runtime replacements to avoid pattern matching ambiguity
8+
job_id=$(read_id.py jobs some_other_job)
9+
echo "$job_id:JOB_ID" >> ACC_REPLS
10+
611
trace $CLI bundle run some_other_job
712

813
title "Make a change to code without version change and run the job again"

acceptance/bundle/integration_whl/interactive_cluster_dynamic_version/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Updating deployment state...
88
Deployment complete!
99

1010
>>> [CLI] bundle run some_other_job
11-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
11+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
1212

1313
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
1414
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS
@@ -26,7 +26,7 @@ Updating deployment state...
2626
Deployment complete!
2727

2828
>>> [CLI] bundle run some_other_job
29-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
29+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
3030

3131
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
3232
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS

acceptance/bundle/integration_whl/interactive_cluster_dynamic_version/script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ envsubst < databricks.yml.tmpl > databricks.yml
22
cp -r $TESTDIR/../interactive_cluster/{setup.py,my_test_code} .
33
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
44
trace $CLI bundle deploy
5+
6+
# Capture job ID and add to runtime replacements to avoid pattern matching ambiguity
7+
job_id=$(read_id.py jobs some_other_job)
8+
echo "$job_id:JOB_ID" >> ACC_REPLS
9+
510
trace $CLI bundle run some_other_job
611

712
title "Make a change to code without version change and run the job again"

acceptance/bundle/integration_whl/interactive_single_user/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Updating deployment state...
3939
Deployment complete!
4040

4141
>>> [CLI] bundle run some_other_job
42-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
42+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
4343

4444
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
4545
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS
@@ -54,7 +54,7 @@ Updating deployment state...
5454
Deployment complete!
5555

5656
>>> [CLI] bundle run some_other_job
57-
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]
57+
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[JOB_ID]/run/[NUMID]
5858

5959
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" RUNNING
6060
[TIMESTAMP] "[default] Test Wheel Job [UNIQUE_NAME]" TERMINATED SUCCESS

acceptance/bundle/integration_whl/interactive_single_user/script

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ trace cat databricks.yml
44
cp -r $TESTDIR/../interactive_cluster/{setup.py,my_test_code} .
55
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
66
trace $CLI bundle deploy
7+
8+
# Capture job ID and add to runtime replacements to avoid pattern matching ambiguity
9+
job_id=$(read_id.py jobs some_other_job)
10+
echo "$job_id:JOB_ID" >> ACC_REPLS
11+
712
trace $CLI bundle run some_other_job > out.$DATABRICKS_BUNDLE_ENGINE.txt
813

914
title "Make a change to code without version change and run the job again"

0 commit comments

Comments
 (0)