2018-12-17 14:52:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
test_description="Test cluster-ctl's information monitoring functionality"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
|
|
|
test_ipfs_init
|
|
|
|
test_cluster_init
|
|
|
|
|
2018-12-21 02:47:55 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "health graph succeeds and prints as expected" '
|
|
|
|
ipfs-cluster-ctl health graph | grep -q "C0 -> I0"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success IPFS,CLUSTER "health metrics with metric name must succeed" '
|
|
|
|
ipfs-cluster-ctl health metrics ping &&
|
|
|
|
ipfs-cluster-ctl health metrics freespace
|
|
|
|
'
|
|
|
|
|
2019-10-24 14:37:26 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "health metrics without metric name doesn't fail" '
|
|
|
|
ipfs-cluster-ctl health metrics
|
2018-12-21 02:47:55 +00:00
|
|
|
'
|
|
|
|
|
2018-12-17 14:52:43 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "list latest metrics logged by this peer" '
|
2019-01-14 12:00:39 +00:00
|
|
|
pid=`ipfs-cluster-ctl --enc=json id | jq -r ".id"`
|
2019-10-24 14:37:26 +00:00
|
|
|
ipfs-cluster-ctl health metrics freespace | grep -q -E "(^$pid \| freespace: [0-9]+ (G|M|K)B \| Expires in: [0-9]+ seconds from now)"
|
2018-12-17 14:52:43 +00:00
|
|
|
'
|
|
|
|
|
2019-12-23 07:12:38 +00:00
|
|
|
test_expect_success IPFS,CLUSTER "alerts must succeed" '
|
2021-01-13 23:17:20 +00:00
|
|
|
ipfs-cluster-ctl health alerts
|
2019-12-23 07:12:38 +00:00
|
|
|
'
|
|
|
|
|
2018-12-17 14:52:43 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
|
|
|
test_done
|