Browse Source

Fix rpc/test import; Remove ~/.tendermint_test on each test

pull/192/head
Jae Kwon 9 years ago
parent
commit
4b40a58c0e
4 changed files with 14 additions and 13 deletions
  1. +0
    -4
      Makefile
  2. +12
    -0
      config/tendermint_test/config.go
  3. +2
    -7
      rpc/test/config.go
  4. +0
    -2
      rpc/test/helpers.go

+ 0
- 4
Makefile View File

@ -18,13 +18,9 @@ build_race:
go build -race -o build/tendermint github.com/tendermint/tendermint/cmd/tendermint
test: build
-rm -rf ~/.tendermint_test_bak
-mv ~/.tendermint_test ~/.tendermint_test_bak && true
go test github.com/tendermint/tendermint/...
test_novendor: build
-rm -rf ~/.tendermint_test_bak
-mv ~/.tendermint_test ~/.tendermint_test_bak && true
go test $$(glide novendor)
draw_deps:


+ 12
- 0
config/tendermint_test/config.go View File

@ -26,6 +26,18 @@ func getTMRoot(rootDir string) string {
func initTMRoot(rootDir string) {
rootDir = getTMRoot(rootDir)
// Remove ~/.tendermint_test_bak
err := os.RemoveAll(rootDir + "_bak")
if err != nil {
PanicSanity(err.Error())
}
// Move ~/.tendermint_test to ~/.tendermint_test_bak
err = os.Rename(rootDir, rootDir+"_bak")
if err != nil {
PanicSanity(err.Error())
}
// Create new dir
EnsureDir(rootDir, 0700)
configFilePath := path.Join(rootDir, "config.toml")


+ 2
- 7
rpc/test/config.go View File

@ -1,18 +1,13 @@
package rpctest
import (
cfg "github.com/tendermint/tendermint/config"
tmcfg "github.com/tendermint/tendermint/config/tendermint_test"
cfg "github.com/tendermint/go-config"
)
var config cfg.Config = nil
func initConfig() {
func init() {
cfg.OnConfig(func(newConfig cfg.Config) {
config = newConfig
})
c := tmcfg.GetConfig("")
cfg.ApplyConfig(c) // Notify modules of new config
}

+ 0
- 2
rpc/test/helpers.go View File

@ -31,8 +31,6 @@ var (
// initialize config and create new node
func init() {
initConfig()
chainID = config.GetString("chain_id")
rpcAddr = config.GetString("rpc_laddr")
requestAddr = "http://" + rpcAddr


Loading…
Cancel
Save