From c27fdc263c3bdf9a50aaff64a37972ad3a89654b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 10 Jun 2021 12:22:55 +0100 Subject: [PATCH] deals harness: more improvements. --- itests/kit/deals.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/itests/kit/deals.go b/itests/kit/deals.go index 125044656..5d57a91b8 100644 --- a/itests/kit/deals.go +++ b/itests/kit/deals.go @@ -3,7 +3,6 @@ package kit import ( "bytes" "context" - "fmt" "io/ioutil" "os" "path/filepath" @@ -48,7 +47,7 @@ func (dh *DealHarness) MakeFullDeal(ctx context.Context, rseed int, carExport, f require.NoError(dh.t, err) fcid := res.Root - fmt.Println("FILE CID: ", fcid) + dh.t.Logf("FILE CID: %s", fcid) deal := dh.StartDeal(ctx, fcid, fastRet, startEpoch) @@ -109,7 +108,7 @@ loop: case storagemarket.StorageDealError: dh.t.Fatal("deal errored", di.Message) case storagemarket.StorageDealActive: - fmt.Println("COMPLETE", di) + dh.t.Log("COMPLETE", di) break loop } @@ -124,7 +123,7 @@ loop: } } - fmt.Printf("Deal %d state: client:%s provider:%s\n", di.DealID, storagemarket.DealStates[di.State], storagemarket.DealStates[minerState]) + dh.t.Logf("Deal %d state: client:%s provider:%s\n", di.DealID, storagemarket.DealStates[di.State], storagemarket.DealStates[minerState]) time.Sleep(time.Second / 2) if cb != nil { cb() @@ -153,10 +152,10 @@ func (dh *DealHarness) WaitDealPublished(ctx context.Context, deal *cid.Cid) { case storagemarket.StorageDealError: dh.t.Fatal("deal errored", di.Message) case storagemarket.StorageDealFinalizing, storagemarket.StorageDealAwaitingPreCommit, storagemarket.StorageDealSealing, storagemarket.StorageDealActive: - fmt.Println("COMPLETE", di) + dh.t.Log("COMPLETE", di) return } - fmt.Println("Deal state: ", storagemarket.DealStates[di.State]) + dh.t.Log("Deal state: ", storagemarket.DealStates[di.State]) } } } @@ -183,9 +182,7 @@ func (dh *DealHarness) PerformRetrieval(ctx context.Context, fcid cid.Cid, piece offers, err := dh.client.ClientFindData(ctx, fcid, piece) require.NoError(dh.t, err) - if len(offers) < 1 { - dh.t.Fatal("no offers") - } + require.NotEmpty(dh.t, offers, "no offers") rpath, err := ioutil.TempDir("", "lotus-retrieve-test-") require.NoError(dh.t, err)