move drand to common_roles & fix mock randomness override

This commit is contained in:
Yusef Napora 2020-06-25 11:56:12 -04:00
parent 3f15146c19
commit fda66f5bd9
3 changed files with 20 additions and 13 deletions

View File

@ -238,15 +238,3 @@ func extractCarData(ctx context.Context, rdata []byte, rpath string) []byte {
return rdata
}
func runDrandNode(t *TestEnvironment) error {
t.RecordMessage("running drand node")
_, err := prepareDrandNode(t)
if err != nil {
return err
}
// TODO add ability to halt / recover on demand
ctx := context.Background()
t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount)
return nil
}

View File

@ -66,3 +66,16 @@ func runMiner(t *TestEnvironment) error {
t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount)
return nil
}
func runDrandNode(t *TestEnvironment) error {
t.RecordMessage("running drand node")
_, err := prepareDrandNode(t)
if err != nil {
return err
}
// TODO add ability to halt / recover on demand
ctx := context.Background()
t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount)
return nil
}

View File

@ -693,7 +693,13 @@ func getDrandConfig(ctx context.Context, t *TestEnvironment) (node.Option, error
), nil
case "mock":
return node.Override(new(beacon.RandomBeacon), modtest.RandomBeacon), nil
return node.Options(
node.Override(new(beacon.RandomBeacon), modtest.RandomBeacon),
node.Override(new(dtypes.DrandConfig), dtypes.DrandConfig{
ChainInfoJSON: "{\"Hash\":\"wtf\"}",
}),
node.Override(new(dtypes.DrandBootstrap), dtypes.DrandBootstrap{}),
), nil
default:
return nil, fmt.Errorf("unknown random_beacon_type: %s", beaconType)