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] [groups.run.test_params]
role = "drand" role = "drand"
drand_period = "1s" drand_period = "1s"
drand_halt_duration = "20s" drand_halt_duration = "1m"
drand_halt_begin = "10s" 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 go 1.14
require ( require (
github.com/davecgh/go-spew v1.1.1
github.com/drand/drand v0.9.2-0.20200616080806-a94e9c1636a4 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-address v0.0.2-0.20200504173055-8b6f2fb2b3ef
github.com/filecoin-project/go-fil-markets v0.3.0 github.com/filecoin-project/go-fil-markets v0.3.0

View File

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

View File

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