prysm-pulse/beacon-chain/p2p/parameter_test.go
kasey 588dea83b7
Config registry (#10683)
* test coverage and updates to config twiddlers

* LoadChainConfigFile error if SetActive conflicts

* lint

* wip working around test issues

* more fixes, mass test updates

* lint

* linting

* thanks deepsource!

* fix undeclared vars

* fixing more undefined

* fix a bug, make a bug, repeat

* gaz

* use stock mainnet in case fork schedule matters

* remove unused KnownConfigs

* post-merge cleanup

* eliminating OverrideBeaconConfig outside tests

* more cleanup of OverrideBeaconConfig outside tests

* config for interop w/ genesis gen support

* improve var name

* API on package instead of exported value

* cleanup remainders of "registry" naming

* Nishant feedback

* add ropstein to configset

* lint

* lint #2

* ✂️

* revert accidental commented line

* check if active is nil (replace called on empty)

* Nishant feedback

* replace OverrideBeaconConfig call

* update interop instructions w/ new flag

* don't let interop replace config set via cli flags

Co-authored-by: kasey <kasey@users.noreply.github.com>
2022-05-20 07:16:53 +00:00

49 lines
1.5 KiB
Go

package p2p
import (
"testing"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/testing/assert"
)
func TestOverlayParameters(t *testing.T) {
params.SetupTestConfigCleanup(t)
pms := pubsubGossipParam()
assert.Equal(t, gossipSubD, pms.D, "gossipSubD")
assert.Equal(t, gossipSubDlo, pms.Dlo, "gossipSubDlo")
assert.Equal(t, gossipSubDhi, pms.Dhi, "gossipSubDhi")
}
func TestGossipParameters(t *testing.T) {
params.SetupTestConfigCleanup(t)
setPubSubParameters()
pms := pubsubGossipParam()
assert.Equal(t, gossipSubMcacheLen, pms.HistoryLength, "gossipSubMcacheLen")
assert.Equal(t, gossipSubMcacheGossip, pms.HistoryGossip, "gossipSubMcacheGossip")
assert.Equal(t, gossipSubSeenTTL, int(pubsub.TimeCacheDuration.Milliseconds()/pms.HeartbeatInterval.Milliseconds()), "gossipSubSeenTtl")
}
func TestFanoutParameters(t *testing.T) {
params.SetupTestConfigCleanup(t)
pms := pubsubGossipParam()
if pms.FanoutTTL != gossipSubFanoutTTL {
t.Errorf("gossipSubFanoutTTL, wanted: %d, got: %d", gossipSubFanoutTTL, pms.FanoutTTL)
}
}
func TestHeartbeatParameters(t *testing.T) {
params.SetupTestConfigCleanup(t)
pms := pubsubGossipParam()
if pms.HeartbeatInterval != gossipSubHeartbeatInterval {
t.Errorf("gossipSubHeartbeatInterval, wanted: %d, got: %d", gossipSubHeartbeatInterval, pms.HeartbeatInterval)
}
}
func TestMiscParameters(t *testing.T) {
params.SetupTestConfigCleanup(t)
setPubSubParameters()
assert.Equal(t, randomSubD, pubsub.RandomSubD, "randomSubD")
}