Skip to content

Commit c586ff2

Browse files
feat(systemtest): allow chainID to be configured (#24962)
1 parent feec26d commit c586ff2

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

simapp/simd/cmd/testnet.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,11 @@ func initTestnetFiles(
248248
genFiles []string
249249
)
250250
const (
251-
rpcPort = 26657
252-
apiPort = 1317
253-
grpcPort = 9090
251+
rpcPort = 26657
252+
apiPort = 1317
253+
grpcPort = 9090
254+
pprofListen = 6060
255+
prometheusListen = 27780
254256
)
255257
p2pPortStart := 26656
256258

@@ -264,6 +266,8 @@ func initTestnetFiles(
264266
nodeConfig.P2P.AddrBookStrict = false
265267
nodeConfig.P2P.PexReactor = false
266268
nodeConfig.P2P.AllowDuplicateIP = true
269+
nodeConfig.Instrumentation.PrometheusListenAddr = fmt.Sprintf(":%d", prometheusListen+portOffset)
270+
nodeConfig.RPC.PprofListenAddress = fmt.Sprintf("localhost:%d", pprofListen+portOffset)
267271
appConfig.API.Address = fmt.Sprintf("tcp://0.0.0.0:%d", apiPort+portOffset)
268272
appConfig.GRPC.Address = fmt.Sprintf("0.0.0.0:%d", grpcPort+portOffset)
269273
}
@@ -285,7 +289,7 @@ func initTestnetFiles(
285289
ip string
286290
)
287291
if args.singleMachine {
288-
ip = "0.0.0.0"
292+
ip = "127.0.0.1"
289293
} else {
290294
ip, err = getIP(i, args.startingIPAddress)
291295
if err != nil {

systemtests/system.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type SystemUnderTest struct {
8080
chainID string
8181
}
8282

83-
func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTime time.Duration, initer ...TestnetInitializer) *SystemUnderTest {
83+
func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTime time.Duration, chainID string, initer ...TestnetInitializer) *SystemUnderTest {
8484
if execBinary == "" {
8585
panic("executable binary name must not be empty")
8686
}
@@ -90,7 +90,7 @@ func NewSystemUnderTest(execBinary string, verbose bool, nodesCount int, blockTi
9090
}
9191
execBinary = filepath.Join(WorkDir, "binaries", execBinary)
9292
s := &SystemUnderTest{
93-
chainID: "testing",
93+
chainID: chainID,
9494
execBinary: execBinary,
9595
outputDir: "./testnet",
9696
blockTime: blockTime,

systemtests/test_runner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var (
2020
)
2121

2222
func RunTests(m *testing.M) {
23+
chainID := flag.String("chain-id", "testing", "chainID")
2324
waitTime := flag.Duration("wait-time", DefaultWaitTime, "time to wait for chain events")
2425
nodesCount := flag.Int("nodes-count", 4, "number of nodes in the cluster")
2526
blockTime := flag.Duration("block-time", 3000*time.Millisecond, "block creation time")
@@ -47,7 +48,7 @@ func RunTests(m *testing.M) {
4748
}
4849
execBinaryName = *execBinary
4950

50-
Sut = NewSystemUnderTest(*execBinary, Verbose, *nodesCount, *blockTime)
51+
Sut = NewSystemUnderTest(*execBinary, Verbose, *nodesCount, *blockTime, *chainID)
5152
Sut.SetupChain() // setup chain and keyring
5253

5354
// run tests

0 commit comments

Comments
 (0)