fix health unit tests
This commit is contained in:
parent
5dd16fe875
commit
362cb4b8dd
|
@ -176,18 +176,14 @@ func TestClusterHealthCollector(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "health ok",
|
name: "health ok",
|
||||||
input: `
|
input: `{"health": { "status": "HEALTH_OK" } }`,
|
||||||
{
|
|
||||||
"health": { "status": "HEALTH_OK" } }`,
|
|
||||||
reMatch: []*regexp.Regexp{
|
reMatch: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "health warn",
|
name: "health warn",
|
||||||
input: `
|
input: `{"health": { "status": "HEALTH_OK" } }`,
|
||||||
{
|
|
||||||
"health": { "status": "HEALTH_OK } }`,
|
|
||||||
reMatch: []*regexp.Regexp{
|
reMatch: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
||||||
regexp.MustCompile(`health_status_interp{cluster="ceph"} 0`),
|
regexp.MustCompile(`health_status_interp{cluster="ceph"} 0`),
|
||||||
|
@ -195,9 +191,7 @@ func TestClusterHealthCollector(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "health ok 2",
|
name: "health ok 2",
|
||||||
input: `
|
input: `{"health": { "status": "HEALTH_OK" } }`,
|
||||||
{
|
|
||||||
"health": { "status": "HEALTH_OK } }`,
|
|
||||||
reMatch: []*regexp.Regexp{
|
reMatch: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
regexp.MustCompile(`health_status{cluster="ceph"} 0`),
|
||||||
regexp.MustCompile(`health_status_interp{cluster="ceph"} 0`),
|
regexp.MustCompile(`health_status_interp{cluster="ceph"} 0`),
|
||||||
|
@ -205,9 +199,7 @@ func TestClusterHealthCollector(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "health warn 2",
|
name: "health warn 2",
|
||||||
input: `
|
input: `{"health": { "status": "HEALTH_WARN" } }`,
|
||||||
{
|
|
||||||
"health": { "status": "HEALTH_WARN" } }`,
|
|
||||||
reMatch: []*regexp.Regexp{
|
reMatch: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`health_status{cluster="ceph"} 1`),
|
regexp.MustCompile(`health_status{cluster="ceph"} 1`),
|
||||||
regexp.MustCompile(`health_status_interp{cluster="ceph"} 2`),
|
regexp.MustCompile(`health_status_interp{cluster="ceph"} 2`),
|
||||||
|
@ -215,9 +207,7 @@ func TestClusterHealthCollector(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "health err",
|
name: "health err",
|
||||||
input: `
|
input: `{"health": { "status": "HEALTH_ERR" } }`,
|
||||||
{
|
|
||||||
"health": { "status": "HEALTH_ERR" } }`,
|
|
||||||
reMatch: []*regexp.Regexp{
|
reMatch: []*regexp.Regexp{
|
||||||
regexp.MustCompile(`health_status{cluster="ceph"} 2`),
|
regexp.MustCompile(`health_status{cluster="ceph"} 2`),
|
||||||
regexp.MustCompile(`health_status_interp{cluster="ceph"} 3`),
|
regexp.MustCompile(`health_status_interp{cluster="ceph"} 3`),
|
||||||
|
|
Loading…
Reference in New Issue