mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
attempting to fix port binding issue
This commit is contained in:
@@ -146,7 +146,7 @@ func TestCreateListener(t *testing.T) {
|
||||
ctx: t.Context(),
|
||||
genesisTime: time.Now(),
|
||||
genesisValidatorsRoot: bytesutil.PadTo([]byte{'A'}, 32),
|
||||
cfg: &Config{UDPPort: 0, DB: db}, // Use port 0 to let OS assign an available port
|
||||
cfg: &Config{UDPPort: 2200, DB: db},
|
||||
custodyInfo: &custodyInfo{},
|
||||
custodyInfoSet: custodyInfoSet,
|
||||
}
|
||||
@@ -155,6 +155,7 @@ func TestCreateListener(t *testing.T) {
|
||||
defer listener.Close()
|
||||
|
||||
assert.Equal(t, true, listener.Self().IP().Equal(ipAddr), "IP address is not the expected type")
|
||||
assert.Equal(t, 2200, listener.Self().UDP(), "Incorrect port number")
|
||||
|
||||
pubkey := listener.Self().Pubkey()
|
||||
XisSame := pkey.PublicKey.X.Cmp(pubkey.X) == 0
|
||||
@@ -166,7 +167,7 @@ func TestCreateListener(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStartDiscV5_DiscoverAllPeers(t *testing.T) {
|
||||
port := 2000
|
||||
port := 2100
|
||||
ipAddr, pkey := createAddrAndPrivKey(t)
|
||||
genesisTime := time.Now()
|
||||
genesisValidatorsRoot := make([]byte, 32)
|
||||
@@ -285,9 +286,9 @@ func TestCreateLocalNode(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Define ports.
|
||||
const (
|
||||
udpPort = 2000
|
||||
tcpPort = 3000
|
||||
quicPort = 3000
|
||||
udpPort = 2600
|
||||
tcpPort = 3100
|
||||
quicPort = 3100
|
||||
)
|
||||
|
||||
custodyRequirement := params.BeaconConfig().CustodyRequirement
|
||||
@@ -373,7 +374,7 @@ func TestRebootDiscoveryListener(t *testing.T) {
|
||||
ctx: t.Context(),
|
||||
genesisTime: time.Now(),
|
||||
genesisValidatorsRoot: bytesutil.PadTo([]byte{'A'}, 32),
|
||||
cfg: &Config{UDPPort: 0, DB: db}, // Use port 0 to let OS assign an available port
|
||||
cfg: &Config{UDPPort: 2300, DB: db},
|
||||
custodyInfo: &custodyInfo{},
|
||||
custodyInfoSet: custodyInfoSet,
|
||||
}
|
||||
@@ -433,9 +434,9 @@ func TestMultiAddrConversion_OK(t *testing.T) {
|
||||
s := &Service{
|
||||
ctx: t.Context(),
|
||||
cfg: &Config{
|
||||
UDPPort: 0, // Use port 0 to let OS assign an available port
|
||||
TCPPort: 0,
|
||||
QUICPort: 0,
|
||||
UDPPort: 2400,
|
||||
TCPPort: 3200,
|
||||
QUICPort: 3200,
|
||||
DB: db,
|
||||
},
|
||||
genesisTime: time.Now(),
|
||||
@@ -596,7 +597,7 @@ func TestUDPMultiAddress(t *testing.T) {
|
||||
|
||||
s := &Service{
|
||||
ctx: t.Context(),
|
||||
cfg: &Config{UDPPort: 0, DB: db}, // Use port 0 to let OS assign an available port
|
||||
cfg: &Config{UDPPort: 2500, DB: db},
|
||||
genesisTime: genesisTime,
|
||||
genesisValidatorsRoot: genesisValidatorsRoot,
|
||||
custodyInfo: &custodyInfo{},
|
||||
@@ -614,6 +615,7 @@ func TestUDPMultiAddress(t *testing.T) {
|
||||
multiAddresses, err := s.DiscoveryAddresses()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, len(multiAddresses) > 0)
|
||||
assert.Equal(t, true, strings.Contains(multiAddresses[0].String(), fmt.Sprintf("%d", 2500)))
|
||||
assert.Equal(t, true, strings.Contains(multiAddresses[0].String(), "udp"))
|
||||
}
|
||||
|
||||
@@ -963,7 +965,7 @@ func TestRefreshPersistentSubnets(t *testing.T) {
|
||||
actualPingCount++
|
||||
return nil
|
||||
},
|
||||
cfg: &Config{UDPPort: 0, DB: testDB.SetupDB(t)}, // Use port 0 to let OS assign an available port
|
||||
cfg: &Config{UDPPort: 2700, DB: testDB.SetupDB(t)},
|
||||
peers: p2p.Peers(),
|
||||
genesisTime: time.Now().Add(-time.Duration(tc.epochSinceGenesis*secondsPerEpoch) * time.Second),
|
||||
genesisValidatorsRoot: bytesutil.PadTo([]byte{'A'}, 32),
|
||||
|
||||
@@ -63,9 +63,9 @@ func TestService_Start_OnlyStartsOnce(t *testing.T) {
|
||||
|
||||
cs := startup.NewClockSynchronizer()
|
||||
cfg := &Config{
|
||||
UDPPort: 2000,
|
||||
TCPPort: 3000,
|
||||
QUICPort: 3000,
|
||||
UDPPort: 2800,
|
||||
TCPPort: 3300,
|
||||
QUICPort: 3300,
|
||||
ClockWaiter: cs,
|
||||
DB: testDB.SetupDB(t),
|
||||
}
|
||||
@@ -111,9 +111,9 @@ func TestService_Start_NoDiscoverFlag(t *testing.T) {
|
||||
|
||||
cs := startup.NewClockSynchronizer()
|
||||
cfg := &Config{
|
||||
UDPPort: 2000,
|
||||
TCPPort: 3000,
|
||||
QUICPort: 3000,
|
||||
UDPPort: 2900,
|
||||
TCPPort: 3400,
|
||||
QUICPort: 3400,
|
||||
StateNotifier: &mock.MockStateNotifier{},
|
||||
NoDiscovery: true, // <-- no s.dv5Listener is created
|
||||
ClockWaiter: cs,
|
||||
@@ -147,7 +147,7 @@ func TestService_Start_NoDiscoverFlag(t *testing.T) {
|
||||
|
||||
func TestListenForNewNodes(t *testing.T) {
|
||||
const (
|
||||
port = uint(2000)
|
||||
port = uint(3000)
|
||||
testPollingPeriod = 1 * time.Second
|
||||
peerCount = 5
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user