ipfs-cluster/sharness/t0025-ctl-status-report-commands.sh

64 lines
1.7 KiB
Bash
Raw Normal View History

#!/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
cleanup test_clean_ipfs
2017-05-04 22:33:12 +00:00
test_cluster_init
cleanup test_clean_cluster
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER,JQ "cluster-ctl can read id" '
test_cluster_config
id=`cluster_id`
[ -n "$id"] && ipfs-cluster-ctl id | egrep -q "$id"
'
2017-05-04 22:33:12 +00:00
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 ]
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "cluster-ctl add need peer id" '
test_must_fail ipfs-cluster-ctl peers add
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "cluster-ctl add invalid peer id" '
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" '
test_must_fail ipfs-cluster-ctl peers rm
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "cluster-ctl rm invalid peer id" '
test_must_fail ipfs-cluster-ctl peers rm XXXinvalid-peerXXX
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "empty cluster-ctl status succeeds" '
ipfs-cluster-ctl status
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "invalid CID status" '
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" '
ipfs-cluster-ctl sync
'
2017-05-04 22:33:12 +00:00
test_expect_success IPFS,CLUSTER "empty cluster_ctl recover needs CID" '
test_must_fail ipfs-cluster-ctl recover
'
2017-05-04 22:33:12 +00:00
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