test(client/keys): Test_runImportCmd unique dir per test (backport #17863) (#17865)

Co-authored-by: Julián Toledano <JulianToledano@users.noreply.github.com>
This commit is contained in:
mergify[bot] 2023-09-25 11:04:39 +00:00 committed by GitHub
parent d9134ee760
commit 5ccb0057e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,12 @@ HbP+c6JmeJy9JXe2rbbF1QtCX1gLqGcDQPBXiCtFvP7/8wTZtVOPj8vREzhZ9ElO
mockIn := testutil.ApplyMockIODiscardOutErr(cmd)
// Now add a temporary keybase
kbHome := t.TempDir()
kbHome := filepath.Join(t.TempDir(), fmt.Sprintf("kbhome-%s", tc.name))
// Create dir, otherwise os.WriteFile will fail
if _, err := os.Stat(kbHome); os.IsNotExist(err) {
err = os.MkdirAll(kbHome, 0o700)
require.NoError(t, err)
}
kb, err := keyring.New(sdk.KeyringServiceName(), tc.keyringBackend, kbHome, nil, cdc)
require.NoError(t, err)