mirror of
https://github.com/hashicorp/lint-consul-retry
synced 2026-04-05 18:51:14 +00:00
No description
- Go 100%
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> |
||
|---|---|---|
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| lint-consul-retry.go | ||
| README.md | ||
lint-consul-retry
Checks if function literal in consul/sdk/testutil/retry.Run uses t *testing.T.
retry.Run needs to operate on retry.R rather than testing.T, else the function will not retry on errors.
Examples:
Bad:
require := require.New(t)
retry.Run(t, func(r *retry.R) {
require.NotNil(err)
}
retry.Run(t, func(r *retry.R) {
assert.NotNil(t, err)
}
retry.Run(t, func(r *retry.R) {
if err := myFunc(); err != nil {
t.Fatalf("failing")
}
}
OK:
retry.Run(t, func(r *retry.R) {
require.NotNil(r, err)
}
retry.Run(t, func(t *retry.R) {
assert.NotNil(t, err)
}
retry.Run(t, func(r *retry.R) {
if err := myFunc(); err != nil {
r.Fatalf("failing")
}
}
Usage:
Run ./lint-consul-retry from the base directory of Consul.