added sharness/t0061-daemon-opts
Test odd daemon options, like: - unrestricted-api - disable-transport-encryption (known breakage atm) License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
Juan Batiz-Benet committed
Jun 19, 2015 at 05:53 UTC
f300e97c508640d40917d07b2d70f6e8754394bd
3 files changed
+46
-1
test/sharness/lib/test-lib.sh
+3
-1
@@ -193,8 +193,10 @@ test_config_ipfs_gateway_writable() {
193
194
test_launch_ipfs_daemon() {
195
196
+ args=$1
197
+
198
test_expect_success "'ipfs daemon' succeeds" '
197
- ipfs daemon >actual_daemon 2>daemon_err &
199
+ ipfs daemon $args >actual_daemon 2>daemon_err &
200
'
201
202
# we say the daemon is ready when the API server is ready.
test/sharness/t0061-daemon-opts.sh
new
+39
@@ -0,0 +1,39 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2014 Juan Batiz-Benet
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+
7
+test_description="Test daemon command"
8
+
9
+. lib/test-lib.sh
10
+
11
+
12
+test_init_ipfs
13
+
14
+test_launch_ipfs_daemon '--unrestricted-api --disable-transport-encryption'
15
+
16
+gwyport=$PORT_GWAY
17
+apiport=$PORT_API
18
+
19
+test_expect_success 'api gateway should be unrestricted' '
20
+ echo "hello mars :$gwyport :$apiport" >expected &&
21
+ HASH=$(ipfs add -q expected) &&
22
+ curl -sfo actual1 "http://127.0.0.1:$gwyport/ipfs/$HASH" &&
23
+ curl -sfo actual2 "http://127.0.0.1:$apiport/ipfs/$HASH" &&
24
+ test_cmp expected actual1 &&
25
+ test_cmp expected actual2
26
+'
27
+
28
+# Odd. this fails here, but the inverse works on t0060-daemon.
29
+test_expect_failure 'transport should be unencrypted' '
30
+ nc 127.0.0.1 "$PORT_SWARM" >swarmnc &
31
+ go-sleep 0.1s &&
32
+ ! grep -q "AES-256,AES-128" swarmnc &&
33
+ grep -q "/ipfs/identify" swarmnc ||
34
+ test_fsh cat swarmnc
35
+'
36
+
37
+test_kill_ipfs_daemon
38
+
39
+test_done
test/sharness/t0110-gateway.sh
+4
@@ -33,6 +33,10 @@ test_expect_success "GET IPFS path output looks good" '
33
rm actual
34
'
35
36
+test_expect_success "GET IPFS path on API forbidden" '
37
+ test_curl_resp_http_code "http://127.0.0.1:$apiport/ipfs/$HASH" "HTTP/1.1 403 Forbidden"
38
+'
39
+
40
test_expect_success "GET IPFS directory path succeeds" '
41
mkdir dir &&
42
echo "12345" >dir/test &&