cmd/swarm: speed up tests (#17878)

These minor changes already shaved off around 30s.
This commit is contained in:
Elad
2018-10-09 14:08:40 +02:00
committed by Felix Lange
parent 0fe9a372b3
commit da290e9707
4 changed files with 38 additions and 31 deletions

View File

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/log"
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
"github.com/ethereum/go-ethereum/swarm/testutil"
"github.com/mattn/go-colorable"
)
@ -298,8 +299,8 @@ func TestCLISwarmUpDefaultPath(t *testing.T) {
}
func testCLISwarmUpDefaultPath(toEncrypt bool, absDefaultPath bool, t *testing.T) {
cluster := newTestCluster(t, 1)
defer cluster.Shutdown()
srv := testutil.NewTestSwarmServer(t, serverFunc, nil)
defer srv.Close()
tmp, err := ioutil.TempDir("", "swarm-defaultpath-test")
if err != nil {
@ -323,7 +324,7 @@ func testCLISwarmUpDefaultPath(toEncrypt bool, absDefaultPath bool, t *testing.T
args := []string{
"--bzzapi",
cluster.Nodes[0].URL,
srv.URL,
"--recursive",
"--defaultpath",
defaultPath,
@ -340,7 +341,7 @@ func testCLISwarmUpDefaultPath(toEncrypt bool, absDefaultPath bool, t *testing.T
up.ExpectExit()
hash := matches[0]
client := swarm.NewClient(cluster.Nodes[0].URL)
client := swarm.NewClient(srv.URL)
m, isEncrypted, err := client.DownloadManifest(hash)
if err != nil {