mirror of
https://github.com/kopia/kopia.git
synced 2026-03-08 00:08:26 -05:00
test(general): Handle no space left errors in robustness tests (#3043)
* Handle no space left errors in robustness tests * fix lint error
This commit is contained in:
@@ -78,12 +78,14 @@ func (e *Engine) RandomAction(ctx context.Context, actionOpts ActionOpts) error
|
||||
}
|
||||
|
||||
_, err := e.ExecAction(ctx, actionName, actionOpts[actionName])
|
||||
err = e.checkErrRecovery(ctx, err, actionOpts)
|
||||
err = e.CheckErrRecovery(ctx, err, actionOpts)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (e *Engine) checkErrRecovery(ctx context.Context, incomingErr error, actionOpts ActionOpts) (outgoingErr error) {
|
||||
// CheckErrRecovery tries to recover from no space left error
|
||||
// by deleting data directories.
|
||||
func (e *Engine) CheckErrRecovery(ctx context.Context, incomingErr error, actionOpts ActionOpts) (outgoingErr error) {
|
||||
outgoingErr = incomingErr
|
||||
|
||||
if incomingErr == nil {
|
||||
|
||||
@@ -35,12 +35,14 @@ func TestManySmallFiles(t *testing.T) {
|
||||
ctx := testlogging.ContextWithLevel(t, testlogging.LevelInfo)
|
||||
|
||||
_, err := eng.ExecAction(ctx, engine.WriteRandomFilesActionKey, fileWriteOpts)
|
||||
err = eng.CheckErrRecovery(ctx, err, engine.ActionOpts{})
|
||||
require.NoError(t, err)
|
||||
|
||||
snapOut, err := eng.ExecAction(ctx, engine.SnapshotDirActionKey, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = eng.ExecAction(ctx, engine.RestoreSnapshotActionKey, snapOut)
|
||||
err = eng.CheckErrRecovery(ctx, err, engine.ActionOpts{})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -91,12 +93,14 @@ func TestManySmallFilesAcrossDirecoryTree(t *testing.T) {
|
||||
ctx := testlogging.ContextWithLevel(t, testlogging.LevelInfo)
|
||||
|
||||
_, err := eng.ExecAction(ctx, engine.WriteRandomFilesActionKey, fileWriteOpts)
|
||||
err = eng.CheckErrRecovery(ctx, err, engine.ActionOpts{})
|
||||
require.NoError(t, err)
|
||||
|
||||
snapOut, err := eng.ExecAction(ctx, engine.SnapshotDirActionKey, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = eng.ExecAction(ctx, engine.RestoreSnapshotActionKey, snapOut)
|
||||
err = eng.CheckErrRecovery(ctx, err, engine.ActionOpts{})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user