collectors/pool: add new pool test

This commit is contained in:
Vaibhav Bhembre 2019-05-16 18:47:16 -04:00
parent 0c551664a5
commit ce59e8446f
2 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2016 DigitalOcean
// Copyright 2019 DigitalOcean
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
// Copyright 2016 DigitalOcean
// Copyright 2019 DigitalOcean
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -35,16 +35,25 @@ func TestPoolInfoCollector(t *testing.T) {
{
input: `
[
{"pool_name": "rbd", "size": 3, "min_size": 2, "pg_num": 8192, "pg_placement_num": 8192, "quota_max_bytes": 1024, "quota_max_objects": 2048, "erasure_code_profile": "ec-4-2", "stripe_width": 4096}
{"pool_name": "rbd", "size": 6, "min_size": 4, "pg_num": 8192, "pg_placement_num": 8192, "quota_max_bytes": 1024, "quota_max_objects": 2048, "erasure_code_profile": "ec-4-2", "stripe_width": 4096},
{"pool_name": "rbd", "size": 3, "min_size": 2, "pg_num": 16384, "pg_placement_num": 16384, "quota_max_bytes": 512, "quota_max_objects": 1024, "erasure_code_profile": "replicated-ruleset", "stripe_width": 4096}
]`,
reMatch: []*regexp.Regexp{
regexp.MustCompile(`pool_size{cluster="ceph",pool="rbd",profile="ec-4-2"} 3`),
regexp.MustCompile(`pool_min_size{cluster="ceph",pool="rbd",profile="ec-4-2"} 2`),
regexp.MustCompile(`pool_size{cluster="ceph",pool="rbd",profile="ec-4-2"} 6`),
regexp.MustCompile(`pool_min_size{cluster="ceph",pool="rbd",profile="ec-4-2"} 4`),
regexp.MustCompile(`pool_pg_num{cluster="ceph",pool="rbd",profile="ec-4-2"} 8192`),
regexp.MustCompile(`pool_pgp_num{cluster="ceph",pool="rbd",profile="ec-4-2"} 8192`),
regexp.MustCompile(`pool_quota_max_bytes{cluster="ceph",pool="rbd",profile="ec-4-2"} 1024`),
regexp.MustCompile(`pool_quota_max_objects{cluster="ceph",pool="rbd",profile="ec-4-2"} 2048`),
regexp.MustCompile(`pool_stripe_width{cluster="ceph",pool="rbd",profile="ec-4-2"} 4096`),
regexp.MustCompile(`pool_size{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 3`),
regexp.MustCompile(`pool_min_size{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 2`),
regexp.MustCompile(`pool_pg_num{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 16384`),
regexp.MustCompile(`pool_pgp_num{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 16384`),
regexp.MustCompile(`pool_quota_max_bytes{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 512`),
regexp.MustCompile(`pool_quota_max_objects{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 1024`),
regexp.MustCompile(`pool_stripe_width{cluster="ceph",pool="rbd",profile="replicated-ruleset"} 4096`),
},
reUnmatch: []*regexp.Regexp{},
},