- Use
github.com/stretchr/testify/assertandgithub.com/stretchr/testify/requirefor assertions. - Use
requirewhen the test cannot continue after a failure. - Use
assert.Eventuallyrather than manualtime.Sleep()calls and timeouts. - Use
t.Context()rather thancontext.Background(). - Use
t.Cleanup()for test cleanup. - Use CI timeouts of at least 30 seconds.
- A test must exercise the condition that its name and documentation claim.
- A test must fail on
mainwithout the fix that it protects. - A test must not duplicate a condition that a unit test already covers precisely.
- Use
vterrorsfor user-facing errors. - Use the applicable
vtrpcpb.Code. - Use
vterrors.Wrapfto add context to an error.
- Changes must remain compatible with Vitess versions one major release before and one major release after the current version.
- Stage breaking changes across releases: deprecate and warn first, change the default in the next major release, and remove the old behavior in the following major release.
- Run
scripts/fmt <changed-go-files>before each commit.
- Use
.github/pull_request_template.mdfor pull request bodies.