Skip to content
Open
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
1 change: 1 addition & 0 deletions acceptance/ssh/connect-serverless-cpu/known_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# not actually checked by tests; accept-new appends the ephemeral host key here
7 changes: 5 additions & 2 deletions acceptance/ssh/connect-serverless-cpu/out.test.toml

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

37 changes: 37 additions & 0 deletions acceptance/ssh/connect-serverless-cpu/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

>>> print_requests.py //api/2.2/jobs/runs/submit
{
"method": "POST",
"path": "/api/2.2/jobs/runs/submit",
"body": {
"environments": [
{
"environment_key": "ssh_tunnel_serverless",
"spec": {
"environment_version": "4"
}
}
],
"run_name": "ssh-server-bootstrap-[CPU_CONN]",
"tasks": [
{
"environment_key": "ssh_tunnel_serverless",
"notebook_task": {
"base_parameters": {
"authorizedKeySecretName": "client-public-key",
"maxClients": "10",
"secretScopeName": "[USERNAME]-[CPU_CONN]-ssh-tunnel-keys",
"serverless": "true",
"sessionId": "[CPU_CONN]",
"shutdownDelay": "10m0s",
"version": "[CLI_VERSION]"
},
"notebook_path": "/Workspace/Users/[USERNAME]/.databricks/ssh-tunnel/[CLI_VERSION]/[CPU_CONN]/ssh-server-bootstrap"
},
"task_key": "start_ssh_server",
"timeout_seconds": 86400
}
],
"timeout_seconds": 86400
}
}
28 changes: 24 additions & 4 deletions acceptance/ssh/connect-serverless-cpu/script
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr
if [ -z "${CLOUD_ENV:-}" ]; then
# No release artifacts locally and they're never executed; stand in empty archives.
mkdir -p releases
: >releases/databricks_cli_linux_amd64.zip
: >releases/databricks_cli_linux_arm64.zip
CLI_RELEASES_DIR="$PWD/releases"
fi

if ! grep -q "Connection successful" out.stdout.txt; then
run_id=$(cat LOG.stderr | grep -o "Job submitted successfully with run ID: [0-9]*" | grep -o "[0-9]*$")
trace $CLI jobs get-run "$run_id" > LOG.job
if [ -n "${CLOUD_ENV:-}" ]; then
# Cloud: real serverless CPU runs the command; dump the run on failure.
errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr
if ! grep -q "Connection successful" out.stdout.txt; then
run_id=$(cat LOG.stderr | grep -o "Job submitted successfully with run ID: [0-9]*" | grep -o "[0-9]*$")
trace $CLI jobs get-run "$run_id" > LOG.job
fi
else
# Local: the test server backs the /ssh websocket with a real sshd, so this
# asserts the bootstrap job plus a full handshake over the tunnel. Skip when
# sshd is absent (only task test-exp-ssh provisions it).
if [ -z "$(command -v sshd || ls /usr/sbin/sshd /usr/local/sbin/sshd /sbin/sshd 2>/dev/null)" ]; then
echo "SKIP_TEST sshd (openssh-server) not installed"
exit 0
fi
errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR --user-known-hosts-file=known_hosts -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr
trace print_requests.py //api/2.2/jobs/runs/submit
fi
26 changes: 23 additions & 3 deletions acceptance/ssh/connect-serverless-cpu/test.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
Local = false
Cloud = true
Local = true
Cloud = false

# Serverless requires Unity Catalog
# Serverless requires Unity Catalog.
RequiresUnityCatalog = true

# Record requests so we can assert the bootstrap job the CLI submits.
RecordRequests = true

# Stand-in release archives staged by the local run; not golden output.
Ignore = [
"releases",
]

# The local run drives a real sshd, reliable only on Linux.
[GOOS]
linux = true
darwin = false
windows = false

# No --name: the connection name is a hash of the (random) local host, so
# normalize it to keep the submitted job payload deterministic.
[[Repls]]
Old = 'databricks-cpu-[0-9a-f]{8}'
New = "[CPU_CONN]"

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct"]
Loading