Finish migration zap.NewExample -> zaptest.NewLogger(t) in integration tests

This commit is contained in:
Piotr Tabor 2021-04-29 22:32:26 +02:00
parent 451f65d661
commit 3acf6e35b2
4 changed files with 8 additions and 9 deletions

View File

@ -25,7 +25,7 @@ import (
"testing" "testing"
"time" "time"
"go.uber.org/zap" "go.uber.org/zap/zaptest"
"google.golang.org/grpc" "google.golang.org/grpc"
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
@ -149,7 +149,7 @@ func TestMaintenanceSnapshotErrorInflight(t *testing.T) {
clus.Members[0].Stop(t) clus.Members[0].Stop(t)
dpath := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db") dpath := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db")
b := backend.NewDefaultBackend(dpath) 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 rev := 100000
for i := 2; i <= rev; i++ { for i := 2; i <= rev; i++ {
s.Put([]byte(fmt.Sprintf("%10d", i)), bytes.Repeat([]byte("a"), 1024), lease.NoLease) s.Put([]byte(fmt.Sprintf("%10d", i)), bytes.Repeat([]byte("a"), 1024), lease.NoLease)

View File

@ -24,6 +24,7 @@ import (
"go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/server/v3/proxy/grpcproxy" "go.etcd.io/etcd/server/v3/proxy/grpcproxy"
"go.etcd.io/etcd/tests/v3/integration" "go.etcd.io/etcd/tests/v3/integration"
"go.uber.org/zap/zaptest"
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -35,7 +36,7 @@ func TestClusterProxyMemberList(t *testing.T) {
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
defer clus.Terminate(t) 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) defer cts.close(t)
cfg := clientv3.Config{ cfg := clientv3.Config{

View File

@ -22,8 +22,7 @@ import (
"go.etcd.io/etcd/client/v3/naming/endpoints" "go.etcd.io/etcd/client/v3/naming/endpoints"
"go.etcd.io/etcd/server/v3/proxy/grpcproxy" "go.etcd.io/etcd/server/v3/proxy/grpcproxy"
"go.etcd.io/etcd/tests/v3/integration" "go.etcd.io/etcd/tests/v3/integration"
"go.uber.org/zap/zaptest"
"go.uber.org/zap"
) )
func TestRegister(t *testing.T) { func TestRegister(t *testing.T) {
@ -37,7 +36,7 @@ func TestRegister(t *testing.T) {
testPrefix := "test-name" testPrefix := "test-name"
wa := mustCreateWatcher(t, cli, testPrefix) 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 ups := <-wa
if len(ups) != 1 { if len(ups) != 1 {

View File

@ -28,8 +28,7 @@ import (
"go.etcd.io/etcd/server/v3/etcdserver/cindex" "go.etcd.io/etcd/server/v3/etcdserver/cindex"
"go.etcd.io/etcd/server/v3/mvcc" "go.etcd.io/etcd/server/v3/mvcc"
"go.etcd.io/etcd/server/v3/mvcc/backend" "go.etcd.io/etcd/server/v3/mvcc/backend"
"go.uber.org/zap/zaptest"
"go.uber.org/zap"
) )
// TestV3StorageQuotaApply tests the V3 server respects quotas during apply // TestV3StorageQuotaApply tests the V3 server respects quotas during apply
@ -168,7 +167,7 @@ func TestV3CorruptAlarm(t *testing.T) {
clus.Members[0].Stop(t) clus.Members[0].Stop(t)
fp := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db") fp := filepath.Join(clus.Members[0].DataDir, "member", "snap", "db")
be := backend.NewDefaultBackend(fp) 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'. // NOTE: cluster_proxy mode with namespacing won't set 'k', but namespace/'k'.
s.Put([]byte("abc"), []byte("def"), 0) s.Put([]byte("abc"), []byte("def"), 0)
s.Put([]byte("xyz"), []byte("123"), 0) s.Put([]byte("xyz"), []byte("123"), 0)