Fix test failures caused by the cobra install command not respecting the secret key

Also added a persistLog() function so that I can easily inspect the hishtory logs from test runs.
This commit is contained in:
David Dworken
2022-11-16 20:28:25 -08:00
parent 35208680d8
commit 86f9d67aff
4 changed files with 30 additions and 9 deletions

View File

@ -652,7 +652,7 @@ func readFileToArray(path string) ([]string, error) {
return lines, nil
}
func Install(offline bool) error {
func Install(secretKey string, offline bool) error {
homedir, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("failed to get user's home directory: %v", err)
@ -683,8 +683,8 @@ func Install(offline bool) error {
}
_, err = hctx.GetConfig()
if err != nil {
// No config, so set up a new installation with a new key
return Setup("", offline)
// No config, so set up a new installation
return Setup(secretKey, offline)
}
return nil
}