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
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.

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

=== CLI ssh connect (local sshd)

>>> 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
}
}
29 changes: 25 additions & 4 deletions acceptance/ssh/connect-serverless-cpu/script
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr
if [ -n "${CLOUD_ENV:-}" ]; then
# Cloud: real serverless CPU runs the command; dump the run on failure.
title "CLI ssh connect (serverless CPU)\n"
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
Comment thread
radakam marked this conversation as resolved.
# 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

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
# No release artifacts locally and they're never executed; stand in empty archives.
mkdir -p releases
touch releases/databricks_cli_linux_amd64.zip
touch releases/databricks_cli_linux_arm64.zip
CLI_RELEASES_DIR="$PWD/releases"

title "CLI ssh connect (local sshd)\n"
errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR --user-known-hosts-file=known_hosts -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to have the core of this test CLI ssh connect traced and/or titled. optional args could be set based on env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a title "CLI ssh connect ..." so the core command shows up in the golden output, but left the actual invocation on errcode + redirect rather than trace because its stdout/stderr are non-deterministic.

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