Skip to content

Commit c9d9723

Browse files
authored
acc: Add contains.py helper script (#3345)
## Changes - New script 'contains' for acceptance tests. - Update some tests to use that. - Modify musterr not to log anything in the common case (when error did happen). The log messages from musterr and contains.py race and result in unstable output (musterr some_script | contains.py message). ## Why This both records snapshot and communicates intent. #3339 (comment)
1 parent a27787e commit c9d9723

File tree

75 files changed

+60
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+60
-197
lines changed

.wsignore

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,8 @@ experimental/python/docs/images/databricks-logo.svg
1717
# In order to prevent that difference, hello.txt does not have a trailing newline.
1818
acceptance/selftest/record_cloud/volume-io/hello.txt
1919

20-
# error output when artifact build fails contains trailing whitespace:
21-
acceptance/bundle/artifacts/shell/err-bash/output.txt
22-
acceptance/bundle/artifacts/shell/err-sh/output.txt
23-
24-
# "bundle init" has trailing whitespace:
25-
acceptance/bundle/templates-machinery/helpers-error/output.txt
26-
27-
# "bundle deploy" with apps has trailing whitespace:
28-
integration/bundle/testdata/apps/bundle_deploy.txt
29-
30-
# Extra whitespace in test output:
31-
acceptance/bundle/resource_deps/bad_syntax/out.plan.terraform.txt
32-
acceptance/bundle/upload/internal_server_error/output.txt
33-
34-
# Extra whitespace in command help:
35-
acceptance/cmd/workspace/apps/output.txt
20+
# bundle commands leave empty lines at the end; too many to list individually:
21+
acceptance/**/out*.txt
3622

3723
# Extra whitespace in generated commands:
3824
cmd/workspace/**/*.go

acceptance/bin/contains.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
import sys
3+
4+
targets = sys.argv[1:]
5+
assert targets
6+
found = set()
7+
8+
for line in sys.stdin:
9+
sys.stdout.write(line)
10+
for t in targets:
11+
if t in line:
12+
found.add(t)
13+
14+
sys.stdout.flush()
15+
16+
not_found = set(targets) - found
17+
for item in sorted(not_found):
18+
sys.stderr.write(f"contains error: {item!r} not found in the output.\n")

acceptance/bundle/lifecycle/prevent-destroy/out.direct-exp.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Error: resources.pipelines.my_pipelines has lifecycle.prevent_destroy set, but t
44
resources.schemas.my_schema has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for resources.schemas.my_schema
55

66

7-
Exit code (musterr): 1
8-
97
>>> errcode [CLI] bundle plan
108
recreate pipelines.my_pipelines
119

@@ -16,8 +14,6 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/de
1614
Error: resources.pipelines.my_pipelines has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for resources.pipelines.my_pipelines
1715

1816

19-
Exit code (musterr): 1
20-
2117
>>> errcode [CLI] bundle plan
2218
recreate pipelines.my_pipelines
2319
recreate schemas.my_schema
@@ -30,8 +26,6 @@ Error: resources.pipelines.my_pipelines has lifecycle.prevent_destroy set, but t
3026
resources.schemas.my_schema has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for resources.schemas.my_schema
3127

3228

33-
Exit code (musterr): 1
34-
3529
>>> errcode [CLI] bundle plan
3630
recreate pipelines.my_pipelines
3731
recreate schemas.my_schema

acceptance/bundle/lifecycle/prevent-destroy/out.terraform.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ the scope of the plan using the -target flag.
2424

2525

2626

27-
Exit code (musterr): 1
28-
2927
>>> errcode [CLI] bundle plan
3028
Error: exit status 1
3129

@@ -59,8 +57,6 @@ the scope of the plan using the -target flag.
5957

6058

6159

62-
Exit code (musterr): 1
63-
6460
>>> errcode [CLI] bundle plan
6561
Error: exit status 1
6662

@@ -114,8 +110,6 @@ the scope of the plan using the -target flag.
114110

115111

116112

117-
Exit code (musterr): 1
118-
119113
>>> errcode [CLI] bundle plan
120114
recreate pipelines.my_pipelines
121115
recreate schemas.my_schema

acceptance/bundle/open/output.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Deployment complete!
2323
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
2424
Error: exec: "open": cannot run executable found relative to current directory
2525

26-
Exit code (musterr): 1
27-
2826
=== test auto-completion handler
2927
>>> [CLI] __complete bundle open ,
3028
foo

acceptance/bundle/python/restricted-execution/output.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,5 @@ value_from_env
1717
Error: Running Python code is not allowed when DATABRICKS_BUNDLE_RESTRICTED_CODE_EXECUTION is set
1818

1919

20-
Exit code (musterr): 1
21-
2220
>>> musterr cat envs.txt
2321
cat: envs.txt: No such file or directory
24-
25-
Exit code (musterr): 1

acceptance/bundle/resource_deps/bad_ref_string_to_int/out.plan.direct-exp.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ Error: cannot plan resources.jobs.foo: cannot update tasks[0].run_job_task.job_i
44

55
Error: planning failed
66

7-
8-
Exit code (musterr): 1

acceptance/bundle/resource_deps/bad_ref_string_to_int/out.plan.terraform.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ Error: Incorrect attribute value type
1212
Inappropriate value for attribute "job_id": a number is required.
1313

1414

15-
16-
Exit code (musterr): 1

acceptance/bundle/resource_deps/create_error/out.deploy.direct-exp.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ Error: cannot create resources.jobs.bar: dependency failed: resources.jobs.foo
1212
Error: cannot create resources.jobs.baz: dependency failed: resources.jobs.foo
1313

1414
Updating deployment state...
15-
16-
Exit code (musterr): 1

acceptance/bundle/resource_deps/create_error/out.deploy.terraform.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ Error: cannot create job: INJECTED
1111

1212

1313
Updating deployment state...
14-
15-
Exit code (musterr): 1

0 commit comments

Comments
 (0)