From 3acf6e35b29d6a0b4c8a780f258d3623b56572d9 Mon Sep 17 00:00:00 2001 From: Piotr Tabor Date: Thu, 29 Apr 2021 22:32:26 +0200 Subject: [PATCH] Finish migration zap.NewExample -> zaptest.NewLogger(t) in integration tests --- tests/integration/clientv3/maintenance_test.go | 4 ++-- tests/integration/proxy/grpcproxy/cluster_test.go | 3 ++- tests/integration/proxy/grpcproxy/register_test.go | 5 ++--- tests/integration/v3_alarm_test.go | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/integration/clientv3/maintenance_test.go b/tests/integration/clientv3/maintenance_test.go index be26bb291..586e0d6ed 100644 --- a/tests/integration/clientv3/maintenance_test.go +++ b/tests/integration/clientv3/maintenance_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - "go.uber.org/zap" + "go.uber.org/zap/zaptest" "google.golang.org/grpc" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -149,7 +149,7 @@ func TestMaintenanceSnapshotErrorInflight(t *testing.T) { clus.Members[0].Stop(t) dpath := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db") b := backend.NewDefaultBackend(dpath) - s := mvcc.NewStore(zap.NewExample(), b, &lease.FakeLessor{}, nil, mvcc.StoreConfig{CompactionBatchLimit: math.MaxInt32}) + s := mvcc.NewStore(zaptest.NewLogger(t), b, &lease.FakeLessor{}, nil, mvcc.StoreConfig{CompactionBatchLimit: math.MaxInt32}) rev := 100000 for i := 2; i <= rev; i++ { s.Put([]byte(fmt.Sprintf("%10d", i)), bytes.Repeat([]byte("a"), 1024), lease.NoLease) diff --git a/tests/integration/proxy/grpcproxy/cluster_test.go b/tests/integration/proxy/grpcproxy/cluster_test.go index 44b612f4c..5be35c232 100644 --- a/tests/integration/proxy/grpcproxy/cluster_test.go +++ b/tests/integration/proxy/grpcproxy/cluster_test.go @@ -24,6 +24,7 @@ import ( "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/proxy/grpcproxy" "go.etcd.io/etcd/tests/v3/integration" + "go.uber.org/zap/zaptest" "go.uber.org/zap" "google.golang.org/grpc" @@ -35,7 +36,7 @@ func TestClusterProxyMemberList(t *testing.T) { clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) defer clus.Terminate(t) - cts := newClusterProxyServer(zap.NewExample(), []string{clus.Members[0].GRPCAddr()}, t) + cts := newClusterProxyServer(zaptest.NewLogger(t), []string{clus.Members[0].GRPCAddr()}, t) defer cts.close(t) cfg := clientv3.Config{ diff --git a/tests/integration/proxy/grpcproxy/register_test.go b/tests/integration/proxy/grpcproxy/register_test.go index 01c2ed297..4fbe08e08 100644 --- a/tests/integration/proxy/grpcproxy/register_test.go +++ b/tests/integration/proxy/grpcproxy/register_test.go @@ -22,8 +22,7 @@ import ( "go.etcd.io/etcd/client/v3/naming/endpoints" "go.etcd.io/etcd/server/v3/proxy/grpcproxy" "go.etcd.io/etcd/tests/v3/integration" - - "go.uber.org/zap" + "go.uber.org/zap/zaptest" ) func TestRegister(t *testing.T) { @@ -37,7 +36,7 @@ func TestRegister(t *testing.T) { testPrefix := "test-name" wa := mustCreateWatcher(t, cli, testPrefix) - donec := grpcproxy.Register(zap.NewExample(), cli, testPrefix, paddr, 5) + donec := grpcproxy.Register(zaptest.NewLogger(t), cli, testPrefix, paddr, 5) ups := <-wa if len(ups) != 1 { diff --git a/tests/integration/v3_alarm_test.go b/tests/integration/v3_alarm_test.go index e85cbc51c..9f1f744f8 100644 --- a/tests/integration/v3_alarm_test.go +++ b/tests/integration/v3_alarm_test.go @@ -28,8 +28,7 @@ import ( "go.etcd.io/etcd/server/v3/etcdserver/cindex" "go.etcd.io/etcd/server/v3/mvcc" "go.etcd.io/etcd/server/v3/mvcc/backend" - - "go.uber.org/zap" + "go.uber.org/zap/zaptest" ) // TestV3StorageQuotaApply tests the V3 server respects quotas during apply @@ -168,7 +167,7 @@ func TestV3CorruptAlarm(t *testing.T) { clus.Members[0].Stop(t) fp := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db") be := backend.NewDefaultBackend(fp) - s := mvcc.NewStore(zap.NewExample(), be, nil, cindex.NewFakeConsistentIndex(13), mvcc.StoreConfig{}) + s := mvcc.NewStore(zaptest.NewLogger(t), be, nil, cindex.NewFakeConsistentIndex(13), mvcc.StoreConfig{}) // NOTE: cluster_proxy mode with namespacing won't set 'k', but namespace/'k'. s.Put([]byte("abc"), []byte("def"), 0) s.Put([]byte("xyz"), []byte("123"), 0)