Skip to content

Commit 183a42f

Browse files
Voker57magik6k
authored andcommitted
Add tests for FetchBlocks gateway option
License: MIT Signed-off-by: Iaroslav Gridin <[email protected]>
1 parent 4b02a6f commit 183a42f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/sharness/t0110-gateway.sh

+32
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,36 @@ test_expect_success "GET compact blocks succeeds" '
215215

216216
test_kill_ipfs_daemon
217217

218+
219+
GWPORT=32563
220+
221+
test_expect_success "set up iptb testbed" '
222+
iptb init -n 2 -p 0 -f --bootstrap=none &&
223+
iptb run 0 ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/$GWPORT
224+
'
225+
226+
test_expect_success "set NoFetch to true in config of node 0" '
227+
iptb run 0 ipfs config --bool=true Gateway.NoFetch true
228+
'
229+
230+
test_expect_success "start ipfs nodes" '
231+
iptb start &&
232+
iptb connect 0 1
233+
'
234+
235+
test_expect_success "try fetching not present key from node 0" '
236+
echo "hi" | iptb run 1 ipfs add -Q > hi.hash &&
237+
test_expect_code 22 curl -f "http://127.0.0.1:$GWPORT/ipfs/$(cat hi.hash)"
238+
'
239+
240+
test_expect_success "try fetching present key from from node 0" '
241+
echo "hi" | iptb run 0 ipfs add -Q > hi.hash &&
242+
PORT1=$(ipfs config Addresses.Gateway | cut -d/ -f 5) &&
243+
curl -f "http://127.0.0.1:$GWPORT/ipfs/$(cat hi.hash)"
244+
'
245+
246+
test_expect_success "stop testbed" '
247+
iptb stop
248+
'
249+
218250
test_done

0 commit comments

Comments
 (0)