ipfs-cluster/sharness/t0032-ctl-health.sh
Kishan Mohanbhai Sagathiya a3b8767e87 Added tests for Alerts
- tests for related cluster method, rest api, client method etc
- clean expired alerts everytime a new alerts come in
2019-12-23 12:42:38 +05:30

36 lines
988 B
Bash
Executable File

#!/bin/bash
test_description="Test cluster-ctl's information monitoring functionality"
. lib/test-lib.sh
test_ipfs_init
test_cluster_init
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
'
test_expect_success IPFS,CLUSTER "health metrics without metric name doesn't fail" '
ipfs-cluster-ctl health metrics
'
test_expect_success IPFS,CLUSTER "list latest metrics logged by this peer" '
pid=`ipfs-cluster-ctl --enc=json id | jq -r ".id"`
ipfs-cluster-ctl health metrics freespace | grep -q -E "(^$pid \| freespace: [0-9]+ (G|M|K)B \| Expires in: [0-9]+ seconds from now)"
'
test_expect_success IPFS,CLUSTER "alerts must succeed" '
ipfs-cluster-ctl alerts
'
test_clean_ipfs
test_clean_cluster
test_done