Merge remote-tracking branch 'origin/master' into feat/async-restartable-workers

This commit is contained in:
Łukasz Magiera
2020-10-27 16:56:29 +01:00
13 changed files with 302 additions and 22 deletions
+5 -2
View File
@@ -493,7 +493,7 @@ func interactiveDeal(cctx *cli.Context) error {
var dur time.Duration
var epochs abi.ChainEpoch
var verified bool
var ds lapi.DataSize
var ds lapi.DataCIDSize
// find
var candidateAsks []*storagemarket.StorageAsk
@@ -557,7 +557,7 @@ uiLoop:
}
color.Blue(".. calculating data size\n")
ds, err = api.ClientDealSize(ctx, data)
ds, err = api.ClientDealPieceCID(ctx, data)
if err != nil {
return err
}
@@ -847,6 +847,9 @@ uiLoop:
Data: &storagemarket.DataRef{
TransferType: storagemarket.TTGraphsync,
Root: data,
PieceCid: &ds.PieceCID,
PieceSize: ds.PieceSize.Unpadded(),
},
Wallet: a,
Miner: maddr,
+4 -4
View File
@@ -48,7 +48,7 @@ func TestPaymentChannels(t *testing.T) {
receiverAddr := addrs[1]
// Create mock CLI
mockCLI := clitest.NewMockCLI(t, Commands)
mockCLI := clitest.NewMockCLI(ctx, t, Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr)
@@ -99,7 +99,7 @@ func TestPaymentChannelStatus(t *testing.T) {
receiverAddr := addrs[1]
// Create mock CLI
mockCLI := clitest.NewMockCLI(t, Commands)
mockCLI := clitest.NewMockCLI(ctx, t, Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
// creator: paych status-by-from-to <creator> <receiver>
@@ -179,7 +179,7 @@ func TestPaymentChannelVouchers(t *testing.T) {
receiverAddr := addrs[1]
// Create mock CLI
mockCLI := clitest.NewMockCLI(t, Commands)
mockCLI := clitest.NewMockCLI(ctx, t, Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr)
@@ -310,7 +310,7 @@ func TestPaymentChannelVoucherCreateShortfall(t *testing.T) {
receiverAddr := addrs[1]
// Create mock CLI
mockCLI := clitest.NewMockCLI(t, Commands)
mockCLI := clitest.NewMockCLI(ctx, t, Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
// creator: paych add-funds <creator> <receiver> <amount>
+18 -2
View File
@@ -11,6 +11,8 @@ import (
"testing"
"time"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/api/test"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
@@ -25,7 +27,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
defer cancel()
// Create mock CLI
mockCLI := NewMockCLI(t, cmds)
mockCLI := NewMockCLI(ctx, t, cmds)
clientCLI := mockCLI.Client(clientNode.ListenAddr)
// Get the miner address
@@ -74,7 +76,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
// Wait for provider to start sealing deal
dealStatus := ""
for dealStatus != "StorageDealSealing" {
for {
// client list-deals
out = clientCLI.RunCmd("client", "list-deals")
fmt.Println("list-deals:\n", out)
@@ -88,6 +90,9 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
}
dealStatus = parts[3]
fmt.Println(" Deal status:", dealStatus)
if dealComplete(t, dealStatus) {
break
}
time.Sleep(time.Second)
}
@@ -101,3 +106,14 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
fmt.Println("retrieve:\n", out)
require.Regexp(t, regexp.MustCompile("Success"), out)
}
func dealComplete(t *testing.T, dealStatus string) bool {
switch dealStatus {
case "StorageDealFailing", "StorageDealError":
t.Fatal(xerrors.Errorf("Storage deal failed with status: " + dealStatus))
case "StorageDealStaged", "StorageDealSealing", "StorageDealActive", "StorageDealExpired", "StorageDealSlashed":
return true
}
return false
}
+3 -1
View File
@@ -2,6 +2,7 @@ package test
import (
"bytes"
"context"
"flag"
"strings"
"testing"
@@ -18,7 +19,7 @@ type MockCLI struct {
out *bytes.Buffer
}
func NewMockCLI(t *testing.T, cmds []*lcli.Command) *MockCLI {
func NewMockCLI(ctx context.Context, t *testing.T, cmds []*lcli.Command) *MockCLI {
// Create a CLI App with an --api-url flag so that we can specify which node
// the command should be executed against
app := &lcli.App{
@@ -36,6 +37,7 @@ func NewMockCLI(t *testing.T, cmds []*lcli.Command) *MockCLI {
app.Setup()
cctx := lcli.NewContext(app, &flag.FlagSet{}, nil)
cctx.Context = ctx
return &MockCLI{t: t, cmds: cmds, cctx: cctx, out: &out}
}
+1 -1
View File
@@ -18,7 +18,7 @@ func RunMultisigTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNod
ctx := context.Background()
// Create mock CLI
mockCLI := NewMockCLI(t, cmds)
mockCLI := NewMockCLI(ctx, t, cmds)
clientCLI := mockCLI.Client(clientNode.ListenAddr)
// Create some wallets on the node to use for testing multisig