ipfs-cluster/sharness/t0020-service-basic-commands.sh
Wyatt ad492d20ae fix #254, execution locking:
ipfs-cluster-service now locks before running the daemon and state
upgrade commands.  Locking mechanism heavily inspired by ipfs, see
go-ipfs fsrepo.  Unlock called on exit to free up repo.  one lockfile
per repo. A very simple sharness test checks that two service
invocations cannot occur.

A longstanding sharness/ci logging issue is addressed by exporting
verbose=t into the travis environment.  Now output of commands from
within sharness test strings are displayed during travis runs.

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
2017-12-06 11:14:53 -05:00

35 lines
955 B
Bash
Executable File

#!/bin/bash
test_description="Test service startup and init functionality"
. lib/test-lib.sh
test_ipfs_init
cleanup test_clean_ipfs
test_cluster_init
cleanup test_clean_cluster
test_expect_success "prerequisites" '
test_have_prereq IPFS &&
test_have_prereq CLUSTER
'
test_expect_success JQ "ipfs cluster config valid" '
test_cluster_config
'
test_expect_success "custer-service help output looks good" '
ipfs-cluster-service --help | egrep -q -i "^(Usage|Commands|Description|Global Options)"
'
test_expect_success "cluster-service --version succeeds and matches ctl" '
export SERV_VERSION=`ipfs-cluster-service --version | grep -Po "\d+\.\d+\.\d+"`
export CTL_VERSION=`ipfs-cluster-ctl --version | grep -Po "\d+\.\d+\.\d+"`
[ "$SERV_VERSION" = "$CTL_VERSION" ]
'
test_expect_success "starting a second cluster-service process fails" '
test_expect_code 1 ipfs-cluster-service --config "test-config"
'
test_done