Skip to content

Commit 9490fb1

Browse files
authored
fix(doltserver): use buildServerSQLCmd in VerifyExpectedDatabasesAtConfig (#3616)
Replace inline dolt sql command construction with the existing buildServerSQLCmd() helper to match the pattern used by other internal callers. The helper ensures --password is always passed, preventing credential inheritance from env in non-TTY environments. Fixes TestBuildDoltSQLCmd_LocalIgnoresInheritedCredentials on main. Co-authored-by: Steve Ash <steveash@users.noreply.github.com>
1 parent 677877b commit 9490fb1

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

internal/doltserver/doltserver.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,21 +2012,7 @@ func VerifyExpectedDatabasesAtConfig(config *Config, expected []string) (served,
20122012
var lastErr error
20132013
for attempt := 1; attempt <= 3; attempt++ {
20142014
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
2015-
args := []string{
2016-
"sql",
2017-
"--host", config.EffectiveHost(),
2018-
"--port", strconv.Itoa(config.Port),
2019-
"--user", config.User,
2020-
"--no-tls",
2021-
"-r", "json",
2022-
"-q", "SHOW DATABASES",
2023-
}
2024-
cmd := exec.CommandContext(ctx, "dolt", args...)
2025-
cmd.Dir = config.DataDir
2026-
if config.Password != "" {
2027-
cmd.Env = append(os.Environ(), "DOLT_CLI_PASSWORD="+config.Password)
2028-
}
2029-
2015+
cmd := buildServerSQLCmd(ctx, config, "-r", "json", "-q", "SHOW DATABASES")
20302016
var stderrBuf bytes.Buffer
20312017
cmd.Stderr = &stderrBuf
20322018
output, queryErr := cmd.Output()

0 commit comments

Comments
 (0)