mirror of https://github.com/databricks/cli.git
move tests
This commit is contained in:
parent
de5a348b4e
commit
7dc24b6484
|
@ -0,0 +1,3 @@
|
|||
[someprofile]
|
||||
host = $DATABRICKS_HOST
|
||||
token = $DATABRICKS_TOKEN
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"path": "/api/2.0/preview/scim/v2/Me"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
>>> [CLI] bundle exec -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
# Replace placeholder with an actual host URL
|
||||
envsubst < databricks.yml > out.yml && mv out.yml databricks.yml
|
||||
envsubst < .databrickscfg > out && mv out .databrickscfg
|
||||
export DATABRICKS_CONFIG_FILE=.databrickscfg
|
||||
|
||||
|
@ -9,6 +8,3 @@ unset DATABRICKS_TOKEN
|
|||
|
||||
# This should use the profile configured in the bundle, i.e. PAT auth
|
||||
trace $CLI bundle exec -- $CLI current-user me
|
||||
|
||||
# This should use myprofile, which uses oauth.
|
||||
trace $CLI bundle exec --profile myprofile -- $CLI current-user me
|
|
@ -0,0 +1,5 @@
|
|||
bundle:
|
||||
name: foobar
|
||||
|
||||
workspace:
|
||||
profile: someprofile
|
|
@ -1,11 +1,6 @@
|
|||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"path": "/api/2.0/preview/scim/v2/Me"
|
||||
"path": "/oidc/.well-known/oauth-authorization-server"
|
||||
}
|
||||
{
|
||||
"method": "GET",
|
|
@ -1,10 +1,4 @@
|
|||
|
||||
>>> [CLI] bundle exec -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
||||
|
||||
>>> [CLI] bundle exec --profile myprofile -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
|
@ -0,0 +1,10 @@
|
|||
# Replace placeholder with an actual host URL
|
||||
envsubst < .databrickscfg > out && mv out .databrickscfg
|
||||
export DATABRICKS_CONFIG_FILE=.databrickscfg
|
||||
|
||||
# Credentials will be picked up from .databrickscfg. Unset existing credentials.
|
||||
unset DATABRICKS_HOST
|
||||
unset DATABRICKS_TOKEN
|
||||
|
||||
# This should use myprofile, which uses oauth.
|
||||
trace $CLI bundle exec --profile myprofile -- $CLI current-user me
|
|
@ -0,0 +1,8 @@
|
|||
[pat-profile]
|
||||
host = $DATABRICKS_HOST
|
||||
token = $DATABRICKS_TOKEN
|
||||
|
||||
[oauth-profile]
|
||||
host = $DATABRICKS_HOST
|
||||
client_id = client_id
|
||||
client_secret = client_secret
|
|
@ -4,7 +4,9 @@ bundle:
|
|||
targets:
|
||||
pat:
|
||||
default: true
|
||||
workspace:
|
||||
profile: pat-profile
|
||||
|
||||
oauth:
|
||||
workspace:
|
||||
client_id: client_id
|
||||
profile: oauth-profile
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"path": "/api/2.0/preview/scim/v2/Me"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
>>> [CLI] bundle exec -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# Replace placeholder with an actual host URL
|
||||
envsubst < .databrickscfg > out && mv out .databrickscfg
|
||||
export DATABRICKS_CONFIG_FILE=.databrickscfg
|
||||
|
||||
# Credentials will be picked up from .databrickscfg. Unset existing credentials.
|
||||
unset DATABRICKS_HOST
|
||||
unset DATABRICKS_TOKEN
|
||||
|
||||
# Should use default target, which is bat based authentication
|
||||
trace $CLI bundle exec -- $CLI current-user me
|
|
@ -0,0 +1,8 @@
|
|||
[pat-profile]
|
||||
host = $DATABRICKS_HOST
|
||||
token = $DATABRICKS_TOKEN
|
||||
|
||||
[oauth-profile]
|
||||
host = $DATABRICKS_HOST
|
||||
client_id = client_id
|
||||
client_secret = client_secret
|
|
@ -0,0 +1,12 @@
|
|||
bundle:
|
||||
name: foobar
|
||||
|
||||
targets:
|
||||
pat:
|
||||
default: true
|
||||
workspace:
|
||||
profile: pat-profile
|
||||
|
||||
oauth:
|
||||
workspace:
|
||||
profile: oauth-profile
|
|
@ -1,20 +1,6 @@
|
|||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"path": "/api/2.0/preview/scim/v2/Me"
|
||||
}
|
||||
{
|
||||
"headers": {
|
||||
"Authorization": [
|
||||
"Bearer [DATABRICKS_TOKEN]"
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"path": "/api/2.0/preview/scim/v2/Me"
|
||||
"path": "/oidc/.well-known/oauth-authorization-server"
|
||||
}
|
||||
{
|
||||
"method": "GET",
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
>>> [CLI] bundle exec -t oauth -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# Replace placeholder with an actual host URL
|
||||
envsubst < .databrickscfg > out && mv out .databrickscfg
|
||||
export DATABRICKS_CONFIG_FILE=.databrickscfg
|
||||
|
||||
# Credentials will be picked up from .databrickscfg. Unset existing credentials.
|
||||
unset DATABRICKS_HOST
|
||||
unset DATABRICKS_TOKEN
|
||||
|
||||
# Explicitly select oauth target
|
||||
trace $CLI bundle exec -t oauth -- $CLI current-user me
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
>>> [CLI] bundle exec -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
||||
|
||||
>>> [CLI] bundle exec -t pat -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
||||
|
||||
>>> errcode [CLI] bundle exec -t pat -- [CLI] current-user me -t oauth
|
||||
Error: cannot resolve bundle auth configuration: validate: more than one authorization method configured: oauth and pat. Config: host=[DATABRICKS_URL], token=***, client_id=client_id, databricks_cli_path=[CLI]. Env: DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_CLI_PATH
|
||||
Error: running "[CLI] current-user me -t oauth" failed with exit code: 1
|
||||
|
||||
Exit code: 1
|
||||
|
||||
>>> [CLI] bundle exec -t oauth -- [CLI] current-user me
|
||||
{
|
||||
"id":"[USERID]",
|
||||
"userName":"[USERNAME]"
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
# Default target
|
||||
trace $CLI bundle exec -- $CLI current-user me
|
||||
|
||||
# Explicitly select default target
|
||||
trace $CLI bundle exec -t pat -- $CLI current-user me
|
||||
|
||||
# Conflicting targets selected. This should fail because for the child command
|
||||
# pat would be configured via environment variables and oauth via the CLI resulting
|
||||
# in more than one authorization method configured.
|
||||
trace errcode $CLI bundle exec -t pat -- $CLI current-user me -t oauth
|
||||
|
||||
# Explicitly select oauth target
|
||||
unset DATABRICKS_TOKEN
|
||||
export DATABRICKS_CLIENT_SECRET="client_secret"
|
||||
trace $CLI bundle exec -t oauth -- $CLI current-user me
|
Loading…
Reference in New Issue