-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: add failpoint to simulate lack of disk space #546
Conversation
tx.go
Outdated
// gofail: var lackOfDiskSpace string | ||
// return errors.New(lackOfDiskSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It changes the behaviour. When grow() fails, it should execute tx.rollback().
// gofail: var lackOfDiskSpace string | |
// return errors.New(lackOfDiskSpace) | |
// gofail: var lackOfDiskSpace string | |
// tx.rollback() | |
// return errors.New(lackOfDiskSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. Fixed!
tests/failpoint/db_failpoint_test.go
Outdated
err = tx.Rollback() | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it also needs to be updated after you fixed above comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Fixed!
err = tx.Commit() | ||
require.Error(t, err) | ||
require.ErrorContains(t, err, "grow somehow failed") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment: Intentionally call Rollback, to ensure that the transaction has already been rollbacked.
err = tx.Rollback() | |
require.Error(t, err) | |
require.ErrorIs(t, err, errors.ErrTxClosed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, makes sense!
Signed-off-by: Marcondes Viana <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thx @vianamjr
Linked to #382
I added one more failpoint to simulate lack of disk space.