t0062-daemon-api.sh tabs
License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
Juan Batiz-Benet committed
Aug 29, 2015 at 06:13 UTC
8c547ff7b856caab71eefd20e7d949b9b76f8fc3
1 file changed
+30
-30
test/sharness/t0062-daemon-api.sh
+30
-30
@@ -16,32 +16,32 @@ api_fromcfg=$(ipfs config Addresses.API)
16
peerid=$(ipfs config Identity.PeerID)
17
18
test_client() {
19
- args="$@"
20
- printf $peerid >expected
21
- ipfs $args id -f="<id>" >actual
22
- test_cmp expected actual
19
+ args="$@"
20
+ printf $peerid >expected
21
+ ipfs $args id -f="<id>" >actual
22
+ test_cmp expected actual
23
}
24
25
test_client_must_fail() {
26
- args="$@"
27
- echo "Error: api not running" >expected_err
28
- test_must_fail ipfs $args id -f="<id>" >actual 2>actual_err
29
- test_cmp expected_err actual_err
26
+ args="$@"
27
+ echo "Error: api not running" >expected_err
28
+ test_must_fail ipfs $args id -f="<id>" >actual 2>actual_err
29
+ test_cmp expected_err actual_err
30
}
31
32
33
# first, test things without daemon, without /api file
34
35
test_expect_success "client should work (daemon off, no /api file, no --api)" '
36
- test_client
36
+ test_client
37
'
38
39
test_expect_success "client --api fromcfg should err (daemon off, no /api file)" '
40
- test_client_must_fail --api "$api_fromcfg"
40
+ test_client_must_fail --api "$api_fromcfg"
41
'
42
43
test_expect_success "client --api unreachable should err (daemon off, no /api file)" '
44
- test_client_must_fail --api "$api_unreachable"
44
+ test_client_must_fail --api "$api_unreachable"
45
'
46
47
# then, test things with daemon, with /api file
@@ -49,24 +49,24 @@ test_expect_success "client --api unreachable should err (daemon off, no /api fi
49
test_launch_ipfs_daemon
50
51
test_expect_success "'ipfs daemon' creates api file" '
52
- test -f ".ipfs/api"
52
+ test -f ".ipfs/api"
53
'
54
55
test_expect_success "api file looks good" '
56
- printf "$ADDR_API" >expected &&
57
- test_cmp expected .ipfs/api
56
+ printf "$ADDR_API" >expected &&
57
+ test_cmp expected .ipfs/api
58
'
59
60
test_expect_success "client should work (daemon on, /api file, no --api)" '
61
- test_client
61
+ test_client
62
'
63
64
test_expect_success "client --api fromcfg should work (daemon used cfg) (daemon, /api file)" '
65
- test_client --api "$api_fromcfg"
65
+ test_client --api "$api_fromcfg"
66
'
67
68
test_expect_success "client --api unreachable should err (daemon, /api file)" '
69
- test_client_must_fail --api "$api_unreachable"
69
+ test_client_must_fail --api "$api_unreachable"
70
'
71
72
# then, test things without daemon, with /api file
@@ -74,15 +74,15 @@ test_expect_success "client --api unreachable should err (daemon, /api file)" '
74
test_kill_ipfs_daemon
75
76
test_expect_success "client should work (daemon off, /api file, no --api)" '
77
- test_client
77
+ test_client
78
'
79
80
test_expect_success "client --api fromcfg should err (daemon off, /api file)" '
81
- test_client_must_fail --api "$api_fromcfg"
81
+ test_client_must_fail --api "$api_fromcfg"
82
'
83
84
test_expect_success "client --api unreachable should err (daemon, /api file)" '
85
- test_client_must_fail --api "$api_unreachable"
85
+ test_client_must_fail --api "$api_unreachable"
86
'
87
88
# then, test things with daemon --api $api_different, with /api file
@@ -93,24 +93,24 @@ ADDR_API=$api_different
93
test_launch_ipfs_daemon --api "$ADDR_API"
94
95
test_expect_success "'ipfs daemon' --api option works" '
96
- printf "$api_different" >expected &&
97
- test_cmp expected .ipfs/api
96
+ printf "$api_different" >expected &&
97
+ test_cmp expected .ipfs/api
98
'
99
100
test_expect_success "client should work (daemon on, /api file (different), no --api)" '
101
- test_client
101
+ test_client
102
'
103
104
test_expect_success "client --api different should work (daemon on, /api file (different))" '
105
- test_client --api "$api_different"
105
+ test_client --api "$api_different"
106
'
107
108
test_expect_success "client --api fromcfg should err (daemon on, /api file (different))" '
109
- test_client_must_fail --api "$api_fromcfg"
109
+ test_client_must_fail --api "$api_fromcfg"
110
'
111
112
test_expect_success "client --api unreachable should err (daemon, /api file)" '
113
- test_client_must_fail --api "$api_unreachable"
113
+ test_client_must_fail --api "$api_unreachable"
114
'
115
116
# then, test things with daemon off, with /api file, for good measure.
@@ -118,19 +118,19 @@ test_expect_success "client --api unreachable should err (daemon, /api file)" '
118
test_kill_ipfs_daemon
119
120
test_expect_success "client should work (daemon off, /api file (different), no --api)" '
121
- test_client
121
+ test_client
122
'
123
124
test_expect_success "client --api different should work (daemon on, /api file (different))" '
125
- test_client_must_fail --api "$api_different"
125
+ test_client_must_fail --api "$api_different"
126
'
127
128
test_expect_success "client --api fromcfg should err (daemon on, /api file (different))" '
129
- test_client_must_fail --api "$api_fromcfg"
129
+ test_client_must_fail --api "$api_fromcfg"
130
'
131
132
test_expect_success "client --api unreachable should err (daemon, /api file)" '
133
- test_client_must_fail --api "$api_unreachable"
133
+ test_client_must_fail --api "$api_unreachable"
134
'
135
136
test_done