diff --git a/etcdserver/apply_auth_test.go b/etcdserver/apply_auth_test.go index bcb2b71a7..c50e18ede 100644 --- a/etcdserver/apply_auth_test.go +++ b/etcdserver/apply_auth_test.go @@ -48,6 +48,7 @@ func TestCheckLeasePutsKeys(t *testing.T) { tp, _ := auth.NewTokenProvider(zaptest.NewLogger(t), tokenTypeSimple, dummyIndexWaiter, simpleTokenTTLDefault) as := auth.NewAuthStore(lg, b, tp, bcrypt.MinCost) + defer as.AuthDisable() aa := authApplierV3{as: as} assert.NoError(t, aa.checkLeasePutsKeys(lease.NewLease(lease.LeaseID(1), 3600)), "auth is disabled, should allow puts") diff --git a/etcdserver/corrupt_test.go b/etcdserver/corrupt_test.go index b033a60e5..f36de8814 100644 --- a/etcdserver/corrupt_test.go +++ b/etcdserver/corrupt_test.go @@ -47,6 +47,9 @@ func TestHashKVHandler(t *testing.T) { assert.NoError(t, be.Close()) }() etcdSrv.kv = mvcc.New(zap.NewNop(), be, &lease.FakeLessor{}, nil, nil, mvcc.StoreConfig{}) + defer func() { + assert.NoError(t, etcdSrv.kv.Close()) + }() ph := &hashKVHandler{ lg: zap.NewNop(), server: etcdSrv, diff --git a/etcdserver/raft_test.go b/etcdserver/raft_test.go index 4d373b83c..0c09964a0 100644 --- a/etcdserver/raft_test.go +++ b/etcdserver/raft_test.go @@ -197,7 +197,7 @@ func TestConfigChangeBlocksApply(t *testing.T) { updateLead: func(uint64) {}, updateLeadership: func(bool) {}, }) - defer srv.r.Stop() + defer srv.r.stop() n.readyc <- raft.Ready{ SoftState: &raft.SoftState{RaftState: raft.StateFollower}, diff --git a/etcdserver/server_test.go b/etcdserver/server_test.go index 0d94b796c..06c6deca7 100644 --- a/etcdserver/server_test.go +++ b/etcdserver/server_test.go @@ -28,6 +28,7 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" "go.etcd.io/etcd/etcdserver/api/membership" "go.etcd.io/etcd/etcdserver/api/rafthttp" "go.etcd.io/etcd/etcdserver/api/snap" @@ -967,6 +968,9 @@ func TestSnapshot(t *testing.T) { defer func() { os.RemoveAll(tmpPath) }() + defer func() { + assert.NoError(t, be.Close()) + }() s := raft.NewMemoryStorage() s.Append([]raftpb.Entry{{Index: 1}}) @@ -985,6 +989,9 @@ func TestSnapshot(t *testing.T) { v2store: st, } srv.kv = mvcc.New(zap.NewExample(), be, &lease.FakeLessor{}, nil, &srv.consistIndex, mvcc.StoreConfig{}) + defer func() { + assert.NoError(t, srv.kv.Close()) + }() srv.be = be ch := make(chan struct{}, 2)