Browse Source

abci/kvstore: test cleanup improvements (#7991)

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
pull/8001/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
858d57a984
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      abci/example/kvstore/kvstore_test.go

+ 8
- 3
abci/example/kvstore/kvstore_test.go View File

@ -6,6 +6,7 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/fortytw2/leaktest"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/log"
@ -74,7 +75,7 @@ func TestKVStoreKV(t *testing.T) {
func TestPersistentKVStoreKV(t *testing.T) { func TestPersistentKVStoreKV(t *testing.T) {
dir := t.TempDir() dir := t.TempDir()
logger := log.NewTestingLogger(t)
logger := log.NewNopLogger()
kvstore := NewPersistentKVStoreApplication(logger, dir) kvstore := NewPersistentKVStoreApplication(logger, dir)
key := testKey key := testKey
@ -89,7 +90,7 @@ func TestPersistentKVStoreKV(t *testing.T) {
func TestPersistentKVStoreInfo(t *testing.T) { func TestPersistentKVStoreInfo(t *testing.T) {
dir := t.TempDir() dir := t.TempDir()
logger := log.NewTestingLogger(t)
logger := log.NewNopLogger()
kvstore := NewPersistentKVStoreApplication(logger, dir) kvstore := NewPersistentKVStoreApplication(logger, dir)
InitKVStore(kvstore) InitKVStore(kvstore)
@ -229,9 +230,11 @@ func makeSocketClientServer(
app types.Application, app types.Application,
name string, name string,
) (abciclient.Client, service.Service, error) { ) (abciclient.Client, service.Service, error) {
t.Helper()
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
t.Cleanup(cancel) t.Cleanup(cancel)
t.Cleanup(leaktest.Check(t))
// Start the listener // Start the listener
socket := fmt.Sprintf("unix://%s.sock", name) socket := fmt.Sprintf("unix://%s.sock", name)
@ -261,6 +264,8 @@ func makeGRPCClientServer(
) (abciclient.Client, service.Service, error) { ) (abciclient.Client, service.Service, error) {
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
t.Cleanup(cancel) t.Cleanup(cancel)
t.Cleanup(leaktest.Check(t))
// Start the listener // Start the listener
socket := fmt.Sprintf("unix://%s.sock", name) socket := fmt.Sprintf("unix://%s.sock", name)
@ -284,7 +289,7 @@ func makeGRPCClientServer(
func TestClientServer(t *testing.T) { func TestClientServer(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
logger := log.NewTestingLogger(t)
logger := log.NewNopLogger()
// set up socket app // set up socket app
kvstore := NewApplication() kvstore := NewApplication()


Loading…
Cancel
Save