diff --git a/light/example_test.go b/light/example_test.go index d75678b6b..a542b8d3d 100644 --- a/light/example_test.go +++ b/light/example_test.go @@ -23,7 +23,7 @@ import ( func ExampleClient_Update() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig("ExampleClient_Update") // Start a test application app := kvstore.NewApplication() @@ -100,7 +100,7 @@ func ExampleClient_Update() { func ExampleClient_VerifyLightBlockAtHeight() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig("ExampleClient_VerifyLightBlockAtHeight") // Start a test application app := kvstore.NewApplication() diff --git a/light/provider/http/http_test.go b/light/provider/http/http_test.go index 758f67131..9be538806 100644 --- a/light/provider/http/http_test.go +++ b/light/provider/http/http_test.go @@ -40,7 +40,7 @@ func NodeSuite(t *testing.T) (service.Service, *config.Config) { ctx, cancel := context.WithCancel(context.Background()) - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig(t.Name()) // start a tendermint node in the background to test against app := kvstore.NewApplication() diff --git a/rpc/client/examples_test.go b/rpc/client/examples_test.go index 774f16a50..8c4c4f277 100644 --- a/rpc/client/examples_test.go +++ b/rpc/client/examples_test.go @@ -18,7 +18,7 @@ func ExampleHTTP_simple() { // Start a tendermint node (and kvstore) in the background to test against app := kvstore.NewApplication() - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig("ExampleHTTP_simple") _, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout) if err != nil { @@ -79,7 +79,7 @@ func ExampleHTTP_batching() { // Start a tendermint node (and kvstore) in the background to test against app := kvstore.NewApplication() - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig("ExampleHTTP_batching") _, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout) if err != nil { diff --git a/rpc/client/main_test.go b/rpc/client/main_test.go index 1063239a4..4e2c0405c 100644 --- a/rpc/client/main_test.go +++ b/rpc/client/main_test.go @@ -19,7 +19,7 @@ func NodeSuite(t *testing.T) (service.Service, *config.Config) { ctx, cancel := context.WithCancel(context.Background()) - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig(t.Name()) // start a tendermint node in the background to test against dir, err := ioutil.TempDir("/tmp", fmt.Sprint("rpc-client-test-", t.Name())) diff --git a/rpc/grpc/grpc_test.go b/rpc/grpc/grpc_test.go index 71cd9c9e6..45deb6b76 100644 --- a/rpc/grpc/grpc_test.go +++ b/rpc/grpc/grpc_test.go @@ -18,7 +18,7 @@ func NodeSuite(t *testing.T) (service.Service, *config.Config) { ctx, cancel := context.WithCancel(context.Background()) - conf := rpctest.CreateConfig() + conf := rpctest.CreateConfig(t.Name()) // start a tendermint node in the background to test against app := kvstore.NewApplication() diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index e85ae12fd..259450540 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -4,8 +4,6 @@ import ( "context" "fmt" "os" - "path/filepath" - "strings" "time" abci "github.com/tendermint/tendermint/abci/types" @@ -54,18 +52,6 @@ func waitForGRPC(ctx context.Context, conf *cfg.Config) { } } -// f**ing long, but unique for each test -func makePathname() string { - // get path - p, err := os.Getwd() - if err != nil { - panic(err) - } - // fmt.Println(p) - sep := string(filepath.Separator) - return strings.ReplaceAll(p, sep, "_") -} - func randPort() int { port, err := tmnet.GetFreePort() if err != nil { @@ -80,9 +66,8 @@ func makeAddrs() (string, string, string) { fmt.Sprintf("tcp://127.0.0.1:%d", randPort()) } -func CreateConfig() *cfg.Config { - pathname := makePathname() - c := cfg.ResetTestRoot(pathname) +func CreateConfig(testName string) *cfg.Config { + c := cfg.ResetTestRoot(testName) // and we use random ports to run in parallel tm, rpc, grpc := makeAddrs()