Skip to content

Commit e9e0b4a

Browse files
committed
acceptance/cmd/api: assert X-Databricks-Org-Id presence/absence explicitly
Each test now uses print_requests.py | contains.py to assert the recorded request either does or does not carry the routing identifier. The intent (header sent or not, with what value) is now visible in the script and in output.txt, instead of being implied by the recorded out.requests.txt artifact alone. Co-authored-by: Isaac
1 parent 1ea4ffc commit e9e0b4a

14 files changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
11
{}
2+
3+
>>> print_requests.py --get --keep //api/2.0/clusters/list
4+
{
5+
"headers": {
6+
"Authorization": [
7+
"Bearer [DATABRICKS_TOKEN]"
8+
],
9+
"User-Agent": [
10+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
11+
]
12+
},
13+
"method": "GET",
14+
"path": "/api/2.0/clusters/list"
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$CLI api get /api/2.0/clusters/list --account
2+
trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
11
{}
2+
3+
>>> print_requests.py --get --keep //api/2.0/accounts/abc-123/network-policies
4+
{
5+
"headers": {
6+
"Authorization": [
7+
"Bearer [DATABRICKS_TOKEN]"
8+
],
9+
"User-Agent": [
10+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
11+
]
12+
},
13+
"method": "GET",
14+
"path": "/api/2.0/accounts/abc-123/network-policies"
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$CLI api get /api/2.0/accounts/abc-123/network-policies
2+
trace print_requests.py --get --keep //api/2.0/accounts/abc-123/network-policies | contains.py "!X-Databricks-Org-Id"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
11
{}
2+
3+
>>> print_requests.py --get --keep //api/2.0/clusters/list
4+
{
5+
"headers": {
6+
"Authorization": [
7+
"Bearer [DATABRICKS_TOKEN]"
8+
],
9+
"User-Agent": [
10+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
11+
],
12+
"X-Databricks-Org-Id": [
13+
"999"
14+
]
15+
},
16+
"method": "GET",
17+
"path": "/api/2.0/clusters/list"
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$CLI api get /api/2.0/clusters/list --workspace-id 999
2+
trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
{}
2+
3+
>>> print_requests.py --get --keep //api/2.0/clusters/list
4+
{
5+
"headers": {
6+
"Authorization": [
7+
"Bearer [DATABRICKS_TOKEN]"
8+
],
9+
"User-Agent": [
10+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
11+
],
12+
"X-Databricks-Org-Id": [
13+
"999"
14+
]
15+
},
16+
"method": "GET",
17+
"path": "/api/2.0/clusters/list",
18+
"q": {
19+
"o": "999"
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$CLI api get "/api/2.0/clusters/list?o=999"
2+
trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "X-Databricks-Org-Id" "999"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
11
{}
2+
3+
>>> print_requests.py --get --keep //api/2.0/clusters/list
4+
{
5+
"headers": {
6+
"Authorization": [
7+
"Bearer [DATABRICKS_TOKEN]"
8+
],
9+
"User-Agent": [
10+
"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat"
11+
]
12+
},
13+
"method": "GET",
14+
"path": "/api/2.0/clusters/list"
15+
}

acceptance/cmd/api/workspace-id-none/script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ workspace_id = none
1010
EOF
1111

1212
$CLI api get /api/2.0/clusters/list --profile spog-account
13+
trace print_requests.py --get --keep //api/2.0/clusters/list | contains.py "!X-Databricks-Org-Id"

0 commit comments

Comments
 (0)