github.com/palisadeinc/bor@v0.0.0-20230615125219-ab7196213d15/internal/cli/server/config_legacy_test.go (about)

     1  package server
     2  
     3  import (
     4  	"math/big"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestConfigLegacy(t *testing.T) {
    12  
    13  	readFile := func(path string) {
    14  		expectedConfig, err := readLegacyConfig(path)
    15  		assert.NoError(t, err)
    16  
    17  		testConfig := DefaultConfig()
    18  
    19  		testConfig.DataDir = "./data"
    20  		testConfig.Snapshot = false
    21  		testConfig.RequiredBlocks = map[string]string{
    22  			"31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e",
    23  			"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
    24  		}
    25  		testConfig.P2P.MaxPeers = 30
    26  		testConfig.TxPool.Locals = []string{}
    27  		testConfig.TxPool.LifeTime = time.Second
    28  		testConfig.Sealer.Enabled = true
    29  		testConfig.Sealer.GasCeil = 30000000
    30  		testConfig.Sealer.GasPrice = big.NewInt(1000000000)
    31  		testConfig.Gpo.IgnorePrice = big.NewInt(4)
    32  		testConfig.Cache.Cache = 1024
    33  		testConfig.Cache.Rejournal = time.Second
    34  
    35  		assert.Equal(t, expectedConfig, testConfig)
    36  	}
    37  
    38  	// read file in hcl format
    39  	t.Run("toml", func(t *testing.T) {
    40  		readFile("./testdata/test.toml")
    41  	})
    42  }