Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b61947eb0 |
@@ -100,7 +100,8 @@ func TestShallowVerifyDetectsWrongBlobSize(t *testing.T) {
|
||||
// The cli layer prints this error after its own "Verification failed:".
|
||||
err = newVerifier(io.Discard).VerifySnapshotWithOptions(
|
||||
snapshotID, &vaultik.VerifyOptions{})
|
||||
require.EqualError(t, err, "1 blobs have the wrong size")
|
||||
require.EqualError(t, err,
|
||||
"problems found in storage: 1 blobs have the wrong size")
|
||||
}
|
||||
|
||||
// TestShallowVerifyDetectsMissingDatabase backs up a real snapshot,
|
||||
|
||||
@@ -23,6 +23,7 @@ var (
|
||||
errSnapshotNotInConfig = errors.New("snapshot not found in config")
|
||||
errNoSnapshotsInConfig = errors.New("no snapshots configured")
|
||||
errSnapshotVerifyFailed = errors.New("verification failed")
|
||||
errProblemsInStorage = errors.New("problems found in storage")
|
||||
errRemoveAllNeedsForce = errors.New("--all requires --force")
|
||||
errSnapshotNotFound = errors.New("snapshot not found")
|
||||
errSnapshotRemoveFailed = errors.New("snapshot(s) could not be removed")
|
||||
@@ -907,13 +908,6 @@ func (v *Vaultik) verifyManifestBlobs(
|
||||
return verified, missing, mismatched, missingSize, unchecked, nil
|
||||
}
|
||||
|
||||
// shallowVerifyError is the error a failed shallow verify returns. Its
|
||||
// text is only what failed, because the cli layer prints it after its own
|
||||
// "Verification failed:".
|
||||
type shallowVerifyError string
|
||||
|
||||
func (e shallowVerifyError) Error() string { return string(e) }
|
||||
|
||||
// formatVerifyResult outputs the final verification results as JSON or
|
||||
// human-readable text.
|
||||
func (v *Vaultik) formatVerifyResult(
|
||||
@@ -948,8 +942,10 @@ func (v *Vaultik) formatVerifyResult(
|
||||
v.printVerifySummary(result, failure)
|
||||
}
|
||||
|
||||
// Not errSnapshotVerifyFailed: the cli layer prints this after its own
|
||||
// "Verification failed:".
|
||||
if failure != "" {
|
||||
return shallowVerifyError(failure)
|
||||
return fmt.Errorf("%w: %s", errProblemsInStorage, failure)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user