diff options
author | Wolfy-J <[email protected]> | 2019-06-27 12:57:59 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-06-27 12:57:59 +0300 |
commit | 132c89566c649ca5d9354dd7e6ac1e2cbab0d1b0 (patch) | |
tree | a42b9cd4fbf71e12e4b267b220501acbaf413b16 /service/metrics/service_test.go | |
parent | 5c026eb34ef2b5caad5f5e13cfd88b9c05362e92 (diff) |
more tests
Diffstat (limited to 'service/metrics/service_test.go')
-rw-r--r-- | service/metrics/service_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/service/metrics/service_test.go b/service/metrics/service_test.go index 592bac9c..673b9c6d 100644 --- a/service/metrics/service_test.go +++ b/service/metrics/service_test.go @@ -159,8 +159,30 @@ func Test_ConfiguredMetric(t *testing.T) { s.(*Service).Collector("user_gauge").(prometheus.Gauge).Set(100) + assert.Nil(t, s.(*Service).Collector("invalid")) + out, _, err := get("http://localhost:2112/metrics") assert.NoError(t, err) assert.Contains(t, out, "user_gauge 100") } + +func Test_ConfiguredInvalidMetric(t *testing.T) { + logger, _ := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := service.NewContainer(logger) + c.Register(ID, &Service{}) + + assert.NoError(t, c.Init(&testCfg{metricsCfg: `{ + "address": "localhost:2112", + "collect":{ + "user_gauge":{ + "type": "invalid" + } + } + + }`})) + + assert.Error(t, c.Serve()) +} |