fix client tests.
This commit is contained in:
parent
20dfe220f3
commit
b56568d720
@ -37,23 +37,23 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode TestFullNode)
|
||||
minerAddr := addrs[0]
|
||||
fmt.Println("Miner:", minerAddr)
|
||||
|
||||
// Client query-ask <Miner addr>
|
||||
// client query-ask <Miner addr>
|
||||
out := clientCLI.RunCmd("client", "query-ask", minerAddr.String())
|
||||
require.Regexp(t, regexp.MustCompile("Ask:"), out)
|
||||
|
||||
// Create a deal (non-interactive)
|
||||
// Client deal --start-epoch=<start epoch> <cid> <Miner addr> 1000000attofil <duration>
|
||||
// client deal --start-epoch=<start epoch> <cid> <Miner addr> 1000000attofil <duration>
|
||||
res, _, err := CreateImportFile(ctx, clientNode, 1)
|
||||
require.NoError(t, err)
|
||||
startEpoch := fmt.Sprintf("--start-epoch=%d", 2<<12)
|
||||
dataCid := res.Root
|
||||
price := "1000000attofil"
|
||||
duration := fmt.Sprintf("%d", build.MinDealDuration)
|
||||
out = clientCLI.RunCmd("Client", "deal", startEpoch, dataCid.String(), minerAddr.String(), price, duration)
|
||||
fmt.Println("Client deal", out)
|
||||
out = clientCLI.RunCmd("client", "deal", startEpoch, dataCid.String(), minerAddr.String(), price, duration)
|
||||
fmt.Println("client deal", out)
|
||||
|
||||
// Create a deal (interactive)
|
||||
// Client deal
|
||||
// client deal
|
||||
// <cid>
|
||||
// <duration> (in days)
|
||||
// <Miner addr>
|
||||
@ -63,7 +63,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode TestFullNode)
|
||||
require.NoError(t, err)
|
||||
dataCid2 := res.Root
|
||||
duration = fmt.Sprintf("%d", build.MinDealDuration/builtin.EpochsInDay)
|
||||
cmd := []string{"Client", "deal"}
|
||||
cmd := []string{"client", "deal"}
|
||||
interactiveCmds := []string{
|
||||
dataCid2.String(),
|
||||
duration,
|
||||
@ -72,13 +72,13 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode TestFullNode)
|
||||
"yes",
|
||||
}
|
||||
out = clientCLI.RunInteractiveCmd(cmd, interactiveCmds)
|
||||
fmt.Println("Client deal:\n", out)
|
||||
fmt.Println("client deal:\n", out)
|
||||
|
||||
// Wait for provider to start sealing deal
|
||||
dealStatus := ""
|
||||
for {
|
||||
// Client list-deals
|
||||
out = clientCLI.RunCmd("Client", "list-deals")
|
||||
// client list-deals
|
||||
out = clientCLI.RunCmd("client", "list-deals")
|
||||
fmt.Println("list-deals:\n", out)
|
||||
|
||||
lines := strings.Split(out, "\n")
|
||||
@ -101,11 +101,11 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode TestFullNode)
|
||||
}
|
||||
|
||||
// Retrieve the first file from the Miner
|
||||
// Client retrieve <cid> <file path>
|
||||
// client retrieve <cid> <file path>
|
||||
tmpdir, err := ioutil.TempDir(os.TempDir(), "test-cli-Client")
|
||||
require.NoError(t, err)
|
||||
path := filepath.Join(tmpdir, "outfile.dat")
|
||||
out = clientCLI.RunCmd("Client", "retrieve", dataCid.String(), path)
|
||||
out = clientCLI.RunCmd("client", "retrieve", dataCid.String(), path)
|
||||
fmt.Println("retrieve:\n", out)
|
||||
require.Regexp(t, regexp.MustCompile("Success"), out)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user