mirror of https://github.com/databricks/cli.git
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: https://github.com/databricks/cli/pull/2009. Specifically the addition of internal.Main as the entrypoint for all integration tests. ## Tests Manually, by trying to debug a test.
This commit is contained in:
parent
ea8445af9e
commit
890c57eabe
|
@ -11,14 +11,14 @@ import (
|
|||
)
|
||||
|
||||
// Detects if test is run from "debug test" feature in VS Code.
|
||||
func isInDebug() bool {
|
||||
func IsInDebug() bool {
|
||||
ex, _ := os.Executable()
|
||||
return strings.HasPrefix(path.Base(ex), "__debug_bin")
|
||||
}
|
||||
|
||||
// Loads debug environment from ~/.databricks/debug-env.json.
|
||||
func loadDebugEnvIfRunFromIDE(t testutil.TestingT, key string) {
|
||||
if !isInDebug() {
|
||||
if !IsInDebug() {
|
||||
return
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/databricks/cli/integration/internal/acc"
|
||||
)
|
||||
|
||||
// Main is the entry point for integration tests.
|
||||
|
@ -11,7 +13,7 @@ import (
|
|||
// they are not inadvertently executed when calling `go test ./...`.
|
||||
func Main(m *testing.M) {
|
||||
value := os.Getenv("CLOUD_ENV")
|
||||
if value == "" {
|
||||
if value == "" && !acc.IsInDebug() {
|
||||
fmt.Println("CLOUD_ENV is not set, skipping integration tests")
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue