diff options
Diffstat (limited to 'plugins/metrics/plugin_test.go')
-rw-r--r-- | plugins/metrics/plugin_test.go | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/plugins/metrics/plugin_test.go b/plugins/metrics/plugin_test.go index 34f5869d..fa622811 100644 --- a/plugins/metrics/plugin_test.go +++ b/plugins/metrics/plugin_test.go @@ -1,96 +1,5 @@ package metrics -// type testCfg struct { -// rpcCfg string -// metricsCfg string -// target string -// } -// -// func (cfg *testCfg) Get(name string) service.Config { -// if name == ID { -// return &testCfg{target: cfg.metricsCfg} -// } -// -// if name == rpc.ID { -// return &testCfg{target: cfg.rpcCfg} -// } -// -// return nil -// } -// -// func (cfg *testCfg) Unmarshal(out interface{}) error { -// j := json.ConfigCompatibleWithStandardLibrary -// err := j.Unmarshal([]byte(cfg.target), out) -// return err -// } -// -// func TestService_Serve(t *testing.T) { -// logger, _ := test.NewNullLogger() -// logger.SetLevel(logrus.DebugLevel) -// -// c := service.NewContainer(logger) -// c.Register(ID, &Plugin{}) -// -// assert.NoError(t, c.Init(&testCfg{metricsCfg: `{ -// "address": "localhost:2116" -// }`})) -// -// s, _ := c.Get(ID) -// assert.NotNil(t, s) -// -// go func() { -// err := c.Serve() -// if err != nil { -// t.Errorf("error during the Serve: error %v", err) -// } -// }() -// time.Sleep(time.Millisecond * 100) -// defer c.Stop() -// -// out, _, err := get("http://localhost:2116/metrics") -// assert.NoError(t, err) -// -// assert.Contains(t, out, "go_gc_duration_seconds") -// } -// -// func Test_ServiceCustomMetric(t *testing.T) { -// logger, _ := test.NewNullLogger() -// logger.SetLevel(logrus.DebugLevel) -// -// c := service.NewContainer(logger) -// c.Register(ID, &Plugin{}) -// -// assert.NoError(t, c.Init(&testCfg{metricsCfg: `{ -// "address": "localhost:2115" -// }`})) -// -// s, _ := c.Get(ID) -// assert.NotNil(t, s) -// -// collector := prometheus.NewGauge(prometheus.GaugeOpts{ -// Name: "my_gauge", -// Help: "My gauge value", -// }) -// -// assert.NoError(t, s.(*Plugin).Register(collector)) -// -// go func() { -// err := c.Serve() -// if err != nil { -// t.Errorf("error during the Serve: error %v", err) -// } -// }() -// time.Sleep(time.Millisecond * 100) -// defer c.Stop() -// -// collector.Set(100) -// -// out, _, err := get("http://localhost:2115/metrics") -// assert.NoError(t, err) -// -// assert.Contains(t, out, "my_gauge 100") -// } -// // func Test_ServiceCustomMetricMust(t *testing.T) { // logger, _ := test.NewNullLogger() // logger.SetLevel(logrus.DebugLevel) |