@cryptotaxi247 / kubo / commits / fea7b5da7

gateway: NoFetch ipns test

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Jan 4, 2019 at 15:50 UTC fea7b5da79287f243f004706d629e6bb552f2c35
1 file changed +17 -7
test/sharness/t0110-gateway.sh
+17 -7
@@ -219,8 +219,9 @@ test_kill_ipfs_daemon
219 GWPORT=32563
220
221 test_expect_success "set up iptb testbed" '
222 - iptb testbed create -type localipfs -count 2 -force -init &&
223 - ipfsi 0 config Addresses.Gateway /ip4/127.0.0.1/tcp/$GWPORT
222 + iptb testbed create -type localipfs -count 5 -force -init &&
223 + ipfsi 0 config Addresses.Gateway /ip4/127.0.0.1/tcp/$GWPORT &&
224 + PEERID_1=$(iptb attr get 1 id)
225 '
226
227 test_expect_success "set NoFetch to true in config of node 0" '
@@ -233,14 +234,23 @@ test_expect_success "start ipfs nodes" '
234 '
235
236 test_expect_success "try fetching not present key from node 0" '
236 - echo "foo" | ipfsi 1 add -Q > foo.hash &&
237 - test_expect_code 22 curl -f "http://127.0.0.1:$GWPORT/ipfs/$(cat foo.hash)"
237 + FOO=$(echo "foo" | ipfsi 1 add -Q) &&
238 + test_expect_code 22 curl -f "http://127.0.0.1:$GWPORT/ipfs/$FOO"
239 +'
240 +
241 +test_expect_success "try fetching not present ipns key from node 0" '
242 + ipfsi 1 name publish /ipfs/$FOO &&
243 + test_expect_code 22 curl -f "http://127.0.0.1:$GWPORT/ipns/$PEERID_1"
244 '
245
246 test_expect_success "try fetching present key from from node 0" '
241 - echo "bar" | ipfsi 0 add -Q > bar.hash &&
242 - PORT1=$(ipfs config Addresses.Gateway | cut -d/ -f 5) &&
243 - curl -f "http://127.0.0.1:$GWPORT/ipfs/$(cat bar.hash)"
247 + BAR=$(ipfsi 0 add -Q > bar.hash) &&
248 + curl -f "http://127.0.0.1:$GWPORT/ipfs/$BAR"
249 +'
250 +
251 +test_expect_success "try fetching present ipns key from node 0" '
252 + ipfsi 1 name publish /ipfs/$BAR &&
253 + test_expect_code 22 curl -f "http://127.0.0.1:$GWPORT/ipns/$PEERID_1"
254 '
255
256 test_expect_success "stop testbed" '