Skip to content
Merged
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
19 changes: 19 additions & 0 deletions acceptance/bin/echo_browser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
"""
Fake browser that prints the URL it was asked to open and exits.

Used by acceptance tests that exercise commands which call libs/browser.Open
but don't need to follow the URL (unlike auth tests, which use browser.py to
close the OAuth callback loop). Setting BROWSER=echo_browser.py is portable
across darwin/linux/windows because libs/browser routes through libs/exec.

Usage: echo_browser.py <url>
"""

import sys

if len(sys.argv) < 2:
sys.stderr.write("Usage: echo_browser.py <url>\n")
sys.exit(1)

print(sys.argv[1])
2 changes: 0 additions & 2 deletions acceptance/bundle/open/open

This file was deleted.

2 changes: 0 additions & 2 deletions acceptance/bundle/open/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions acceptance/bundle/open/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Deploying resources...
Updating deployment state...
Deployment complete!

=== Modify PATH so that real open is not run
=== open after deployment. This will fail to open browser and complain, that's ok, we only want the message
=== Use a fake browser that just prints the URL it would have opened
=== open after deployment
>>> [CLI] bundle open foo
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
Error: exec: "open": cannot run executable found relative to current directory
[DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]

=== test auto-completion handler
>>> [CLI] __complete bundle open ,
Expand Down
8 changes: 4 additions & 4 deletions acceptance/bundle/open/script
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ errcode trace $CLI bundle open foo

errcode trace $CLI bundle deploy

title "Modify PATH so that real open is not run"
export PATH=.:$PATH
title "Use a fake browser that just prints the URL it would have opened"
export BROWSER="echo_browser.py"

title "open after deployment. This will fail to open browser and complain, that's ok, we only want the message"
musterr trace $CLI bundle open foo
title "open after deployment"
trace $CLI bundle open foo

title "test auto-completion handler"
trace $CLI __complete bundle open ,
2 changes: 0 additions & 2 deletions acceptance/bundle/open/test.toml

This file was deleted.

2 changes: 0 additions & 2 deletions acceptance/bundle/state/force_pull_commands/open

This file was deleted.

2 changes: 0 additions & 2 deletions acceptance/bundle/state/force_pull_commands/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions acceptance/bundle/state/force_pull_commands/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Deploying resources...
Updating deployment state...
Deployment complete!

=== Modify PATH so that real open is not run
=== Use a fake browser that just prints the URL it would have opened
=== bundle summary without --force-pull: no remote state read

>>> [CLI] bundle summary
Expand All @@ -22,13 +22,11 @@ Deployment complete!

>>> [CLI] bundle open foo
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
Error: exec: "open": cannot run executable found relative to current directory

=== bundle open --force-pull: remote state read

>>> [CLI] bundle open foo --force-pull
Opening browser at [DATABRICKS_URL]/jobs/[NUMID]?o=[NUMID]
Error: exec: "open": cannot run executable found relative to current directory
{
"method": "GET",
"path": "/api/2.0/workspace-files/Workspace/Users/[USERNAME]/.bundle/force-pull-commands/default/state/STATE_FILENAME"
Expand Down
8 changes: 4 additions & 4 deletions acceptance/bundle/state/force_pull_commands/script
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
trace $CLI bundle deploy > /dev/null
rm -f out.requests.txt

title "Modify PATH so that real open is not run"
export PATH=.:$PATH
title "Use a fake browser that just prints the URL it would have opened"
export BROWSER="echo_browser.py"

# touch out.requests.txt before each print_requests.py call: the commands without
# --force-pull make zero HTTP requests, so the file is never created and
Expand All @@ -19,11 +19,11 @@ touch out.requests.txt
print_requests.py --get //workspace-files/

title "bundle open without --force-pull: no remote state read\n"
musterr trace $CLI bundle open foo > /dev/null
trace $CLI bundle open foo > /dev/null
touch out.requests.txt
print_requests.py --get //workspace-files/

title "bundle open --force-pull: remote state read\n"
musterr trace $CLI bundle open foo --force-pull > /dev/null
trace $CLI bundle open foo --force-pull > /dev/null
touch out.requests.txt
print_requests.py --get //workspace-files/
5 changes: 0 additions & 5 deletions acceptance/bundle/state/force_pull_commands/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ Local = true
Cloud = false
RecordRequests = true

# bundle open opens a browser; restrict to darwin to get stable output
# (mirrors acceptance/bundle/open/test.toml).
GOOS.windows = false
GOOS.linux = false

Ignore = [".databricks"]

[EnvMatrix]
Expand Down
Loading