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

fix: enable go-require rule from testifylint #18827

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/common/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

clientv3 "go.etcd.io/etcd/client/v3"
Expand Down Expand Up @@ -110,7 +111,7 @@ func TestAuthGracefulDisable(t *testing.T) {
return
}
// the watcher should still work after reconnecting
require.NoErrorf(t, rootAuthClient.Put(ctx, "key", "value", config.PutOptions{}), "failed to put key value")
assert.NoErrorf(t, rootAuthClient.Put(ctx, "key", "value", config.PutOptions{}), "failed to put key value")
}()

wCtx, wCancel := context.WithCancel(ctx)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/corrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func testCtlV3ReadAfterWrite(t *testing.T, ops ...clientv3.OpOption) {
}

count++
require.Equal(t, "bar2", string(resp.Kvs[0].Value))
assert.Equal(t, "bar2", string(resp.Kvs[0].Value))
}
}()

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ctl_v3_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestCtlV3ConsistentMemberList(t *testing.T) {
}

merr := epc.Procs[0].Restart(ctx)
require.NoError(t, merr)
assert.NoError(t, merr)
epc.WaitLeader(t)

time.Sleep(100 * time.Millisecond)
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestCtlV3ConsistentMemberList(t *testing.T) {
}

count++
require.Len(t, mresp.Members, 1)
assert.Len(t, mresp.Members, 1)
}
}()

Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/v3_lease_no_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

clientv3 "go.etcd.io/etcd/client/v3"
Expand Down Expand Up @@ -106,7 +107,7 @@ func testLeaseRevokeIssue(t *testing.T, clusterSize int, connectToOneFollower bo
defer close(doneC)

respC, kerr := clientForKeepAlive.KeepAlive(ctx, leaseRsp.ID)
require.NoError(t, kerr)
assert.NoError(t, kerr)
// ensure we have received the first response from the server
<-respC
startC <- struct{}{}
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func testStartWatcherFromCompactedRevision(t *testing.T, performCompactOnTombsto
t.Logf("DELETE key=%s", key)

resp, derr := c.KV.Delete(ctx, key)
require.NoError(t, derr)
assert.NoError(t, derr)
respHeader = resp.Header

requestedValues = append(requestedValues, valueEvent{value: "", typ: mvccpb.DELETE})
Expand All @@ -396,7 +396,7 @@ func testStartWatcherFromCompactedRevision(t *testing.T, performCompactOnTombsto

t.Logf("PUT key=%s, val=%s", key, value)
resp, perr := c.KV.Put(ctx, key, value)
require.NoError(t, perr)
assert.NoError(t, perr)
respHeader = resp.Header

requestedValues = append(requestedValues, valueEvent{value: value, typ: mvccpb.PUT})
Expand All @@ -409,7 +409,7 @@ func testStartWatcherFromCompactedRevision(t *testing.T, performCompactOnTombsto

t.Logf("COMPACT rev=%d", lastRevision)
_, err = c.KV.Compact(ctx, lastRevision, clientv3.WithCompactPhysical())
require.NoError(t, err)
assert.NoError(t, err)
}
}
}()
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/zap_logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.etcd.io/etcd/tests/v3/framework/e2e"
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestConnectionRejectMessage(t *testing.T) {
go func() {
startedCh <- struct{}{}
verr := e2e.WaitReadyExpectProc(context.TODO(), p, []string{tc.expectedErrMsg})
require.NoError(t, verr)
assert.NoError(t, verr)
doneCh <- struct{}{}
}()

Expand Down
2 changes: 1 addition & 1 deletion tests/framework/testutils/log_observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestLogObserver_Expect(t *testing.T) {
defer close(resCh)

res, err := logOb.Expect(ctx, t.Name(), 2)
require.NoError(t, err)
assert.NoError(t, err)
resCh <- res
}()

Expand Down
2 changes: 0 additions & 2 deletions tools/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ linters-settings: # please keep this alphabetized
checks:
- ST1019 # Importing the same package multiple times.
testifylint:
disable:
- go-require
enable-all: true
formatter:
# Require f-assertions (e.g. assert.Equalf) if a message is passed to the assertion, even if
Expand Down