2017-04-18 22:22:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description="Test ctl's status reporting functionality. Test errors on incomplete commands"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_ipfs_init
|
|
|
|
test_cluster_init
|
2017-04-18 22:22:05 +00:00
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER,JQ "cluster-ctl can read id" '
|
2017-05-02 23:34:06 +00:00
|
|
|
test_cluster_config &&
|
2017-05-02 20:32:42 +00:00
|
|
|
ipfs-cluster-ctl id | egrep -q -i "$CLUSTER_CONFIG_ID"
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "cluster-ctl list 0 peers" '
|
2017-05-02 20:32:42 +00:00
|
|
|
export PEER_OUT=`ipfs-cluster-ctl peers ls` &&
|
2017-05-04 22:33:12 +00:00
|
|
|
sorted_peer_out=$(printf "%s\n" $PEER_OUT | sort -u) &&
|
2017-05-02 20:32:42 +00:00
|
|
|
export SELF_OUT=`ipfs-cluster-ctl id` &&
|
2017-05-04 22:33:12 +00:00
|
|
|
sorted_self_out=$(printf "%s\n" $SELF_OUT | sort -u) &&
|
2017-05-02 23:34:06 +00:00
|
|
|
[ "$sorted_peer_out" = "$sorted_self_out" ]
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "cluster-ctl add need peer id" '
|
2017-05-05 16:09:36 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl peers add
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "cluster-ctl add invalid peer id" '
|
2017-05-02 20:32:42 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl peers add XXXinvalid-peerXXX
|
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "cluster-ctl rm needs peer id" '
|
2017-05-05 16:09:36 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl peers rm
|
2017-05-02 20:32:42 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "cluster-ctl rm invalid peer id" '
|
2017-05-02 20:32:42 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl peers rm XXXinvalid-peerXXX
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "empty cluster-ctl status succeeds" '
|
2017-05-05 16:09:36 +00:00
|
|
|
ipfs-cluster-ctl status
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "invalid CID status" '
|
2017-05-02 20:32:42 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl status XXXinvalid-CIDXXX
|
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "empty cluster-ctl sync succeeds" '
|
2017-05-05 16:09:36 +00:00
|
|
|
ipfs-cluster-ctl sync
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "empty cluster_ctl recover needs CID" '
|
2017-05-05 16:09:36 +00:00
|
|
|
test_must_fail ipfs-cluster-ctl recover
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "pin ls succeeds" '
|
2017-05-05 16:09:36 +00:00
|
|
|
ipfs-cluster-ctl pin ls
|
2017-04-18 22:22:05 +00:00
|
|
|
'
|
|
|
|
|
2017-05-04 22:33:12 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "pin ls on invalid CID succeeds" '
|
2017-05-02 20:32:42 +00:00
|
|
|
ipfs-cluster-ctl pin ls XXXinvalid-CIDXXX
|
|
|
|
'
|
|
|
|
|
|
|
|
cleanup test_clean_cluster
|
|
|
|
cleanup test_clean_ipfs
|
2017-04-18 22:22:05 +00:00
|
|
|
test_done
|