Skip to content

Commit bc54ca3

Browse files
authored
Merge branch 'main' into simonfaltum/version-update-notice
2 parents 31f5610 + 9bf4857 commit bc54ca3

43 files changed

Lines changed: 243 additions & 93 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

acceptance/acceptance_test.go

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var (
4848
WorkspaceTmpDir bool
4949
OnlyOutTestToml bool
5050
Subset bool
51+
DebugSandbox bool
5152
)
5253

5354
// In order to debug CLI running under acceptance test, search for TestInprocessMode and update
@@ -80,6 +81,7 @@ func init() {
8081
flag.BoolVar(&WorkspaceTmpDir, "workspace-tmp-dir", false, "Run tests on the workspace file system (For DBR testing).")
8182
flag.BoolVar(&OnlyOutTestToml, "only-out-test-toml", false, "Only regenerate out.test.toml files without running tests")
8283
flag.BoolVar(&Subset, "subset", false, "Select a subset of EnvMatrix variants that cover all output files. Auto-enabled on -update (unless -run specifies a variant with '=').")
84+
flag.BoolVar(&DebugSandbox, "debugsandbox", false, "Use a per-test blocking proxy instead of a shared one; shows exactly which test caused unexpected internet access (slower)")
8385
}
8486

8587
const (
@@ -328,6 +330,12 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
328330
}
329331
}
330332

333+
const sharedProxyHint = "; re-run with -debugsandbox to see which test caused this"
334+
sandboxProxyURL := ""
335+
if cloudEnv == "" && !DebugSandbox {
336+
sandboxProxyURL = internal.StartRejectingProxy(t, sharedProxyHint)
337+
}
338+
331339
setReplsForTestEnvVars(t, &repls)
332340

333341
if cloudEnv != "" && UseVersion == "" {
@@ -455,15 +463,15 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
455463
// If the matrix expands to a single empty envset, run the test directly
456464
// without creating a subtest (avoids the "#00" dummy subtest name).
457465
if len(expanded) == 1 && len(expanded[0]) == 0 {
458-
runTest(t, dir, 0, coverDir, repls.Clone(), config, nil, envFilters)
466+
runTest(t, dir, 0, coverDir, repls.Clone(), config, nil, envFilters, sandboxProxyURL)
459467
} else {
460468
for ind, envset := range expanded {
461469
envname := strings.Join(envset, "/")
462470
t.Run(envname, func(t *testing.T) {
463471
if runParallel {
464472
t.Parallel()
465473
}
466-
runTest(t, dir, ind, coverDir, repls.Clone(), config, envset, envFilters)
474+
runTest(t, dir, ind, coverDir, repls.Clone(), config, envset, envFilters, sandboxProxyURL)
467475
})
468476
}
469477
}
@@ -609,6 +617,7 @@ func runTest(t *testing.T,
609617
config internal.TestConfig,
610618
customEnv []string,
611619
envFilters []string,
620+
sharedProxyURL string,
612621
) {
613622
// Check env filters early, before creating any resources like directories on the file system.
614623
// Creating / deleting too many directories causes this error on the workspace FUSE mount:
@@ -763,6 +772,26 @@ func runTest(t *testing.T,
763772
cmd.Env = append(cmd.Env, "TESTDIR="+absDir)
764773
cmd.Env = append(cmd.Env, "CLOUD_ENV="+cloudEnv)
765774
cmd.Env = append(cmd.Env, "CURRENT_USER_NAME="+user.UserName)
775+
if !isRunningOnCloud {
776+
proxyURL := sharedProxyURL
777+
if DebugSandbox {
778+
// Per-test proxy: errors are attributed to this subtest's t, making
779+
// it immediately clear which test caused the internet access.
780+
proxyURL = internal.StartRejectingProxy(t, "")
781+
}
782+
// Only block HTTPS: the local test server is plain HTTP (http://127.0.0.1:PORT)
783+
// so HTTP_PROXY would intercept its traffic. All real external calls use HTTPS.
784+
cmd.Env = append(cmd.Env, "HTTPS_PROXY="+proxyURL)
785+
// Python's urllib does not automatically bypass the proxy for loopback
786+
// addresses the way Go does, so the test-server helper scripts
787+
// (kill_after.py, callserver.py, …) would route their requests through
788+
// the blocking proxy. NO_PROXY exempts them.
789+
cmd.Env = append(cmd.Env, "NO_PROXY=127.0.0.1,localhost")
790+
// Terraform phones home to checkpoint-api.hashicorp.com on every run to
791+
// check for updates. Disable it so these CONNECT requests don't reach the
792+
// blocking proxy and fail every terraform-engine test.
793+
cmd.Env = append(cmd.Env, "CHECKPOINT_DISABLE=1")
794+
}
766795
cmd.Dir = tmpDir
767796

768797
outputPath := filepath.Join(tmpDir, "output.txt")

acceptance/auth/bundle_and_profile/.databrickscfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
host = $DATABRICKS_HOST
33

44
[profile_name]
5-
host = https://test@non.existing.subdomain.databricks.com
5+
host = https://test@non.existing.subdomain.databricks.test

acceptance/auth/bundle_and_profile/output.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
=== Inside the bundle, profile flag not matching bundle host. Should use profile from the flag and not the bundle.
1515
>>> errcode [CLI] current-user me -p profile_name
16-
Warn: [hostmetadata] failed to fetch host metadata for https://non.existing.subdomain.databricks.com, will skip for 1m0s
17-
Error: Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted)
16+
Warn: [hostmetadata] failed to fetch host metadata for https://non.existing.subdomain.databricks.test, will skip for 1m0s
17+
Error: Get "https://non.existing.subdomain.databricks.test/api/2.0/preview/scim/v2/Me": (redacted)
1818

1919
Exit code: 1
2020

2121
=== Inside the bundle, target and not matching profile
2222
>>> errcode [CLI] current-user me -t dev -p profile_name
23-
Error: cannot resolve bundle auth configuration: the host in the profile (https://non.existing.subdomain.databricks.com) doesn’t match the host configured in the bundle ([DATABRICKS_TARGET]). The profile "DEFAULT" has host="[DATABRICKS_TARGET]" that matches host in the bundle. To select it, pass "-p DEFAULT"
23+
Error: cannot resolve bundle auth configuration: the host in the profile (https://non.existing.subdomain.databricks.test) doesn’t match the host configured in the bundle ([DATABRICKS_TARGET]). The profile "DEFAULT" has host="[DATABRICKS_TARGET]" that matches host in the bundle. To select it, pass "-p DEFAULT"
2424

2525

2626
Exit code: 1
@@ -49,7 +49,7 @@ Validation OK!
4949

5050
=== Bundle commands load bundle configuration with -p flag, validation not OK (profile host don't match bundle host)
5151
>>> errcode [CLI] bundle validate -p profile_name
52-
Error: cannot resolve bundle auth configuration: the host in the profile (https://non.existing.subdomain.databricks.com) doesn’t match the host configured in the bundle ([DATABRICKS_TARGET]). The profile "DEFAULT" has host="[DATABRICKS_TARGET]" that matches host in the bundle. To select it, pass "-p DEFAULT"
52+
Error: cannot resolve bundle auth configuration: the host in the profile (https://non.existing.subdomain.databricks.test) doesn’t match the host configured in the bundle ([DATABRICKS_TARGET]). The profile "DEFAULT" has host="[DATABRICKS_TARGET]" that matches host in the bundle. To select it, pass "-p DEFAULT"
5353

5454
Name: test-auth
5555
Target: dev

acceptance/auth/bundle_and_profile/test.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Old='DATABRICKS_URL'
1010
New='DATABRICKS_TARGET'
1111

1212
[[Repls]]
13-
Old='Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me\??": .*'
14-
New='Get "https://non.existing.subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted)'
13+
Old='Get "https://non.existing.subdomain.databricks.test/api/2.0/preview/scim/v2/Me\??": .*'
14+
New='Get "https://non.existing.subdomain.databricks.test/api/2.0/preview/scim/v2/Me": (redacted)'

acceptance/bundle/deploy/mlops-stacks/out.test.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/deploy/mlops-stacks/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Cloud=true
2-
Local=true
2+
Local=false
33

44
Badness = "the newly initialized bundle from the 'mlops-stacks' template contains two validation warnings in the configuration"
55

acceptance/bundle/invariant/configs/cluster.yml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ resources:
77
cluster_name: test-cluster-$UNIQUE_NAME
88
spark_version: 13.3.x-scala2.12
99
node_type_id: $NODE_TYPE_ID
10+
instance_pool_id: $TEST_INSTANCE_POOL_ID
1011
num_workers: 1

acceptance/bundle/invariant/configs/job_with_task.yml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ resources:
1212
new_cluster:
1313
spark_version: $DEFAULT_SPARK_VERSION
1414
node_type_id: $NODE_TYPE_ID
15+
instance_pool_id: $TEST_INSTANCE_POOL_ID
1516
num_workers: 1

acceptance/bundle/resources/clusters/deploy/data_security_mode/databricks.yml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ resources:
1010
cluster_name: test-cluster-$UNIQUE_NAME
1111
spark_version: $DEFAULT_SPARK_VERSION
1212
node_type_id: $NODE_TYPE_ID
13+
instance_pool_id: $TEST_INSTANCE_POOL_ID
1314
num_workers: 2
1415
spark_conf:
1516
"spark.executor.memory": "2g"

acceptance/bundle/resources/clusters/deploy/simple/databricks.yml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ resources:
1010
cluster_name: test-cluster-$UNIQUE_NAME
1111
spark_version: $DEFAULT_SPARK_VERSION
1212
node_type_id: $NODE_TYPE_ID
13+
instance_pool_id: $TEST_INSTANCE_POOL_ID
1314
num_workers: 2
1415
spark_conf:
1516
"spark.executor.memory": "2g"

0 commit comments

Comments
 (0)