-
Notifications
You must be signed in to change notification settings - Fork 107
/
multiple_seeds.go
57 lines (45 loc) · 1.34 KB
/
multiple_seeds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package e2e
import (
"context"
"fmt"
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/env"
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/oasis"
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/scenario"
)
// MultipleSeeds is the scenario where multiple seed nodes are used.
var MultipleSeeds scenario.Scenario = &multipleSeeds{
Scenario: *NewScenario("multiple-seeds"),
}
type multipleSeeds struct {
Scenario
}
func (sc *multipleSeeds) Fixture() (*oasis.NetworkFixture, error) {
f, err := sc.Scenario.Fixture()
if err != nil {
return nil, err
}
f.Seeds = []oasis.SeedFixture{
// Disable populating address book from genesis, so we also test
// including new peers.
{DisableAddrBookFromGenesis: true},
{DisableAddrBookFromGenesis: true},
{DisableAddrBookFromGenesis: true},
}
f.Network.SetInsecureBeacon()
return f, nil
}
func (sc *multipleSeeds) Clone() scenario.Scenario {
return &multipleSeeds{
Scenario: sc.Scenario.Clone(),
}
}
func (sc *multipleSeeds) Run(ctx context.Context, childEnv *env.Env) error { // nolint: gocyclo
if err := sc.Net.Start(); err != nil {
return fmt.Errorf("net Start: %w", err)
}
sc.Logger.Info("waiting for network to come up")
if err := sc.Net.Controller().WaitNodesRegistered(ctx, 3); err != nil {
return fmt.Errorf("WaitNodesRegistered: %w", err)
}
return nil
}