Browse Source

R4R: Config TestRoot modification for LCD test (#3177)

* add ResetTestRootWithChainID

* modify chainid
pull/3209/head
Joon 6 years ago
committed by Ethan Buchman
parent
commit
75cbe4a1c1
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      config/toml.go

+ 11
- 2
config/toml.go View File

@ -2,6 +2,7 @@ package config
import (
"bytes"
"fmt"
"os"
"path/filepath"
"text/template"
@ -317,6 +318,10 @@ namespace = "{{ .Instrumentation.Namespace }}"
/****** these are for test settings ***********/
func ResetTestRoot(testName string) *Config {
return ResetTestRootWithChainID(testName, "")
}
func ResetTestRootWithChainID(testName string, chainID string) *Config {
rootDir := os.ExpandEnv("$HOME/.tendermint_test")
rootDir = filepath.Join(rootDir, testName)
// Remove ~/.tendermint_test_bak
@ -353,6 +358,10 @@ func ResetTestRoot(testName string) *Config {
writeDefaultConfigFile(configFilePath)
}
if !cmn.FileExists(genesisFilePath) {
if chainID == "" {
chainID = "tendermint_test"
}
testGenesis := fmt.Sprintf(testGenesisFmt, chainID)
cmn.MustWriteFile(genesisFilePath, []byte(testGenesis), 0644)
}
// we always overwrite the priv val
@ -363,9 +372,9 @@ func ResetTestRoot(testName string) *Config {
return config
}
var testGenesis = `{
var testGenesisFmt = `{
"genesis_time": "2018-10-10T08:20:13.695936996Z",
"chain_id": "tendermint_test",
"chain_id": "%s",
"validators": [
{
"pub_key": {


Loading…
Cancel
Save