2017-04-18 22:22:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# MIT LICENSED
|
|
|
|
#
|
|
|
|
test_description="Test service startup and init functionality"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success "ipfs is installed on this machine" '
|
|
|
|
ipfs help >ipfs_help.txt &&
|
|
|
|
egrep -i "^Usage" ipfs_help.txt >/dev/null
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success "launch ipfs daemon" '
|
2017-04-20 18:55:54 +00:00
|
|
|
mkdir -p ../.test_ipfs &&
|
|
|
|
IPFS_PATH="../.test_ipfs" eval '"'"'ipfs init'"'"' &&
|
|
|
|
IPFS_PATH="../.test_ipfs" eval '"'"'ipfs daemon & echo $! >../dPID.txt'"'"' &&
|
|
|
|
sleep 3
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success "test config folder exists" '
|
2017-04-20 18:55:54 +00:00
|
|
|
mkdir -p ../.test_config
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success "init cluster-service" '
|
|
|
|
ipfs-cluster-service -f --config ../.test_config init 2>service_init.txt &&
|
|
|
|
grep "configuration written" service_init.txt >/dev/null &&
|
|
|
|
rm service_init.txt
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success "run cluster-service" '
|
|
|
|
ipfs-cluster-service --config ../.test_config 2>service_start.txt &
|
2017-04-20 17:28:09 +00:00
|
|
|
echo $!>../sPID.txt &&
|
2017-04-18 22:22:05 +00:00
|
|
|
sleep 3 &&
|
|
|
|
egrep -i "ready" service_start.txt >/dev/null &&
|
|
|
|
rm service_start.txt
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|