Skip to content

Commit

Permalink
Merge pull request #14168 from lavacat/release-3.4-TestGetToken
Browse files Browse the repository at this point in the history
[backport 3.4] clientv3/integration: Reduce flakines of TestGetTokenWithoutAuth
  • Loading branch information
ahrtr authored Jun 27, 2022
2 parents 17fc680 + 2d99b34 commit 4e88cce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions clientv3/integration/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func authSetupRoot(t *testing.T, auth clientv3.Auth) {
func TestGetTokenWithoutAuth(t *testing.T) {
defer testutil.AfterTest(t)

clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 10})
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 2})
defer clus.Terminate(t)

authapi := clus.RandClient()
Expand All @@ -130,7 +130,7 @@ func TestGetTokenWithoutAuth(t *testing.T) {
// "Username" and "Password" must be used
cfg := clientv3.Config{
Endpoints: authapi.Endpoints(),
DialTimeout: 1 * time.Second, // make sure all connection time of connect all endpoint must be more DialTimeout
DialTimeout: 5 * time.Second,
Username: "root",
Password: "123",
}
Expand All @@ -142,13 +142,12 @@ func TestGetTokenWithoutAuth(t *testing.T) {

switch err {
case nil:
t.Log("passes as expected, but may be connection time less than DialTimeout")
t.Log("passes as expected")
case context.DeadlineExceeded:
t.Errorf("not expected result:%v with endpoint:%s", err, authapi.Endpoints())
case rpctypes.ErrAuthNotEnabled:
t.Logf("passes as expected:%v", err)
default:
t.Errorf("other errors:%v", err)
}

}

0 comments on commit 4e88cce

Please sign in to comment.