#!/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 ' # For now launching ipfs daemon externally, later will # get this working automatically through tests test_expect_success "launch ipfs daemon" ' pre_IPFS_PATH=$IPFS_PATH && IPFS_PATH="../.test_ipfs" && ipfs init && ipfs daemon & IPFS_D_PID=$! && sleep 3 && echo $IPFS_D_PID >../.test_ipfs/dPID.txt && IPFS_PATH=$pre_IPFS_PATH ' test_expect_success "test config folder exists" ' [ -d ../.test_config ] ' 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 & CLUSTER_SERVICE_PID=$! && echo $CLUSTER_SERVICE_PID >../.test_config/sPID.txt && sleep 3 && egrep -i "ready" service_start.txt >/dev/null && rm service_start.txt ' #test_expect_success "ipfs daemon launch and tear down" ' # ipfs daemon >daemon_out.txt 2>daemon_err & # IPFS_PID=$! # sleep 2 && # if ! kill -0 $IPFS_PID; then cat daemon_err; return 1; fi #' #test_expect_success "ipfs daemon launced successfully" ' # return 1 && # ipfs daemon >daemon_out.txt 2>daemon_err & # sleep 5 && # egrep -i "Initializing daemon" daemon_out.txt >/dev/null && # egrep -i "API server listening" daemon_out.txt >/dev/null && # egrep -i "Daemon is ready" daemon_out.txt > /dev/null #' test_done