mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14168 from lavacat/release-3.4-TestGetToken
[backport 3.4] clientv3/integration: Reduce flakines of TestGetTokenWithoutAuth
This commit is contained in:
commit
4e88cce06c
@ -114,7 +114,7 @@ func authSetupRoot(t *testing.T, auth clientv3.Auth) {
|
|||||||
func TestGetTokenWithoutAuth(t *testing.T) {
|
func TestGetTokenWithoutAuth(t *testing.T) {
|
||||||
defer testutil.AfterTest(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)
|
defer clus.Terminate(t)
|
||||||
|
|
||||||
authapi := clus.RandClient()
|
authapi := clus.RandClient()
|
||||||
@ -130,7 +130,7 @@ func TestGetTokenWithoutAuth(t *testing.T) {
|
|||||||
// "Username" and "Password" must be used
|
// "Username" and "Password" must be used
|
||||||
cfg := clientv3.Config{
|
cfg := clientv3.Config{
|
||||||
Endpoints: authapi.Endpoints(),
|
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",
|
Username: "root",
|
||||||
Password: "123",
|
Password: "123",
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ func TestGetTokenWithoutAuth(t *testing.T) {
|
|||||||
|
|
||||||
switch err {
|
switch err {
|
||||||
case nil:
|
case nil:
|
||||||
t.Log("passes as expected, but may be connection time less than DialTimeout")
|
t.Log("passes as expected")
|
||||||
case context.DeadlineExceeded:
|
case context.DeadlineExceeded:
|
||||||
t.Errorf("not expected result:%v with endpoint:%s", err, authapi.Endpoints())
|
t.Errorf("not expected result:%v with endpoint:%s", err, authapi.Endpoints())
|
||||||
case rpctypes.ErrAuthNotEnabled:
|
case rpctypes.ErrAuthNotEnabled:
|
||||||
@ -150,5 +150,4 @@ func TestGetTokenWithoutAuth(t *testing.T) {
|
|||||||
default:
|
default:
|
||||||
t.Errorf("other errors:%v", err)
|
t.Errorf("other errors:%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user