mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
d077483577
* v3 import renamings * tidy * fmt * rev * Update beacon-chain/core/epoch/precompute/reward_penalty_test.go * Update beacon-chain/core/helpers/validators_test.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/iface/BUILD.bazel * Update beacon-chain/db/kv/kv.go * Update beacon-chain/db/kv/state.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/sync/initial-sync/service.go * fix deps * fix bad replacements * fix bad replacements * change back * gohashtree version * fix deps Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
package params
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/testing/assert"
|
|
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
|
)
|
|
|
|
func Test_port(t *testing.T) {
|
|
var existingRegistrations []int
|
|
|
|
p, err := port(2000, 3, 0, &existingRegistrations)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 2000, p)
|
|
p, err = port(2000, 3, 1, &existingRegistrations)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 2016, p)
|
|
p, err = port(2000, 3, 2, &existingRegistrations)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 2032, p)
|
|
_, err = port(2000, 3, 2, &existingRegistrations)
|
|
assert.NotNil(t, err)
|
|
// We pass the last unavailable port
|
|
_, err = port(2047, 3, 0, &existingRegistrations)
|
|
assert.NotNil(t, err)
|
|
}
|
|
|
|
func TestStandardPorts(t *testing.T) {
|
|
var existingRegistrations []int
|
|
testPorts := &ports{}
|
|
assert.NoError(t, initializeStandardPorts(2, 0, testPorts, &existingRegistrations))
|
|
assert.Equal(t, 16, len(existingRegistrations))
|
|
assert.NotEqual(t, 0, testPorts.PrysmBeaconNodeGatewayPort)
|
|
assert.NotEqual(t, 0, testPorts.PrysmBeaconNodeTCPPort)
|
|
assert.NotEqual(t, 0, testPorts.JaegerTracingPort)
|
|
}
|
|
|
|
func TestMulticlientPorts(t *testing.T) {
|
|
var existingRegistrations []int
|
|
testPorts := &ports{}
|
|
assert.NoError(t, initializeMulticlientPorts(2, 0, testPorts, &existingRegistrations))
|
|
assert.Equal(t, 3, len(existingRegistrations))
|
|
assert.NotEqual(t, 0, testPorts.LighthouseBeaconNodeHTTPPort)
|
|
assert.NotEqual(t, 0, testPorts.LighthouseBeaconNodeMetricsPort)
|
|
assert.NotEqual(t, 0, testPorts.LighthouseBeaconNodeP2PPort)
|
|
}
|