Skip to content

Commit

Permalink
tests/robustness: switch to kill if no panic after 10sec
Browse files Browse the repository at this point in the history
If file doesn't grow in 10 sec, bbolt won't trigger the following
errors:

* lackOfDiskSpace
* mapError
* resizeFileError
* unmapError

We should switch to kill instead of waiting for panic. In order to
trigger these errors, we should increase value size to 512.

Signed-off-by: Wei Fu <[email protected]>
(cherry picked from commit 49eb212)
Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
fuweid committed Aug 9, 2024
1 parent 1b38fb3 commit 9907846
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/robustness/powerfailure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func doPowerFailure(t *testing.T, du time.Duration, fsType dmflakey.FSType, mkfs
"-path", dbPath,
"-count=1000000000",
"-batch-size=5", // separate total count into multiple truncation
"-value-size=512",
}

logPath := filepath.Join(t.TempDir(), fmt.Sprintf("%s.log", t.Name()))
Expand Down Expand Up @@ -196,7 +197,7 @@ func doPowerFailure(t *testing.T, du time.Duration, fsType dmflakey.FSType, mkfs

select {
case <-time.After(10 * time.Second):
t.Error("bbolt should stop with panic in seconds")
t.Log("bbolt is supposed to be already stopped, but actually not yet; forcibly kill it")
assert.NoError(t, cmd.Process.Kill())
case err := <-errCh:
require.Error(t, err)
Expand Down

0 comments on commit 9907846

Please sign in to comment.