@@ -26,6 +26,7 @@ import (
2626
2727 "github.com/ethereum/go-ethereum/swarm/api"
2828 swarm "github.com/ethereum/go-ethereum/swarm/api/client"
29+ "github.com/ethereum/go-ethereum/swarm/testutil"
2930)
3031
3132// TestManifestChange tests manifest add, update and remove
@@ -57,8 +58,8 @@ func TestManifestChangeEncrypted(t *testing.T) {
5758// Argument encrypt controls whether to use encryption or not.
5859func testManifestChange (t * testing.T , encrypt bool ) {
5960 t .Parallel ()
60- cluster := newTestCluster (t , 1 )
61- defer cluster . Shutdown ()
61+ srv := testutil . NewTestSwarmServer (t , serverFunc , nil )
62+ defer srv . Close ()
6263
6364 tmp , err := ioutil .TempDir ("" , "swarm-manifest-test" )
6465 if err != nil {
@@ -94,7 +95,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
9495
9596 args := []string {
9697 "--bzzapi" ,
97- cluster . Nodes [ 0 ] .URL ,
98+ srv .URL ,
9899 "--recursive" ,
99100 "--defaultpath" ,
100101 indexDataFilename ,
@@ -109,7 +110,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
109110
110111 checkHashLength (t , origManifestHash , encrypt )
111112
112- client := swarm .NewClient (cluster . Nodes [ 0 ] .URL )
113+ client := swarm .NewClient (srv .URL )
113114
114115 // upload a new file and use its manifest to add it the original manifest.
115116 t .Run ("add" , func (t * testing.T ) {
@@ -122,14 +123,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
122123
123124 humansManifestHash := runSwarmExpectHash (t ,
124125 "--bzzapi" ,
125- cluster . Nodes [ 0 ] .URL ,
126+ srv .URL ,
126127 "up" ,
127128 humansDataFilename ,
128129 )
129130
130131 newManifestHash := runSwarmExpectHash (t ,
131132 "--bzzapi" ,
132- cluster . Nodes [ 0 ] .URL ,
133+ srv .URL ,
133134 "manifest" ,
134135 "add" ,
135136 origManifestHash ,
@@ -177,14 +178,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
177178
178179 robotsManifestHash := runSwarmExpectHash (t ,
179180 "--bzzapi" ,
180- cluster . Nodes [ 0 ] .URL ,
181+ srv .URL ,
181182 "up" ,
182183 robotsDataFilename ,
183184 )
184185
185186 newManifestHash := runSwarmExpectHash (t ,
186187 "--bzzapi" ,
187- cluster . Nodes [ 0 ] .URL ,
188+ srv .URL ,
188189 "manifest" ,
189190 "add" ,
190191 origManifestHash ,
@@ -237,14 +238,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
237238
238239 indexManifestHash := runSwarmExpectHash (t ,
239240 "--bzzapi" ,
240- cluster . Nodes [ 0 ] .URL ,
241+ srv .URL ,
241242 "up" ,
242243 indexDataFilename ,
243244 )
244245
245246 newManifestHash := runSwarmExpectHash (t ,
246247 "--bzzapi" ,
247- cluster . Nodes [ 0 ] .URL ,
248+ srv .URL ,
248249 "manifest" ,
249250 "update" ,
250251 origManifestHash ,
@@ -295,14 +296,14 @@ func testManifestChange(t *testing.T, encrypt bool) {
295296
296297 humansManifestHash := runSwarmExpectHash (t ,
297298 "--bzzapi" ,
298- cluster . Nodes [ 0 ] .URL ,
299+ srv .URL ,
299300 "up" ,
300301 robotsDataFilename ,
301302 )
302303
303304 newManifestHash := runSwarmExpectHash (t ,
304305 "--bzzapi" ,
305- cluster . Nodes [ 0 ] .URL ,
306+ srv .URL ,
306307 "manifest" ,
307308 "update" ,
308309 origManifestHash ,
@@ -348,7 +349,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
348349 t .Run ("remove" , func (t * testing.T ) {
349350 newManifestHash := runSwarmExpectHash (t ,
350351 "--bzzapi" ,
351- cluster . Nodes [ 0 ] .URL ,
352+ srv .URL ,
352353 "manifest" ,
353354 "remove" ,
354355 origManifestHash ,
@@ -376,7 +377,7 @@ func testManifestChange(t *testing.T, encrypt bool) {
376377 t .Run ("remove nested" , func (t * testing.T ) {
377378 newManifestHash := runSwarmExpectHash (t ,
378379 "--bzzapi" ,
379- cluster . Nodes [ 0 ] .URL ,
380+ srv .URL ,
380381 "manifest" ,
381382 "remove" ,
382383 origManifestHash ,
@@ -429,8 +430,8 @@ func TestNestedDefaultEntryUpdateEncrypted(t *testing.T) {
429430
430431func testNestedDefaultEntryUpdate (t * testing.T , encrypt bool ) {
431432 t .Parallel ()
432- cluster := newTestCluster (t , 1 )
433- defer cluster . Shutdown ()
433+ srv := testutil . NewTestSwarmServer (t , serverFunc , nil )
434+ defer srv . Close ()
434435
435436 tmp , err := ioutil .TempDir ("" , "swarm-manifest-test" )
436437 if err != nil {
@@ -458,7 +459,7 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
458459
459460 args := []string {
460461 "--bzzapi" ,
461- cluster . Nodes [ 0 ] .URL ,
462+ srv .URL ,
462463 "--recursive" ,
463464 "--defaultpath" ,
464465 indexDataFilename ,
@@ -473,7 +474,7 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
473474
474475 checkHashLength (t , origManifestHash , encrypt )
475476
476- client := swarm .NewClient (cluster . Nodes [ 0 ] .URL )
477+ client := swarm .NewClient (srv .URL )
477478
478479 newIndexData := []byte ("<h1>Ethereum Swarm</h1>" )
479480 newIndexDataFilename := filepath .Join (tmp , "index.html" )
@@ -484,14 +485,14 @@ func testNestedDefaultEntryUpdate(t *testing.T, encrypt bool) {
484485
485486 newIndexManifestHash := runSwarmExpectHash (t ,
486487 "--bzzapi" ,
487- cluster . Nodes [ 0 ] .URL ,
488+ srv .URL ,
488489 "up" ,
489490 newIndexDataFilename ,
490491 )
491492
492493 newManifestHash := runSwarmExpectHash (t ,
493494 "--bzzapi" ,
494- cluster . Nodes [ 0 ] .URL ,
495+ srv .URL ,
495496 "manifest" ,
496497 "update" ,
497498 origManifestHash ,
0 commit comments