aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/manifest_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/swarm/manifest_test.go')
-rw-r--r--cmd/swarm/manifest_test.go41
1 files changed, 21 insertions, 20 deletions
diff --git a/cmd/swarm/manifest_test.go b/cmd/swarm/manifest_test.go
index 9c7808dfa..7ea4e0c45 100644
--- a/cmd/swarm/manifest_test.go
+++ b/cmd/swarm/manifest_test.go
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/swarm/api"
swarm "github.com/ethereum/go-ethereum/swarm/api/client"
+ "github.com/ethereum/go-ethereum/swarm/testutil"
)
// TestManifestChange tests manifest add, update and remove
@@ -57,8 +58,8 @@ func TestManifestChangeEncrypted(t *testing.T) {
// Argument encrypt controls whether to use encryption or not.
func testManifestChange(t *testing.T, encrypt bool) {
t.Parallel()
- cluster := newTestCluster(t, 1)
- defer cluster.Shutdown()
+ srv := testutil.NewTestSwarmServer(t, serverFunc, nil)
+ defer srv.Close()
tmp, err := ioutil.TempDir("", "swarm-manifest-test")
if err != nil {
@@ -94,7 +95,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
args := []string{
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"--recursive",
"--defaultpath",
indexDataFilename,
@@ -109,7 +110,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
checkHashLength(t, origManifestHash, encrypt)
- client := swarm.NewClient(cluster.Nodes[0].URL)
+ client := swarm.NewClient(srv.URL)
// upload a new file and use its manifest to add it the original manifest.
t.Run("add", func(t *testing.T) {
@@ -122,14 +123,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
humansManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"up",
humansDataFilename,
)
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"add",
origManifestHash,
@@ -177,14 +178,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
robotsManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"up",
robotsDataFilename,
)
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"add",
origManifestHash,
@@ -237,14 +238,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
indexManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"up",
indexDataFilename,
)
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"update",
origManifestHash,
@@ -295,14 +296,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
humansManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"up",
robotsDataFilename,
)
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"update",
origManifestHash,
@@ -348,7 +349,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
t.Run("remove", func(t *testing.T) {
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"remove",
origManifestHash,
@@ -376,7 +377,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
t.Run("remove nested", func(t *testing.T) {
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"remove",
origManifestHash,
@@ -429,8 +430,8 @@ func TestNestedDefaultEntryUpdateEncrypted(t *testing.T) {
func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
t.Parallel()
- cluster := newTestCluster(t, 1)
- defer cluster.Shutdown()
+ srv := testutil.NewTestSwarmServer(t, serverFunc, nil)
+ defer srv.Close()
tmp, err := ioutil.TempDir("", "swarm-manifest-test")
if err != nil {
@@ -458,7 +459,7 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
args := []string{
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"--recursive",
"--defaultpath",
indexDataFilename,
@@ -473,7 +474,7 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
checkHashLength(t, origManifestHash, encrypt)
- client := swarm.NewClient(cluster.Nodes[0].URL)
+ client := swarm.NewClient(srv.URL)
newIndexData := []byte("<h1>Ethereum Swarm</h1>")
newIndexDataFilename := filepath.Join(tmp, "index.html")
@@ -484,14 +485,14 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
newIndexManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"up",
newIndexDataFilename,
)
newManifestHash := runSwarmExpectHash(t,
"--bzzapi",
- cluster.Nodes[0].URL,
+ srv.URL,
"manifest",
"update",
origManifestHash,