Compare commits

...

1 Commits

Author SHA1 Message Date
colin
b8c463ffbe fix(test): chain monitor server endpoint conflict (#1047)
Co-authored-by: georgehao <georgehao@users.noreply.github.com>
2023-12-13 16:37:55 +08:00
4 changed files with 22 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.3.43"
var tag = "v4.3.44"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -1,8 +1,11 @@
package relayer
import (
"crypto/rand"
"encoding/json"
"math/big"
"os"
"strconv"
"testing"
"github.com/scroll-tech/go-ethereum/common"
@@ -52,6 +55,10 @@ func setupEnv(t *testing.T) {
MaxOpenNum: base.DBConfig.MaxOpenNum,
MaxIdleNum: base.DBConfig.MaxIdleNum,
}
port, err := rand.Int(rand.Reader, big.NewInt(10000))
assert.NoError(t, err)
svrPort := strconv.FormatInt(port.Int64()+50000, 10)
cfg.L2Config.RelayerConfig.ChainMonitor.BaseURL = "http://localhost:" + svrPort
// Create l2geth client.
l2Cli, err = base.L2Client()

View File

@@ -2,7 +2,10 @@ package tests
import (
"context"
"crypto/rand"
"math/big"
"net/http"
"strconv"
"strings"
"testing"
@@ -84,6 +87,11 @@ func setupEnv(t *testing.T) {
l2Auth, err = bind.NewKeyedTransactorWithChainID(rollupApp.Config.L1Config.RelayerConfig.GasOracleSenderPrivateKey, base.L2gethImg.ChainID())
assert.NoError(t, err)
port, err := rand.Int(rand.Reader, big.NewInt(10000))
assert.NoError(t, err)
svrPort := strconv.FormatInt(port.Int64()+40000, 10)
rollupApp.Config.L2Config.RelayerConfig.ChainMonitor.BaseURL = "http://localhost:" + svrPort
}
func mockChainMonitorServer(baseURL string) (*http.Server, error) {

View File

@@ -31,19 +31,19 @@ func testProcessStartEnableMetrics(t *testing.T) {
db := setupDB(t)
defer database.CloseDB(db)
port, err := rand.Int(rand.Reader, big.NewInt(2000))
port, err := rand.Int(rand.Reader, big.NewInt(10000))
assert.NoError(t, err)
svrPort := strconv.FormatInt(port.Int64()+50000, 10)
svrPort := strconv.FormatInt(port.Int64()+10000, 10)
rollupApp.RunApp(t, cutils.EventWatcherApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort)
port, err = rand.Int(rand.Reader, big.NewInt(2000))
port, err = rand.Int(rand.Reader, big.NewInt(10000))
assert.NoError(t, err)
svrPort = strconv.FormatInt(port.Int64()+50000, 10)
svrPort = strconv.FormatInt(port.Int64()+20000, 10)
rollupApp.RunApp(t, cutils.GasOracleApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort)
port, err = rand.Int(rand.Reader, big.NewInt(2000))
port, err = rand.Int(rand.Reader, big.NewInt(10000))
assert.NoError(t, err)
svrPort = strconv.FormatInt(port.Int64()+50000, 10)
svrPort = strconv.FormatInt(port.Int64()+30000, 10)
rollupApp.RunApp(t, cutils.RollupRelayerApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort)
rollupApp.WaitExit()