From 81ef11ffb81395295acc2e8d7b7e86ca379c5271 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Fri, 18 Feb 2022 13:06:48 +0100 Subject: [PATCH] tests: Test different TLS configuration with TestKVPut --- tests/common/kv_test.go | 16 ++++++++++++++++ tests/e2e/ctl_v3_kv_test.go | 6 ------ tests/framework/integration/cluster.go | 15 ++++++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/tests/common/kv_test.go b/tests/common/kv_test.go index c8ef1d023..0e2af0956 100644 --- a/tests/common/kv_test.go +++ b/tests/common/kv_test.go @@ -28,10 +28,26 @@ func TestKVPut(t *testing.T) { name string config config.ClusterConfig }{ + { + name: "NoTLS", + config: config.ClusterConfig{ClusterSize: 1}, + }, + { + name: "PeerTLS", + config: config.ClusterConfig{ClusterSize: 1, PeerTLS: config.ManualTLS}, + }, { name: "PeerAutoTLS", config: config.ClusterConfig{ClusterSize: 1, PeerTLS: config.AutoTLS}, }, + { + name: "ClientTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.ManualTLS}, + }, + { + name: "ClientAutoTLS", + config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.AutoTLS}, + }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { diff --git a/tests/e2e/ctl_v3_kv_test.go b/tests/e2e/ctl_v3_kv_test.go index d74434ab2..4c094d856 100644 --- a/tests/e2e/ctl_v3_kv_test.go +++ b/tests/e2e/ctl_v3_kv_test.go @@ -22,12 +22,6 @@ import ( "go.etcd.io/etcd/tests/v3/framework/e2e" ) -func TestCtlV3PutNoTLS(t *testing.T) { testCtl(t, putTest, withCfg(*e2e.NewConfigNoTLS())) } -func TestCtlV3PutClientTLS(t *testing.T) { testCtl(t, putTest, withCfg(*e2e.NewConfigClientTLS())) } -func TestCtlV3PutClientAutoTLS(t *testing.T) { - testCtl(t, putTest, withCfg(*e2e.NewConfigClientAutoTLS())) -} -func TestCtlV3PutPeerTLS(t *testing.T) { testCtl(t, putTest, withCfg(*e2e.NewConfigPeerTLS())) } func TestCtlV3PutTimeout(t *testing.T) { testCtl(t, putTest, withDialTimeout(0)) } func TestCtlV3PutClientTLSFlagByEnv(t *testing.T) { testCtl(t, putTest, withCfg(*e2e.NewConfigClientTLS()), withFlagByEnv()) diff --git a/tests/framework/integration/cluster.go b/tests/framework/integration/cluster.go index 3b5be315f..e5a6778d1 100644 --- a/tests/framework/integration/cluster.go +++ b/tests/framework/integration/cluster.go @@ -1387,9 +1387,18 @@ func (c *Cluster) ClusterClient() (client *clientv3.Client, err error) { endpoints = append(endpoints, m.GrpcURL) } cfg := clientv3.Config{ - Endpoints: endpoints, - DialTimeout: 5 * time.Second, - DialOptions: []grpc.DialOption{grpc.WithBlock()}, + Endpoints: endpoints, + DialTimeout: 5 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + MaxCallSendMsgSize: c.Cfg.ClientMaxCallSendMsgSize, + MaxCallRecvMsgSize: c.Cfg.ClientMaxCallRecvMsgSize, + } + if c.Cfg.ClientTLS != nil { + tls, err := c.Cfg.ClientTLS.ClientConfig() + if err != nil { + return nil, err + } + cfg.TLS = tls } c.clusterClient, err = newClientV3(cfg) if err != nil {