Commit b2da2754 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

sharness/lib: fix daemon startup check

Go back to test_run_repeat_10_sec to make sure the API
is there. I think this is also clearer on the reader.
parent 16c1390e
...@@ -142,10 +142,10 @@ test_init_ipfs() { ...@@ -142,10 +142,10 @@ test_init_ipfs() {
} }
test_config_ipfs_gateway_readonly() { test_config_ipfs_gateway_readonly() {
GWAY_ADDR=$1 ADDR_GWAY=$1
test_expect_success "prepare config -- gateway address" ' test_expect_success "prepare config -- gateway address" '
test "$GWAY_ADDR" != "" && test "$ADDR_GWAY" != "" &&
test_config_set "Addresses.Gateway" "$GWAY_ADDR" test_config_set "Addresses.Gateway" "$ADDR_GWAY"
' '
# tell the user what's going on if they messed up the call. # tell the user what's going on if they messed up the call.
...@@ -168,38 +168,22 @@ test_config_ipfs_gateway_writable() { ...@@ -168,38 +168,22 @@ test_config_ipfs_gateway_writable() {
test_launch_ipfs_daemon() { test_launch_ipfs_daemon() {
ADDR_API="/ip4/127.0.0.1/tcp/5001"
NLINES="2"
# ADDR_GWAY will be set if the test_config_ipfs_gateway_* funcs were called.
if test "$ADDR_GWAY" != ""; then
NLINES="3"
fi
test_expect_success "'ipfs daemon' succeeds" ' test_expect_success "'ipfs daemon' succeeds" '
ipfs daemon >actual_daemon 2>daemon_err & ipfs daemon >actual_daemon 2>daemon_err &
' '
# we say the daemon is ready when the API server is ready. # we say the daemon is ready when the API server is ready.
# and we make sure there are no errors ADDR_API="/ip4/127.0.0.1/tcp/5001"
test_expect_success "'ipfs daemon' is ready" ' test_expect_success "'ipfs daemon' is ready" '
IPFS_PID=$! && IPFS_PID=$! &&
test_wait_output_n_lines_60_sec actual_daemon $NLINES || test_wait_output_n_lines_60_sec actual_daemon 2 &&
test_run_repeat_10_sec "cat actual_daemon | grep \"API server listening on $ADDR_API\"" ||
fsh cat actual_daemon || fsh cat daemon_err fsh cat actual_daemon || fsh cat daemon_err
' '
test_expect_success "'ipfs daemon' output includes API address" '
cat actual_daemon | grep "API server listening on $ADDR_API" ||
fsh cat actual_daemon ||
fsh "cat actual_daemon | grep \"API server listening on $ADDR_API\"" ||
fsh cat daemon_err
'
if test "$ADDR_GWAY" != ""; then if test "$ADDR_GWAY" != ""; then
test_expect_success "'ipfs daemon' output includes Gateway address" ' test_expect_success "'ipfs daemon' output includes Gateway address" '
cat actual_daemon | grep "Gateway server listening on $ADDR_GWAY" || test_run_repeat_10_sec "cat actual_daemon | grep \"Gateway server listening on $ADDR_GWAY\"" ||
fsh cat actual_daemon ||
fsh "cat actual_daemon | grep \"Gateway server listening on $ADDR_GWAY\"" ||
fsh cat daemon_err fsh cat daemon_err
' '
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment