@@ -114,40 +114,47 @@ func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int)
114
114
115
115
wg .Add (len (nodes ))
116
116
zero .Add (1 )
117
+ errs := make (chan error , len (nodes ))
117
118
118
119
for i , nd := range nodes {
119
120
go func (i int , nd testbedi.Core ) {
120
121
defer wg .Done ()
121
122
122
123
if _ , err := nd .Init (ctx , "--empty-repo" ); err != nil {
123
- panic (err )
124
+ errs <- err
125
+ return
124
126
}
125
127
126
128
if _ , err := nd .RunCmd (ctx , nil , "ipfs" , "config" , "--json" , "Experimental.FilestoreEnabled" , "true" ); err != nil {
127
- panic (err )
129
+ errs <- err
130
+ return
128
131
}
129
132
130
133
if _ , err := nd .Start (ctx , true , "--enable-pubsub-experiment" , "--offline=" + strconv .FormatBool (n == 1 )); err != nil {
131
- panic (err )
134
+ errs <- err
135
+ return
132
136
}
133
137
134
138
if i > 0 {
135
139
zero .Wait ()
136
140
if err := nd .Connect (ctx , nodes [0 ]); err != nil {
137
- panic (err )
141
+ errs <- err
142
+ return
138
143
}
139
144
} else {
140
145
zero .Done ()
141
146
}
142
147
143
148
addr , err := nd .APIAddr ()
144
149
if err != nil {
145
- panic (err )
150
+ errs <- err
151
+ return
146
152
}
147
153
148
154
maddr , err := ma .NewMultiaddr (addr )
149
155
if err != nil {
150
- panic (err )
156
+ errs <- err
157
+ return
151
158
}
152
159
153
160
c := & gohttp.Client {
@@ -159,16 +166,19 @@ func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int)
159
166
}
160
167
apis [i ], err = NewApiWithClient (maddr , c )
161
168
if err != nil {
162
- panic (err )
169
+ errs <- err
170
+ return
163
171
}
164
172
165
173
// empty node is pinned even with --empty-repo, we don't want that
166
174
emptyNode , err := iface .ParsePath ("/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn" )
167
175
if err != nil {
168
- panic (err )
176
+ errs <- err
177
+ return
169
178
}
170
179
if err := apis [i ].Pin ().Rm (ctx , emptyNode ); err != nil {
171
- panic (err )
180
+ errs <- err
181
+ return
172
182
}
173
183
}(i , nd )
174
184
}
@@ -187,7 +197,12 @@ func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int)
187
197
}()
188
198
}()
189
199
190
- return apis , nil
200
+ select {
201
+ case err = <- errs :
202
+ default :
203
+ }
204
+
205
+ return apis , err
191
206
}
192
207
193
208
func TestHttpApi (t * testing.T ) {
0 commit comments