Create shanress test for offline mode node License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Create shanress test for offline mode node License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
May 15, 2016 at 14:59 UTC
7614f4f700ab550075c30f61982371d01958bd7b
2 files changed
+19
-5
test/sharness/lib/test-lib.sh
+6
-5
@@ -194,12 +194,13 @@ test_set_address_vars() {
194
GWAY_PORT=$(port_from_maddr $GWAY_MADDR)
195
'
196
197
-
198
- test_expect_success "set swarm address vars" '
197
+ if ipfs swarm addrs local; then
198
+ test_expect_success "set swarm address vars" '
199
ipfs swarm addrs local > addrs_out &&
200
- SWARM_MADDR=$(grep "127.0.0.1" addrs_out) &&
201
- SWARM_PORT=$(port_from_maddr $SWARM_MADDR)
202
- '
200
+ SWARM_MADDR=$(grep "127.0.0.1" addrs_out) &&
201
+ SWARM_PORT=$(port_from_maddr $SWARM_MADDR)
202
+ '
203
+ fi
204
}
205
206
test_launch_ipfs_daemon() {
test/sharness/t0061-daemon-opts.sh
+13
@@ -35,4 +35,17 @@ test_expect_success 'transport should be unencrypted' '
35
36
test_kill_ipfs_daemon
37
38
+test_launch_ipfs_daemon --offline
39
+
40
+gwyaddr=$GWAY_ADDR
41
+apiaddr=$API_ADDR
42
+
43
+test_expect_success 'gateway should work in offline mode' '
44
+ echo "hello mars :$gwyaddr :$apiaddr" >expected &&
45
+ HASH=$(ipfs add -q expected) &&
46
+ curl -sfo actual1 "http://$gwyaddr/ipfs/$HASH" &&
47
+ test_cmp expected actual1
48
+'
49
+
50
+test_kill_ipfs_daemon
51
test_done