go-ethereum/internal/cli/server/config_legacy_test.go
Manav Darji 457314783f
internal/cli/server: fix flag behaviour (#529)
* remove setting maxpeers to 0 for nodiscover flag

* set default prometheus and open-collector endpoint

* skip building grpc address from pprof address and port

* fix: linters

* fix and improve tests

* use loopback address for prometheus and open-collector endpoint

* add logs for prometheus and open-collector setup

* updated the script to handle prometheus-addr

* updated builder/files/config.toml

Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
2022-09-27 13:36:42 +05:30

42 lines
1.1 KiB
Go

package server
import (
"math/big"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestConfigLegacy(t *testing.T) {
readFile := func(path string) {
expectedConfig, err := readLegacyConfig(path)
assert.NoError(t, err)
testConfig := DefaultConfig()
testConfig.DataDir = "./data"
testConfig.Snapshot = false
testConfig.RequiredBlocks = map[string]string{
"31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e",
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
}
testConfig.P2P.MaxPeers = 30
testConfig.TxPool.Locals = []string{}
testConfig.TxPool.LifeTime = time.Second
testConfig.Sealer.Enabled = true
testConfig.Sealer.GasCeil = 30000000
testConfig.Sealer.GasPrice = big.NewInt(1000000000)
testConfig.Gpo.IgnorePrice = big.NewInt(4)
testConfig.Cache.Cache = 1024
testConfig.Cache.Rejournal = time.Second
assert.Equal(t, expectedConfig, testConfig)
}
// read file in hcl format
t.Run("toml", func(t *testing.T) {
readFile("./testdata/test.toml")
})
}