Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/bd/dolt_autostart_lifecycle_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func TestE2E_AutoStartedRepoLocalServerPersistsAcrossCommands(t *testing.T) {
"BEADS_DOLT_SERVER_PORT=",
"BEADS_DOLT_PORT=",
"BEADS_DOLT_SHARED_SERVER=",
"GIT_TERMINAL_PROMPT=0",
"SSH_ASKPASS=",
"GIT_ASKPASS=",
)

initOut, initErr := runBDExecWithBinary(t, bdBinary, tmpDir, env, "init", "--backend", "dolt", "--prefix", "test", "--quiet")
Expand Down
11 changes: 11 additions & 0 deletions cmd/bd/test_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,20 +373,31 @@ func openExistingTestDB(t *testing.T, dbPath string) (*dolt.DoltStore, error) {
func runCommandInDir(dir string, name string, args ...string) error {
cmd := exec.Command(name, args...)
cmd.Dir = dir
cmd.Env = testEnvNoPrompt()
return cmd.Run()
}

// runCommandInDirWithOutput runs a command in the specified directory and returns its output
func runCommandInDirWithOutput(dir string, name string, args ...string) (string, error) {
cmd := exec.Command(name, args...)
cmd.Dir = dir
cmd.Env = testEnvNoPrompt()
output, err := cmd.Output()
if err != nil {
return "", err
}
return strings.TrimSpace(string(output)), nil
}

// testEnvNoPrompt returns the current environment with git auth prompts
// suppressed. Prevents ksshaskpass/SSH_ASKPASS popups during tests that
// configure fake git remotes (e.g. github.com/test/repo.git).
func testEnvNoPrompt() []string {
env := os.Environ()
env = append(env, "GIT_TERMINAL_PROMPT=0", "SSH_ASKPASS=", "GIT_ASKPASS=")
return env
}

// captureStderr captures stderr output from fn and returns it as a string.
// Uses stdioMutex to prevent races with concurrent os.Stderr redirection.
func captureStderr(t *testing.T, fn func()) string {
Expand Down