Skip to content

Commit 890c57e

Browse files
Enable debugging integration tests in VS Code (#2053)
## Changes This PR adds back debugging functionality that was lost during migration to `internal.Main` as an entry point for integration tests. The PR that caused the regression: #2009. Specifically the addition of internal.Main as the entrypoint for all integration tests. ## Tests Manually, by trying to debug a test.
1 parent ea8445a commit 890c57e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

integration/internal/acc/debug.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import (
1111
)
1212

1313
// Detects if test is run from "debug test" feature in VS Code.
14-
func isInDebug() bool {
14+
func IsInDebug() bool {
1515
ex, _ := os.Executable()
1616
return strings.HasPrefix(path.Base(ex), "__debug_bin")
1717
}
1818

1919
// Loads debug environment from ~/.databricks/debug-env.json.
2020
func loadDebugEnvIfRunFromIDE(t testutil.TestingT, key string) {
21-
if !isInDebug() {
21+
if !IsInDebug() {
2222
return
2323
}
2424
home, err := os.UserHomeDir()

integration/internal/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import (
44
"fmt"
55
"os"
66
"testing"
7+
8+
"github.com/databricks/cli/integration/internal/acc"
79
)
810

911
// Main is the entry point for integration tests.
1012
// We use this for all integration tests defined in this subtree to ensure
1113
// they are not inadvertently executed when calling `go test ./...`.
1214
func Main(m *testing.M) {
1315
value := os.Getenv("CLOUD_ENV")
14-
if value == "" {
16+
if value == "" && !acc.IsInDebug() {
1517
fmt.Println("CLOUD_ENV is not set, skipping integration tests")
1618
return
1719
}

0 commit comments

Comments
 (0)