ipfs-cluster/sharness/t0050-service-state-upgrade-from-current.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

32 lines
871 B
Bash
Executable File

#!/bin/bash
test_description="Test service state 'upgrade' from current version"
. lib/test-lib.sh
test_ipfs_init
cleanup test_clean_ipfs
test_cluster_init
cleanup test_clean_cluster
test_expect_success IPFS,CLUSTER "cluster-service state upgrade works" '
cid=`docker exec ipfs sh -c "echo testing | ipfs add -q"` &&
ipfs-cluster-ctl pin add "$cid" &&
sleep 5 &&
cluster_kill &&
sleep 5 &&
ipfs-cluster-service --debug --config "test-config" state upgrade
'
# previous test kills the cluster, we need to re-start
# if done inside the test, we lose debugging output
cluster_start
test_expect_success IPFS,CLUSTER "state is preserved after migration" '
cid=`docker exec ipfs sh -c "echo testing | ipfs add -q"` &&
ipfs-cluster-ctl pin ls "$cid" | grep -q "$cid" &&
ipfs-cluster-ctl status "$cid" | grep -q -i "PINNED"
'
test_done