2017-11-28 22:45:10 +00:00
|
|
|
#!/bin/bash
|
2017-04-18 22:22:05 +00:00
|
|
|
|
|
|
|
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-07-03 18:02:27 +00:00
|
|
|
id=`cluster_id`
|
2017-08-01 12:25:20 +00:00
|
|
|
[ -n "$id" ] && ( ipfs-cluster-ctl id | egrep -q "$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-07-03 18:02:27 +00:00
|
|
|
peer_length=`ipfs-cluster-ctl --enc=json peers ls | jq ". | length"`
|
|
|
|
[ $peer_length -eq 1 ]
|
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
|
|
|
'
|
|
|
|
|
2019-09-08 10:11:32 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "empty cluster_ctl recover should not 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-07-03 18:02:27 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "pin ls on invalid CID fails" '
|
|
|
|
test_must_fail ipfs-cluster-ctl pin ls XXXinvalid-CIDXXX
|
2017-05-02 20:32:42 +00:00
|
|
|
'
|
|
|
|
|
2018-01-18 02:49:35 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
2017-04-18 22:22:05 +00:00
|
|
|
test_done
|