aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/access_test.go
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-10-09 20:08:40 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-10-09 20:08:40 +0800
commitda290e9707d6b3074b571722bbb557815b03ad48 (patch)
treedbb7a5c62330bc3f9a862f2eacc067c477e16719 /cmd/swarm/access_test.go
parent0fe9a372b3ff9fd0746c3e271bd0ddddd3412122 (diff)
downloadgo-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar.gz
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar.bz2
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar.lz
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar.xz
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.tar.zst
go-tangerine-da290e9707d6b3074b571722bbb557815b03ad48.zip
cmd/swarm: speed up tests (#17878)
These minor changes already shaved off around 30s.
Diffstat (limited to 'cmd/swarm/access_test.go')
-rw-r--r--cmd/swarm/access_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/cmd/swarm/access_test.go b/cmd/swarm/access_test.go
index 106e6dd91..b4d2e1dbc 100644
--- a/cmd/swarm/access_test.go
+++ b/cmd/swarm/access_test.go
@@ -54,9 +54,8 @@ var DefaultCurve = crypto.S256()
// is then fetched through 2nd node. since the tested code is not key-aware - we can just
// fetch from the 2nd node using HTTP BasicAuth
func TestAccessPassword(t *testing.T) {
- cluster := newTestCluster(t, 1)
- defer cluster.Shutdown()
- proxyNode := cluster.Nodes[0]
+ srv := testutil.NewTestSwarmServer(t, serverFunc, nil)
+ defer srv.Close()
dataFilename := testutil.TempFileWithContent(t, data)
defer os.RemoveAll(dataFilename)
@@ -64,7 +63,7 @@ func TestAccessPassword(t *testing.T) {
// upload the file with 'swarm up' and expect a hash
up := runSwarm(t,
"--bzzapi",
- proxyNode.URL, //it doesn't matter through which node we upload content
+ srv.URL, //it doesn't matter through which node we upload content
"up",
"--encrypt",
dataFilename)
@@ -138,7 +137,7 @@ func TestAccessPassword(t *testing.T) {
if a.Publisher != "" {
t.Fatal("should be empty")
}
- client := swarm.NewClient(cluster.Nodes[0].URL)
+ client := swarm.NewClient(srv.URL)
hash, err := client.UploadManifest(&m, false)
if err != nil {
@@ -147,7 +146,7 @@ func TestAccessPassword(t *testing.T) {
httpClient := &http.Client{}
- url := cluster.Nodes[0].URL + "/" + "bzz:/" + hash
+ url := srv.URL + "/" + "bzz:/" + hash
response, err := httpClient.Get(url)
if err != nil {
t.Fatal(err)
@@ -189,7 +188,7 @@ func TestAccessPassword(t *testing.T) {
//download file with 'swarm down' with wrong password
up = runSwarm(t,
"--bzzapi",
- proxyNode.URL,
+ srv.URL,
"down",
"bzz:/"+hash,
tmp,