mirror of https://github.com/databricks/cli.git
acc: replace LocalOnly option with Local & Cloud (#2387)
## Changes Instead of LocalOnly with non-composable semantics there are two composable options: - Local - enable test locally - Cloud - enable test on the cloud By default Cloud is switched off except in bundle (but not in bundle/variables and bundle/help). ## Tests Using this in #2383 to have test that runs on cloud but not locally.
This commit is contained in:
parent
b6bf035e7f
commit
81606cfcbc
|
@ -217,8 +217,12 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
||||||
}
|
}
|
||||||
|
|
||||||
cloudEnv := os.Getenv("CLOUD_ENV")
|
cloudEnv := os.Getenv("CLOUD_ENV")
|
||||||
if isTruePtr(config.LocalOnly) && cloudEnv != "" {
|
if !isTruePtr(config.Local) && cloudEnv == "" {
|
||||||
t.Skipf("Disabled via LocalOnly setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
|
t.Skipf("Disabled via Local setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isTruePtr(config.Cloud) && cloudEnv != "" {
|
||||||
|
t.Skipf("Disabled via Cloud setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
|
||||||
}
|
}
|
||||||
|
|
||||||
var tmpDir string
|
var tmpDir string
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
LocalOnly=true
|
|
||||||
|
|
||||||
# Some of the clouds have DATABRICKS_HOST variable setup without https:// prefix
|
# Some of the clouds have DATABRICKS_HOST variable setup without https:// prefix
|
||||||
# In the result, output is replaced with DATABRICKS_URL variable instead of DATABRICKS_HOST
|
# In the result, output is replaced with DATABRICKS_URL variable instead of DATABRICKS_HOST
|
||||||
# This is a workaround to replace DATABRICKS_URL with DATABRICKS_HOST
|
# This is a workaround to replace DATABRICKS_URL with DATABRICKS_HOST
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
LocalOnly = true
|
|
||||||
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
IncludeRequestHeaders = ["Authorization", "User-Agent"]
|
IncludeRequestHeaders = ["Authorization", "User-Agent"]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
||||||
[[Repls]]
|
[[Repls]]
|
||||||
# The keys are unsorted and also vary per OS
|
# The keys are unsorted and also vary per OS
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
LocalOnly = true # This test needs to run against stubbed Databricks API
|
Cloud = false # This test needs to run against stubbed Databricks API
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
Pattern = "GET /api/2.1/jobs/get"
|
Pattern = "GET /api/2.1/jobs/get"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Cloud = false
|
|
@ -1,5 +1,5 @@
|
||||||
# We run this test only locally for now because we need to figure out how to do
|
# We run this test only locally for now because we need to figure out how to do
|
||||||
# bundle destroy on script.cleanup first.
|
# bundle destroy on script.cleanup first.
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# We run this test only locally for now because we need to figure out how to do
|
# We run this test only locally for now because we need to figure out how to do
|
||||||
# bundle destroy on script.cleanup first.
|
# bundle destroy on script.cleanup first.
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Badness = '''(minor) error message is not great: executing "" at <user_name>: error calling user_name:'''
|
Badness = '''(minor) error message is not great: executing "" at <user_name>: error calling user_name:'''
|
||||||
LocalOnly = true
|
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
Pattern = "GET /api/2.0/preview/scim/v2/Me"
|
Pattern = "GET /api/2.0/preview/scim/v2/Me"
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
LocalOnly = true
|
|
|
@ -1,2 +1 @@
|
||||||
# Testing template machinery, by default there is no need to check against cloud.
|
Cloud = false
|
||||||
LocalOnly = true
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
# At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on.
|
# At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on.
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Local = true
|
||||||
|
Cloud = true
|
|
@ -1,6 +1,6 @@
|
||||||
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
|
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
|
||||||
# and run this test only locally
|
# and run this test only locally
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
Pattern = "GET /api/2.1/clusters/get"
|
Pattern = "GET /api/2.1/clusters/get"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
|
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
|
||||||
# and run this test only locally
|
# and run this test only locally
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
Pattern = "GET /api/2.1/clusters/get"
|
Pattern = "GET /api/2.1/clusters/get"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# The tests here intend to test variable interpolation via "bundle validate".
|
# The tests here intend to test variable interpolation via "bundle validate".
|
||||||
# Even though "bundle validate" does a few API calls, that's not the focus there.
|
# Even though "bundle validate" does a few API calls, that's not the focus there.
|
||||||
LocalOnly = true
|
Cloud = false
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LocalOnly = true
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
|
|
|
@ -24,8 +24,11 @@ type TestConfig struct {
|
||||||
// If absent, default to true.
|
// If absent, default to true.
|
||||||
GOOS map[string]bool
|
GOOS map[string]bool
|
||||||
|
|
||||||
// If true, do not run this test against cloud environment
|
// If true, run this test when running locally with a testserver
|
||||||
LocalOnly *bool
|
Local *bool
|
||||||
|
|
||||||
|
// If true, run this test when running with cloud env configured
|
||||||
|
Cloud *bool
|
||||||
|
|
||||||
// List of additional replacements to apply on this test.
|
// List of additional replacements to apply on this test.
|
||||||
// Old is a regexp, New is a replacement expression.
|
// Old is a regexp, New is a replacement expression.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LocalOnly = true
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
LocalOnly = true
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
Local = true
|
||||||
|
Cloud = true
|
||||||
|
|
||||||
[[Repls]]
|
[[Repls]]
|
||||||
Old = 'Read complete after [^\s]+'
|
Old = 'Read complete after [^\s]+'
|
||||||
New = 'Read complete after (redacted)'
|
New = 'Read complete after (redacted)'
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Default settings that apply to all tests unless overriden by test.toml files in inner directories.
|
||||||
|
Local = true
|
||||||
|
Cloud = false
|
|
@ -1,4 +1,3 @@
|
||||||
LocalOnly = true # request recording currently does not work with cloud environment
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
|
|
||||||
[[Server]]
|
[[Server]]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LocalOnly = true # request recording currently does not work with cloud environment
|
|
||||||
RecordRequests = true
|
RecordRequests = true
|
||||||
IncludeRequestHeaders = ["Authorization", "User-Agent"]
|
IncludeRequestHeaders = ["Authorization", "User-Agent"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue