From b01e535115f2977921ad90fb0e52cebbc38dbff7 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Wed, 4 Mar 2015 21:02:32 +0100 Subject: [PATCH] t0110: cleanup using expr License: MIT Signed-off-by: Christian Couder --- test/sharness/t0110-gateway.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/sharness/t0110-gateway.sh b/test/sharness/t0110-gateway.sh index 923d0a9b4..f90dbe497 100755 --- a/test/sharness/t0110-gateway.sh +++ b/test/sharness/t0110-gateway.sh @@ -66,24 +66,20 @@ test_expect_success "GET invalid path errors" ' test_must_fail wget http://127.0.0.1:$port/12345 ' - test_expect_success "GET /webui returns code expected" ' - echo "HTTP/1.1 302 Found" | head -c 18 > expected && - echo "HTTP/1.1 301 Moved Permanently" | head -c 18 > also_ok && - curl -I http://127.0.0.1:$apiport/webui | head -c 18 > actual1 && - (test_cmp expected actual1 || test_cmp actual1 also_ok) && - rm actual1 + curl -I http://127.0.0.1:$apiport/webui >actual && + RESP=$(head -1 actual) && + (expr "$RESP" : "HTTP/1.1 302 Found\s" || + expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s") ' test_expect_success "GET /webui/ returns code expected" ' - curl -I http://127.0.0.1:$apiport/webui/ | head -c 18 > actual2 && - (test_cmp expected actual2 || test_cmp actual2 also_ok) && - rm expected && - rm also_ok && - rm actual2 + curl -I http://127.0.0.1:$apiport/webui/ > actual && + RESP=$(head -1 actual) && + (expr "$RESP" : "HTTP/1.1 302 Found\s" || + expr "$RESP" : "HTTP/1.1 301 Moved Permanently\s") ' - test_kill_ipfs_daemon test_done