ipfs-cluster/sharness/t0025-ctl-status-report-commands.sh
Wyatt 47b744f1c0 ipfs-cluster-service state upgrade cli command
ipfs-cluster-service now has a migration subcommand that upgrades
    persistant state snapshots with an out-of-date format version to the
    newest version of raft state. If all cluster members shutdown with
    consistent state, upgrade ipfs-cluster, and run the state upgrade command,
    the new version of cluster will be compatible with persistent storage.
    ipfs-cluster now validates its persistent state upon loading it and exits
    with a clear error in the case the state format version is not up to date.

    Raft snapshotting is enforced on all shutdowns and the json backup is no
    longer run.  This commit makes use of recent changes to libp2p-raft
    allowing raft states to implement their own marshaling strategies. Now
    mapstate handles the logic for its (de)serialization.  In the interest of
    supporting various potential upgrade formats the state serialization
    begins with a varint (right now one byte) describing the version.

    Some go tests are modified and a go test is added to cover new ipfs-cluster
    raft snapshot reading functions.  Sharness tests are added to cover the
    state upgrade command.
2017-11-28 22:35:48 -05:00

63 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
test_description="Test ctl's status reporting functionality. Test errors on incomplete commands"
. lib/test-lib.sh
test_ipfs_init
cleanup test_clean_ipfs
test_cluster_init
cleanup test_clean_cluster
test_expect_success IPFS,CLUSTER,JQ "cluster-ctl can read id" '
id=`cluster_id`
[ -n "$id" ] && ( ipfs-cluster-ctl id | egrep -q "$id" )
'
test_expect_success IPFS,CLUSTER "cluster-ctl list 0 peers" '
peer_length=`ipfs-cluster-ctl --enc=json peers ls | jq ". | length"`
[ $peer_length -eq 1 ]
'
test_expect_success IPFS,CLUSTER "cluster-ctl add need peer id" '
test_must_fail ipfs-cluster-ctl peers add
'
test_expect_success IPFS,CLUSTER "cluster-ctl add invalid peer id" '
test_must_fail ipfs-cluster-ctl peers add XXXinvalid-peerXXX
'
test_expect_success IPFS,CLUSTER "cluster-ctl rm needs peer id" '
test_must_fail ipfs-cluster-ctl peers rm
'
test_expect_success IPFS,CLUSTER "cluster-ctl rm invalid peer id" '
test_must_fail ipfs-cluster-ctl peers rm XXXinvalid-peerXXX
'
test_expect_success IPFS,CLUSTER "empty cluster-ctl status succeeds" '
ipfs-cluster-ctl status
'
test_expect_success IPFS,CLUSTER "invalid CID status" '
test_must_fail ipfs-cluster-ctl status XXXinvalid-CIDXXX
'
test_expect_success IPFS,CLUSTER "empty cluster-ctl sync succeeds" '
ipfs-cluster-ctl sync
'
test_expect_success IPFS,CLUSTER "empty cluster_ctl recover needs CID" '
test_must_fail ipfs-cluster-ctl recover
'
test_expect_success IPFS,CLUSTER "pin ls succeeds" '
ipfs-cluster-ctl pin ls
'
test_expect_success IPFS,CLUSTER "pin ls on invalid CID fails" '
test_must_fail ipfs-cluster-ctl pin ls XXXinvalid-CIDXXX
'
test_done