From 9cb809ac605b4e3f0ef66782e786efd6f76c0e29 Mon Sep 17 00:00:00 2001 From: Yusef Napora Date: Mon, 29 Jun 2020 13:11:53 -0400 Subject: [PATCH] add DebugSpew helper --- lotus-soup/compositions/composition-drand-halt.toml | 4 ++-- lotus-soup/go.mod | 1 + lotus-soup/node.go | 10 ++++++++-- lotus-soup/role_drand.go | 5 +---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lotus-soup/compositions/composition-drand-halt.toml b/lotus-soup/compositions/composition-drand-halt.toml index 366b90f7c..ac7039265 100644 --- a/lotus-soup/compositions/composition-drand-halt.toml +++ b/lotus-soup/compositions/composition-drand-halt.toml @@ -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" diff --git a/lotus-soup/go.mod b/lotus-soup/go.mod index 18a7021ab..7bd91710d 100644 --- a/lotus-soup/go.mod +++ b/lotus-soup/go.mod @@ -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 diff --git a/lotus-soup/node.go b/lotus-soup/node.go index 95a628607..a60747333 100644 --- a/lotus-soup/node.go +++ b/lotus-soup/node.go @@ -8,7 +8,8 @@ import ( "sort" "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), diff --git a/lotus-soup/role_drand.go b/lotus-soup/role_drand.go index 8781c8694..8f60eb2f6 100644 --- a/lotus-soup/role_drand.go +++ b/lotus-soup/role_drand.go @@ -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) }