mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
t0110: cleanup using expr
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
@ -66,24 +66,20 @@ test_expect_success "GET invalid path errors" '
|
|||||||
test_must_fail wget http://127.0.0.1:$port/12345
|
test_must_fail wget http://127.0.0.1:$port/12345
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
||||||
test_expect_success "GET /webui returns code expected" '
|
test_expect_success "GET /webui returns code expected" '
|
||||||
echo "HTTP/1.1 302 Found" | head -c 18 > expected &&
|
curl -I http://127.0.0.1:$apiport/webui >actual &&
|
||||||
echo "HTTP/1.1 301 Moved Permanently" | head -c 18 > also_ok &&
|
RESP=$(head -1 actual) &&
|
||||||
curl -I http://127.0.0.1:$apiport/webui | head -c 18 > actual1 &&
|
(expr "$RESP" : "HTTP/1.1 302 Found\s" ||
|
||||||
(test_cmp expected actual1 || test_cmp actual1 also_ok) &&
|
expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
|
||||||
rm actual1
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "GET /webui/ returns code expected" '
|
test_expect_success "GET /webui/ returns code expected" '
|
||||||
curl -I http://127.0.0.1:$apiport/webui/ | head -c 18 > actual2 &&
|
curl -I http://127.0.0.1:$apiport/webui/ > actual &&
|
||||||
(test_cmp expected actual2 || test_cmp actual2 also_ok) &&
|
RESP=$(head -1 actual) &&
|
||||||
rm expected &&
|
(expr "$RESP" : "HTTP/1.1 302 Found\s" ||
|
||||||
rm also_ok &&
|
expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s")
|
||||||
rm actual2
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
||||||
test_kill_ipfs_daemon
|
test_kill_ipfs_daemon
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user