add DebugSpew helper

This commit is contained in:
Yusef Napora 2020-06-29 13:11:53 -04:00
parent 79b0472924
commit 9cb809ac60
4 changed files with 12 additions and 8 deletions

View File

@ -79,6 +79,6 @@
[groups.run.test_params]
role = "drand"
drand_period = "1s"
drand_halt_duration = "20s"
drand_halt_duration = "1m"
drand_halt_begin = "10s"
drand_log_level = "info"
drand_log_level = "none"

View File

@ -3,6 +3,7 @@ module github.com/filecoin-project/oni/lotus-soup
go 1.14
require (
github.com/davecgh/go-spew v1.1.1
github.com/drand/drand v0.9.2-0.20200616080806-a94e9c1636a4
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef
github.com/filecoin-project/go-fil-markets v0.3.0

View File

@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/beacon"
@ -69,6 +70,11 @@ func (t *TestEnvironment) DurationParam(name string) time.Duration {
return d
}
func (t *TestEnvironment) DebugSpew(format string, args... interface{}) {
t.RecordMessage(spew.Sprintf(format, args...))
}
type Node struct {
fullApi api.FullNode
minerApi api.StorageMiner
@ -206,7 +212,7 @@ func getDrandOpts(ctx context.Context, t *TestEnvironment) (node.Option, error)
return nil, err
}
t.RecordMessage("setting drand config: %v", cfg)
t.DebugSpew("setting drand config: %v", cfg)
return node.Options(
node.Override(new(dtypes.DrandConfig), cfg.Config),
node.Override(new(dtypes.DrandBootstrap), cfg.GossipBootstrap),

View File

@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net"
@ -140,7 +139,6 @@ func runDrandNode(t *TestEnvironment) error {
}
defer dr.Close()
// TODO add ability to halt / recover on demand
ctx := context.Background()
t.SyncClient.MustSignalAndWait(ctx, stateReady, t.TestInstanceCount)
@ -327,8 +325,7 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) {
},
GossipBootstrap: relayAddrs,
}
dump, _ := json.Marshal(cfg)
t.RecordMessage("publishing drand config on sync topic: %s", string(dump))
t.DebugSpew("publishing drand config on sync topic: %v", cfg)
t.SyncClient.MustPublish(ctx, drandConfigTopic, &cfg)
}