Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
523629f1a8 |
No files matched your search
@@ -153,8 +153,9 @@ func TestPurgeRefusesDestinationWithoutMarker(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestNukeRemoteRefusesDestinationWithoutMarker checks that remote nuke
|
// TestNukeRemoteRefusesDestinationWithoutMarker checks that remote nuke
|
||||||
// fails, deletes no local snapshot record and does not report the
|
// fails, deletes no local snapshot record, and neither reports the
|
||||||
// destination empty when the destination has no marker.
|
// destination empty nor advises running nuke again when the destination
|
||||||
|
// has no marker.
|
||||||
func TestNukeRemoteRefusesDestinationWithoutMarker(t *testing.T) {
|
func TestNukeRemoteRefusesDestinationWithoutMarker(t *testing.T) {
|
||||||
log.Initialize(log.Config{})
|
log.Initialize(log.Config{})
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -165,6 +166,7 @@ func TestNukeRemoteRefusesDestinationWithoutMarker(t *testing.T) {
|
|||||||
err := v.NukeRemote(true)
|
err := v.NukeRemote(true)
|
||||||
require.ErrorContains(t, err, markerFile)
|
require.ErrorContains(t, err, markerFile)
|
||||||
assert.NotContains(t, out.String(), "now empty")
|
assert.NotContains(t, out.String(), "now empty")
|
||||||
|
assert.NotContains(t, out.String(), "vaultik remote nuke --force")
|
||||||
|
|
||||||
assertUntouched(ctx, t, repos, storeDir)
|
assertUntouched(ctx, t, repos, storeDir)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,8 @@ func TestPurgeSaysListingFailedOnceWhenDestinationMissing(t *testing.T) {
|
|||||||
|
|
||||||
// TestNukeRemoteKeepsLocalIndexWhenDestinationMissing checks that remote
|
// TestNukeRemoteKeepsLocalIndexWhenDestinationMissing checks that remote
|
||||||
// nuke fails on a destination it cannot list, leaves the local index
|
// nuke fails on a destination it cannot list, leaves the local index
|
||||||
// unchanged, and does not report the destination empty.
|
// unchanged, and neither reports the destination empty nor advises
|
||||||
|
// running nuke again.
|
||||||
func TestNukeRemoteKeepsLocalIndexWhenDestinationMissing(t *testing.T) {
|
func TestNukeRemoteKeepsLocalIndexWhenDestinationMissing(t *testing.T) {
|
||||||
log.Initialize(log.Config{})
|
log.Initialize(log.Config{})
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -211,6 +212,7 @@ func TestNukeRemoteKeepsLocalIndexWhenDestinationMissing(t *testing.T) {
|
|||||||
require.ErrorIs(t, err, fs.ErrNotExist)
|
require.ErrorIs(t, err, fs.ErrNotExist)
|
||||||
require.ErrorContains(t, err, "listing remote snapshots")
|
require.ErrorContains(t, err, "listing remote snapshots")
|
||||||
assert.NotContains(t, out.String(), "now empty")
|
assert.NotContains(t, out.String(), "now empty")
|
||||||
|
assert.NotContains(t, out.String(), "vaultik remote nuke --force")
|
||||||
|
|
||||||
snapshots, err := repos.Snapshots.ListRecent(ctx, listRecentTestLimit)
|
snapshots, err := repos.Snapshots.ListRecent(ctx, listRecentTestLimit)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -55,12 +55,19 @@ func (v *Vaultik) NukeRemote(force bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checked before anything is deleted: running nuke again would fail
|
// Checked before anything is deleted: running nuke again would fail
|
||||||
// the same way, so the advice below must not follow this error.
|
// the same way, so the advice below must not follow these errors.
|
||||||
|
// The listing also fails on a destination without the marker while
|
||||||
|
// the local index holds snapshots.
|
||||||
err := v.EnsureStorageBinding()
|
err := v.EnsureStorageBinding()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = v.listAllRemoteSnapshotKeys()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = v.emptyDestinationStore()
|
err = v.emptyDestinationStore()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.UI.Warningf("Run '%s' again to delete what is left on the "+
|
v.UI.Warningf("Run '%s' again to delete what is left on the "+
|
||||||
|
|||||||
Reference in new issue
Block a user