Skip to content

Commit

Permalink
test: updating system test
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre committed Nov 8, 2023
1 parent afe1286 commit 94c61d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 3 additions & 5 deletions network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type network struct {
// Adding these linter later: contextcheck and containedctx
ctx context.Context
cancel func()
name string
config *Config
host lp2phost.Host
mdns *mdnsService
Expand Down Expand Up @@ -198,7 +197,6 @@ func newNetwork(conf *Config, log *logger.SubLogger, opts []lp2p.Option) (*netwo
n := &network{
ctx: ctx,
cancel: cancel,
name: conf.NetworkName,
config: conf,
logger: log,
host: host,
Expand All @@ -208,8 +206,8 @@ func newNetwork(conf *Config, log *logger.SubLogger, opts []lp2p.Option) (*netwo

log.SetObj(n)

kadProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/gossip/v1", n.name)) // TODO: better name?
streamProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/stream/v1", n.name))
kadProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/gossip/v1", conf.NetworkName)) // TODO: better name?
streamProtocolID := lp2pcore.ProtocolID(fmt.Sprintf("/%s/stream/v1", conf.NetworkName))

if conf.EnableMdns {
n.mdns = newMdnsService(ctx, n.host, n.logger)
Expand Down Expand Up @@ -333,7 +331,7 @@ func (n *network) consensusTopicName() string {
}

func (n *network) TopicName(topic string) string {
return fmt.Sprintf("/%s/topic/%s/v1", n.name, topic)
return fmt.Sprintf("/%s/topic/%s/v1", n.config.NetworkName, topic)
}

func (n *network) CloseConnection(pid lp2ppeer.ID) {
Expand Down
9 changes: 6 additions & 3 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestMain(m *testing.M) {
tValKeys[i][0] = bls.NewValidatorKey(key0)
tValKeys[i][1] = bls.NewValidatorKey(key1)
tValKeys[i][2] = bls.NewValidatorKey(key2)
tConfigs[i] = config.DefaultConfigLocalnet()
tConfigs[i] = config.DefaultConfigMainnet()

tConfigs[i].Store.Path = util.TempDirPath()
tConfigs[i].Consensus.ChangeProposerTimeout = 4 * time.Second
Expand All @@ -83,17 +83,20 @@ func TestMain(m *testing.M) {
tConfigs[i].Sync.Firewall.Enabled = false
tConfigs[i].Network.EnableMdns = true
tConfigs[i].Network.ForcePrivateNetwork = true
tConfigs[i].Network.Bootstrapper = true
tConfigs[i].Network.Bootstrapper = false
tConfigs[i].Network.NetworkKey = util.TempFilePath()
tConfigs[i].Network.NetworkName = "test"
tConfigs[i].Network.ListenAddrStrings = []string{"/ip4/127.0.0.1/tcp/0", "/ip4/127.0.0.1/udp/0/quic-v1"}
tConfigs[i].Network.BootstrapAddrStrings = []string{}
tConfigs[i].Network.MinConns = 3
tConfigs[i].Network.MinConns = 4
tConfigs[i].Network.MaxConns = 8
tConfigs[i].HTTP.Enable = false
tConfigs[i].GRPC.Enable = false

sync.LatestBlockInterval = 10

if i == 0 {
tConfigs[i].Network.Bootstrapper = true
tConfigs[i].Sync.NodeNetwork = true
tConfigs[i].GRPC.Enable = true
tConfigs[i].GRPC.Listen = tGRPCAddress
Expand Down

0 comments on commit 94c61d7

Please sign in to comment.