Skip to content

Commit 81606cf

Browse files
authored
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.
1 parent b6bf035 commit 81606cf

File tree

24 files changed

+29
-25
lines changed

24 files changed

+29
-25
lines changed

acceptance/acceptance_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
217217
}
218218

219219
cloudEnv := os.Getenv("CLOUD_ENV")
220-
if isTruePtr(config.LocalOnly) && cloudEnv != "" {
221-
t.Skipf("Disabled via LocalOnly setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
220+
if !isTruePtr(config.Local) && cloudEnv == "" {
221+
t.Skipf("Disabled via Local setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
222+
}
223+
224+
if !isTruePtr(config.Cloud) && cloudEnv != "" {
225+
t.Skipf("Disabled via Cloud setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
222226
}
223227

224228
var tmpDir string

acceptance/auth/bundle_and_profile/test.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
LocalOnly=true
2-
31
# Some of the clouds have DATABRICKS_HOST variable setup without https:// prefix
42
# In the result, output is replaced with DATABRICKS_URL variable instead of DATABRICKS_HOST
53
# This is a workaround to replace DATABRICKS_URL with DATABRICKS_HOST

acceptance/auth/credentials/test.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
LocalOnly = true
2-
31
RecordRequests = true
42
IncludeRequestHeaders = ["Authorization", "User-Agent"]
53

acceptance/bundle/debug/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LocalOnly = true
1+
Cloud = false
22

33
[[Repls]]
44
# The keys are unsorted and also vary per OS

acceptance/bundle/generate/git_job/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LocalOnly = true # This test needs to run against stubbed Databricks API
1+
Cloud = false # This test needs to run against stubbed Databricks API
22

33
[[Server]]
44
Pattern = "GET /api/2.1/jobs/get"

acceptance/bundle/help/test.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cloud = false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# We run this test only locally for now because we need to figure out how to do
22
# bundle destroy on script.cleanup first.
3-
LocalOnly = true
3+
Cloud = false
44

55
RecordRequests = true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# We run this test only locally for now because we need to figure out how to do
22
# bundle destroy on script.cleanup first.
3-
LocalOnly = true
3+
Cloud = false
44

55
RecordRequests = true

acceptance/bundle/templates-machinery/helpers-error/test.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Badness = '''(minor) error message is not great: executing "" at <user_name>: error calling user_name:'''
2-
LocalOnly = true
32

43
[[Server]]
54
Pattern = "GET /api/2.0/preview/scim/v2/Me"

acceptance/bundle/templates-machinery/helpers/test.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# Testing template machinery, by default there is no need to check against cloud.
2-
LocalOnly = true
1+
Cloud = false

acceptance/bundle/templates/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# At the moment, there are many differences across different envs w.r.t to catalog use, node type and so on.
2-
LocalOnly = true
2+
Cloud = false

acceptance/bundle/test.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Local = true
2+
Cloud = true

acceptance/bundle/trampoline/warning_message_with_new_spark/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
22
# and run this test only locally
3-
LocalOnly = true
3+
Cloud = false
44

55
[[Server]]
66
Pattern = "GET /api/2.1/clusters/get"

acceptance/bundle/trampoline/warning_message_with_old_spark/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Since we use existing cluster id value which is not available in cloud envs, we need to stub the request
22
# and run this test only locally
3-
LocalOnly = true
3+
Cloud = false
44

55
[[Server]]
66
Pattern = "GET /api/2.1/clusters/get"

acceptance/bundle/variables/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# The tests here intend to test variable interpolation via "bundle validate".
22
# Even though "bundle validate" does a few API calls, that's not the focus there.
3-
LocalOnly = true
3+
Cloud = false

acceptance/cmd/workspace/apps/test.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
LocalOnly = true
21
RecordRequests = true
32

43
[[Server]]

acceptance/config_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ type TestConfig struct {
2424
// If absent, default to true.
2525
GOOS map[string]bool
2626

27-
// If true, do not run this test against cloud environment
28-
LocalOnly *bool
27+
// If true, run this test when running locally with a testserver
28+
Local *bool
29+
30+
// If true, run this test when running with cloud env configured
31+
Cloud *bool
2932

3033
// List of additional replacements to apply on this test.
3134
// Old is a regexp, New is a replacement expression.

acceptance/selftest/server/test.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
LocalOnly = true
21
RecordRequests = true
32

43
[[Server]]

acceptance/selftest/test.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

acceptance/terraform/test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Local = true
2+
Cloud = true
3+
14
[[Repls]]
25
Old = 'Read complete after [^\s]+'
36
New = 'Read complete after (redacted)'

acceptance/test.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Default settings that apply to all tests unless overriden by test.toml files in inner directories.
2+
Local = true
3+
Cloud = false

acceptance/workspace/jobs/create-error/test.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
LocalOnly = true # request recording currently does not work with cloud environment
21
RecordRequests = true
32

43
[[Server]]

acceptance/workspace/jobs/create/test.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
LocalOnly = true # request recording currently does not work with cloud environment
21
RecordRequests = true
32
IncludeRequestHeaders = ["Authorization", "User-Agent"]
43

0 commit comments

Comments
 (0)