Skip to content

Commit 79d0f89

Browse files
authored
acc: Fix local inprocess tests when run from IDE (#3056)
## Changes - Do not load env variables from ~/.databricks/debug-env.json, revert #2765 - Better check in TestInprocess that test is actually run and not selected. ## Why Loading those env vars sets CLOUD_ENV which makes test runner ignore local tests. ## Tests Manually. Set selftest/basic Cloud=false and run it via IDE.
1 parent 1a96017 commit 79d0f89

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

acceptance/acceptance_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ var (
5050
// the test name there, e.g. "bundle/variables/empty".
5151
// Then install your breakpoints and click "debug test" near TestInprocessMode in VSCODE.
5252
//
53-
// To debug integration tests you can run the "deco env flip workspace" command to configure a workspace
54-
// and then click on "debug test" near TestInprocessMode.
55-
5653
// If enabled, instead of compiling and running CLI externally, we'll start in-process server that accepts and runs
5754
// CLI commands. The $CLI in test scripts is a helper that just forwards command-line arguments to this server (see bin/callserver.py).
5855
// Also disables parallelism in tests.
@@ -108,16 +105,19 @@ func TestInprocessMode(t *testing.T) {
108105
if InprocessMode && !Forcerun {
109106
t.Skip("Already tested by TestAccept")
110107
}
108+
if os.Getenv("CLOUD_ENV") != "" {
109+
t.Skip("No need to run this as integration test.")
110+
}
111+
112+
// Uncomment to load ~/.databricks/debug-env.json to debug integration tests
113+
// testutil.LoadDebugEnvIfRunFromIDE(t, "workspace")
114+
// Run the "deco env flip workspace" command to configure a workspace.
115+
111116
require.Equal(t, 1, testAccept(t, true, "selftest/basic"))
112117
require.Equal(t, 1, testAccept(t, true, "selftest/server"))
113118
}
114119

115120
func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
116-
// Load debug environment when debugging a single test run from an IDE.
117-
if singleTest != "" && inprocessMode {
118-
testutil.LoadDebugEnvIfRunFromIDE(t, "workspace")
119-
}
120-
121121
repls := testdiff.ReplacementsContext{}
122122
cwd, err := os.Getwd()
123123
require.NoError(t, err)
@@ -281,7 +281,7 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
281281

282282
t.Logf("Summary (dirs): %d/%d/%d run/selected/total, %d skipped", selectedDirs-skippedDirs, selectedDirs, totalDirs, skippedDirs)
283283

284-
return len(testDirs)
284+
return selectedDirs - skippedDirs
285285
}
286286

287287
func getEnvFilters(t *testing.T) []string {

0 commit comments

Comments
 (0)