mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
config: WriteConfigFile should return error (#7169)
This commit is contained in:
@@ -22,7 +22,8 @@ func TestHTTPSimple(t *testing.T) {
|
||||
|
||||
// Start a tendermint node (and kvstore) in the background to test against
|
||||
app := kvstore.NewApplication()
|
||||
conf := rpctest.CreateConfig("ExampleHTTP_simple")
|
||||
conf, err := rpctest.CreateConfig("ExampleHTTP_simple")
|
||||
require.NoError(t, err)
|
||||
|
||||
_, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout)
|
||||
if err != nil {
|
||||
@@ -71,7 +72,8 @@ func TestHTTPBatching(t *testing.T) {
|
||||
|
||||
// Start a tendermint node (and kvstore) in the background to test against
|
||||
app := kvstore.NewApplication()
|
||||
conf := rpctest.CreateConfig("ExampleHTTP_batching")
|
||||
conf, err := rpctest.CreateConfig("ExampleHTTP_batching")
|
||||
require.NoError(t, err)
|
||||
|
||||
_, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,7 +20,8 @@ func NodeSuite(t *testing.T) (service.Service, *config.Config) {
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
conf := rpctest.CreateConfig(t.Name())
|
||||
conf, err := rpctest.CreateConfig(t.Name())
|
||||
require.NoError(t, err)
|
||||
|
||||
// start a tendermint node in the background to test against
|
||||
dir, err := ioutil.TempDir("/tmp", fmt.Sprint("rpc-client-test-", t.Name()))
|
||||
|
||||
@@ -57,15 +57,18 @@ func makeAddrs() (p2pAddr, rpcAddr string) {
|
||||
return fmt.Sprintf(addrTemplate, randPort()), fmt.Sprintf(addrTemplate, randPort())
|
||||
}
|
||||
|
||||
func CreateConfig(testName string) *config.Config {
|
||||
c := config.ResetTestRoot(testName)
|
||||
func CreateConfig(testName string) (*config.Config, error) {
|
||||
c, err := config.ResetTestRoot(testName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p2pAddr, rpcAddr := makeAddrs()
|
||||
c.P2P.ListenAddress = p2pAddr
|
||||
c.RPC.ListenAddress = rpcAddr
|
||||
c.Consensus.WalPath = "rpc-test"
|
||||
c.RPC.CORSAllowedOrigins = []string{"https://tendermint.com/"}
|
||||
return c
|
||||
return c, nil
|
||||
}
|
||||
|
||||
type ServiceCloser func(context.Context) error
|
||||
|
||||
Reference in New Issue
Block a user