Skip to content
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

Merged
merged 1 commit into from
Jul 31, 2023
Merged

tests: add failpoint to simulate lack of disk space #546

merged 1 commit into from
Jul 31, 2023

Conversation

vianamjr
Copy link
Contributor

Linked to #382

I added one more failpoint to simulate lack of disk space.

tx.go Outdated
Comment on lines 190 to 192
// gofail: var lackOfDiskSpace string
// return errors.New(lackOfDiskSpace)
Copy link
Member

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().

Suggested change
// gofail: var lackOfDiskSpace string
// return errors.New(lackOfDiskSpace)
// gofail: var lackOfDiskSpace string
// tx.rollback()
// return errors.New(lackOfDiskSpace)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. Fixed!

Comment on lines 140 to 141
err = tx.Rollback()
require.NoError(t, err)
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Fixed!

@vianamjr vianamjr requested a review from ahrtr July 30, 2023 17:49
err = tx.Commit()
require.Error(t, err)
require.ErrorContains(t, err, "grow somehow failed")

Copy link
Member

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.

Suggested change
err = tx.Rollback()
require.Error(t, err)
require.ErrorIs(t, err, errors.ErrTxClosed)

Copy link
Contributor Author

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 <marju10@gmail.com>
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

thx @vianamjr

@ahrtr ahrtr merged commit 808aac7 into etcd-io:master Jul 31, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants