From be808bde23ccb93c9df818fe395c01ba49af8f40 Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Tue, 21 Mar 2023 22:12:13 +0900 Subject: [PATCH] Revert "tests: a test case for watch with auth token expiration" This reverts commit 91365174b33b15ff165997d6312abab7935a6ebe. Signed-off-by: Hitoshi Mitake --- integration/cluster.go | 8 +------- integration/v3_auth_test.go | 33 --------------------------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/integration/cluster.go b/integration/cluster.go index d881f8137..11d44c965 100644 --- a/integration/cluster.go +++ b/integration/cluster.go @@ -126,8 +126,7 @@ type ClusterConfig struct { DiscoveryURL string - AuthToken string - AuthTokenTTL uint + AuthToken string UseGRPC bool @@ -286,7 +285,6 @@ func (c *cluster) mustNewMember(t testing.TB) *member { memberConfig{ name: c.name(rand.Int()), authToken: c.cfg.AuthToken, - authTokenTTL: c.cfg.AuthTokenTTL, peerTLS: c.cfg.PeerTLS, clientTLS: c.cfg.ClientTLS, quotaBackendBytes: c.cfg.QuotaBackendBytes, @@ -581,7 +579,6 @@ type memberConfig struct { peerTLS *transport.TLSInfo clientTLS *transport.TLSInfo authToken string - authTokenTTL uint quotaBackendBytes int64 maxTxnOps uint maxRequestBytes uint @@ -668,9 +665,6 @@ func mustNewMember(t testing.TB, mcfg memberConfig) *member { if mcfg.authToken != "" { m.AuthToken = mcfg.authToken } - if mcfg.authTokenTTL != 0 { - m.TokenTTL = mcfg.authTokenTTL - } m.BcryptCost = uint(bcrypt.MinCost) // use min bcrypt cost to speedy up integration testing diff --git a/integration/v3_auth_test.go b/integration/v3_auth_test.go index bcc22ddb3..246e589e9 100644 --- a/integration/v3_auth_test.go +++ b/integration/v3_auth_test.go @@ -472,39 +472,6 @@ func TestV3AuthRestartMember(t *testing.T) { testutil.AssertNil(t, err) } -func TestV3AuthWatchAndTokenExpire(t *testing.T) { - defer testutil.AfterTest(t) - clus := NewClusterV3(t, &ClusterConfig{Size: 1, AuthTokenTTL: 3}) - defer clus.Terminate(t) - - ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second) - defer cancel() - - authSetupRoot(t, toGRPC(clus.Client(0)).Auth) - - c, cerr := clientv3.New(clientv3.Config{Endpoints: clus.Client(0).Endpoints(), Username: "root", Password: "123"}) - if cerr != nil { - t.Fatal(cerr) - } - defer c.Close() - - _, err := c.Put(ctx, "key", "val") - if err != nil { - t.Fatalf("Unexpected error from Put: %v", err) - } - - // The first watch gets a valid auth token through watcher.newWatcherGrpcStream() - // We should discard the first one by waiting TTL after the first watch. - wChan := c.Watch(ctx, "key", clientv3.WithRev(1)) - watchResponse := <-wChan - - time.Sleep(5 * time.Second) - - wChan = c.Watch(ctx, "key", clientv3.WithRev(1)) - watchResponse = <-wChan - testutil.AssertNil(t, watchResponse.Err()) -} - func TestV3AuthWatchErrorAndWatchId0(t *testing.T) { defer testutil.AfterTest(t) clus := NewClusterV3(t, &ClusterConfig{Size: 3})