Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fd9d8e07b |
No files matched your search
@@ -100,8 +100,7 @@ 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,
|
||||
"problems found in storage: 1 blobs have the wrong size")
|
||||
require.EqualError(t, err, "1 blobs have the wrong size")
|
||||
}
|
||||
|
||||
// TestShallowVerifyDetectsMissingDatabase backs up a real snapshot,
|
||||
|
||||
@@ -23,7 +23,6 @@ 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")
|
||||
@@ -908,6 +907,13 @@ 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(
|
||||
@@ -942,10 +948,8 @@ func (v *Vaultik) formatVerifyResult(
|
||||
v.printVerifySummary(result, failure)
|
||||
}
|
||||
|
||||
// Not errSnapshotVerifyFailed: the cli layer prints this after its own
|
||||
// "Verification failed:".
|
||||
if failure != "" {
|
||||
return fmt.Errorf("%w: %s", errProblemsInStorage, failure)
|
||||
return shallowVerifyError(failure)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user