ipfs-cluster/sharness/t0025-ctl-status-report-commands.sh
Kishan Mohanbhai Sagathiya fc678242fb Added tests for /monitor/metrics/{metrics_type}
Move ctl-health sharness tests to apprpriate file

Since the API is using the RPC mock to request metrics and it always
returns a mocked test metric we might just do c.Metrics("somemetricstype")
and check that there is no error. Here we just want to check that the
client is hitting an API endpoint (and understands the response).

Fixes #587

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-21 08:24:40 +05:30

64 lines
1.6 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
test_cluster_init
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_clean_ipfs
test_clean_cluster
test_done