Skip to content

Commit

Permalink
Merge pull request #12910 from ptabor/20210430-zap-polish
Browse files Browse the repository at this point in the history
Finish migration zap.NewExample -> zaptest.NewLogger(t) in integration tests
ptabor authored Apr 29, 2021
2 parents 451f65d + 3acf6e3 commit c46e96d
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/integration/clientv3/maintenance_test.go
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 2 additions & 1 deletion tests/integration/proxy/grpcproxy/cluster_test.go
Original file line number Diff line number Diff line change
@@ -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{
5 changes: 2 additions & 3 deletions tests/integration/proxy/grpcproxy/register_test.go
Original file line number Diff line number Diff line change
@@ -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 {
5 changes: 2 additions & 3 deletions tests/integration/v3_alarm_test.go
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit c46e96d

Please sign in to comment.