fix health unit tests
This commit is contained in:
parent
5dd16fe875
commit
362cb4b8dd
|
@ -175,49 +175,39 @@ 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`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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