Skip to content

Commit

Permalink
fix(e2e): find available port to avoid timing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
seolaoh committed Dec 17, 2024
1 parent 1c6d7d3 commit 347670f
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions op-e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,22 +976,9 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste

// [Kroma: START]

// getFreePort dynamically allocates an unused TCP port.
func getFreePort() (int, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return 0, err
}
defer listener.Close()
return listener.Addr().(*net.TCPAddr).Port, nil
}

func setupNodesForMPT(t *testing.T, cfg *SystemConfig) {
// Dynamically allocate a random unused port.
historicalRpcPort, err := getFreePort()
if err != nil {
t.Fatalf("failed to get a free port: %v", err)
}
historicalRpcPort := findAvailablePort(t)

// Setup historical rpc node.
cfg.Nodes["historical"] = &rollupNode.Config{
Expand Down

0 comments on commit 347670f

Please sign in to comment.