Skip to content

Commit

Permalink
testing: add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Mar 7, 2024
1 parent bc2fdae commit f5637a5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/test/e2e/pruning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"go.sia.tech/renterd/api"
"go.sia.tech/renterd/hostdb"
"go.sia.tech/renterd/internal/test"
"go.uber.org/zap/zapcore"
)

func TestHostPruning(t *testing.T) {
Expand All @@ -21,7 +22,9 @@ func TestHostPruning(t *testing.T) {
}

// create a new test cluster
cluster := newTestCluster(t, clusterOptsDefault)
opts := clusterOptsDefault
opts.logger = newTestLoggerCustom(zapcore.DebugLevel)
cluster := newTestCluster(t, opts)
defer cluster.Shutdown()
b := cluster.Bus
w := cluster.Worker
Expand Down Expand Up @@ -95,11 +98,18 @@ func TestHostPruning(t *testing.T) {
recordFailedInteractions(1, h1.PublicKey())

// assert the host was pruned
var cnt int
tt.Retry(10, time.Second, func() error {
hostss, err = b.Hosts(context.Background(), api.GetHostsOptions{})
tt.OK(err)
if len(hostss) != 0 {
a.Trigger(false) // trigger autopilot
triggered, err := a.Trigger(false) // trigger autopilot
if err != nil {
t.Log("failed to trigger autopilot, attempt %d", err, cnt)

Check failure on line 108 in internal/test/e2e/pruning_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 1.22)

printf: (*testing.common).Log call has possible Printf formatting directive %d (govet)
} else {
t.Logf("triggered autopilot %t, attempt %d", triggered, cnt)
}
cnt++
return fmt.Errorf("host was not pruned, %+v", hostss[0].Interactions)
}
return nil
Expand Down

0 comments on commit f5637a5

Please sign in to comment.