From b8c735bd59190c27846f8f9e3cd9eec9096a1306 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sat, 16 May 2015 15:04:00 -0700 Subject: [PATCH] import tendermint/test to init ~/.tendermint_test/* --- rpc/test/.tendermint/genesis.json | 24 ------------------------ rpc/test/client_rpc_test.go | 3 ++- rpc/test/client_ws_test.go | 3 ++- rpc/test/config.go | 13 +++++++++++++ rpc/test/helpers_test.go | 14 ++++---------- rpc/test/ok.go | 1 - rpc/test/tests_test.go | 2 +- rpc/test/ws_helpers_test.go | 3 ++- 8 files changed, 24 insertions(+), 39 deletions(-) delete mode 100644 rpc/test/.tendermint/genesis.json create mode 100644 rpc/test/config.go delete mode 100644 rpc/test/ok.go diff --git a/rpc/test/.tendermint/genesis.json b/rpc/test/.tendermint/genesis.json deleted file mode 100644 index 18d3d52a0..000000000 --- a/rpc/test/.tendermint/genesis.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "accounts": [ - { - "address": "1D7A91CB32F758A02EBB9BE1FB6F8DEE56F90D42", - "amount": 200000000 - }, - { - "address": "AC89A6DDF4C309A89A2C4078CE409A5A7B282270", - "amount": 200000000 - } - ], - "validators": [ - { - "pub_key": [1, "06FBAC4E285285D1D91FCBC7E91C780ADA11516F67462340B3980CE2B94940E8"], - "amount": 1000000, - "unbond_to": [ - { - "address": "1D7A91CB32F758A02EBB9BE1FB6F8DEE56F90D42", - "amount": 100000 - } - ] - } - ] -} diff --git a/rpc/test/client_rpc_test.go b/rpc/test/client_rpc_test.go index 0d455c3d3..50cbd1b1d 100644 --- a/rpc/test/client_rpc_test.go +++ b/rpc/test/client_rpc_test.go @@ -1,6 +1,7 @@ -package rpc +package rpctest import ( + _ "github.com/tendermint/tendermint/test" "testing" ) diff --git a/rpc/test/client_ws_test.go b/rpc/test/client_ws_test.go index 23f2efdd9..f7dec99b3 100644 --- a/rpc/test/client_ws_test.go +++ b/rpc/test/client_ws_test.go @@ -1,4 +1,4 @@ -package rpc +package rpctest import ( "encoding/json" @@ -7,6 +7,7 @@ import ( "github.com/tendermint/tendermint/account" "github.com/tendermint/tendermint/binary" "github.com/tendermint/tendermint/rpc/types" + _ "github.com/tendermint/tendermint/test" "github.com/tendermint/tendermint/types" "net/http" "testing" diff --git a/rpc/test/config.go b/rpc/test/config.go new file mode 100644 index 000000000..ef5d54339 --- /dev/null +++ b/rpc/test/config.go @@ -0,0 +1,13 @@ +package rpctest + +import ( + cfg "github.com/tendermint/tendermint/config" +) + +var config cfg.Config = nil + +func init() { + cfg.OnConfig(func(newConfig cfg.Config) { + config = newConfig + }) +} diff --git a/rpc/test/helpers_test.go b/rpc/test/helpers_test.go index eb157cc5a..a8cd2b1cb 100644 --- a/rpc/test/helpers_test.go +++ b/rpc/test/helpers_test.go @@ -1,12 +1,10 @@ -package rpc +package rpctest import ( "bytes" "encoding/hex" "github.com/tendermint/tendermint/account" . "github.com/tendermint/tendermint/common" - cfg "github.com/tendermint/tendermint/config" - tmcfg "github.com/tendermint/tendermint/config/tendermint_test" "github.com/tendermint/tendermint/consensus" nm "github.com/tendermint/tendermint/node" "github.com/tendermint/tendermint/p2p" @@ -20,10 +18,9 @@ import ( // global variables for use across all tests var ( - config cfg.Config = nil - rpcAddr = "127.0.0.1:36657" // Not 46657 - requestAddr = "http://" + rpcAddr + "/" - websocketAddr = "ws://" + rpcAddr + "/events" + rpcAddr = "127.0.0.1:36657" // Not 46657 + requestAddr = "http://" + rpcAddr + "/" + websocketAddr = "ws://" + rpcAddr + "/events" node *nm.Node @@ -77,9 +74,6 @@ func newNode(ready chan struct{}) { // initialize config and create new node func init() { - config = tmcfg.GetConfig("") - cfg.ApplyConfig(config) - // Save new priv_validator file. priv := &state.PrivValidator{ Address: decodeHex(userAddr), diff --git a/rpc/test/ok.go b/rpc/test/ok.go deleted file mode 100644 index 9ab1e3e8e..000000000 --- a/rpc/test/ok.go +++ /dev/null @@ -1 +0,0 @@ -package rpc diff --git a/rpc/test/tests_test.go b/rpc/test/tests_test.go index 843413f73..06cd62e8e 100644 --- a/rpc/test/tests_test.go +++ b/rpc/test/tests_test.go @@ -1,4 +1,4 @@ -package rpc +package rpctest import ( "bytes" diff --git a/rpc/test/ws_helpers_test.go b/rpc/test/ws_helpers_test.go index 241e7a7ba..93758bcb6 100644 --- a/rpc/test/ws_helpers_test.go +++ b/rpc/test/ws_helpers_test.go @@ -1,10 +1,11 @@ -package rpc +package rpctest import ( "bytes" "fmt" "github.com/gorilla/websocket" "github.com/tendermint/tendermint/binary" + _ "github.com/tendermint/tendermint/test" "github.com/tendermint/tendermint/types" "testing" )