Fix missing-key errors for restore and deep verify to name both key sources (closes #401)
check / check (push) Successful in 10m25s
check / check (push) Successful in 10m25s
The missing-key error for restore and deep verify is one value, errDecryptionKeyRequired, whose text names both places the key can be set: the VAULTIK_AGE_SECRET_KEY environment variable first, then the age_secret_key config file field. Model: deepseek-v4-pro
This commit is contained in:
1 parent
1df6867cd4
commit
68ba6bafa8
4 files changed
+26
-18
No files matched your search
@@ -106,3 +106,23 @@ func TestRestoreIdentitiesMissingKey(t *testing.T) {
|
||||
_, err := v.restoreIdentities()
|
||||
require.ErrorIs(t, err, errDecryptionKeyRequired)
|
||||
}
|
||||
|
||||
// TestMissingKeyErrorsNameBothSources asserts restore and deep verify
|
||||
// return the same missing-key error, whose text names both places the key
|
||||
// can be set: the VAULTIK_AGE_SECRET_KEY environment variable first since
|
||||
// it is preferred, then the age_secret_key config file field.
|
||||
func TestMissingKeyErrorsNameBothSources(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const want = "age secret key is missing; set it in " +
|
||||
"the VAULTIK_AGE_SECRET_KEY environment variable or the " +
|
||||
"age_secret_key config file field"
|
||||
|
||||
v := &Vaultik{Config: &config.Config{}}
|
||||
|
||||
_, err := v.restoreIdentities()
|
||||
require.EqualError(t, err, want)
|
||||
|
||||
err = v.RunDeepVerify("any-snapshot", &VerifyOptions{})
|
||||
require.EqualError(t, err, want)
|
||||
}
|
||||
Reference in new issue
Block a user