summaryrefslogtreecommitdiff
path: root/plugins/metrics/rpc_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/metrics/rpc_test.go')
-rw-r--r--plugins/metrics/rpc_test.go228
1 files changed, 3 insertions, 225 deletions
diff --git a/plugins/metrics/rpc_test.go b/plugins/metrics/rpc_test.go
index b29ccaec..aab4a2ec 100644
--- a/plugins/metrics/rpc_test.go
+++ b/plugins/metrics/rpc_test.go
@@ -12,234 +12,12 @@ package metrics
// "time"
// )
//
-// var port = 5004
//
-// func setup(t *testing.T, metric string, portNum string) (*rpc2.Client, service.Container) {
-// logger, _ := test.NewNullLogger()
-// logger.SetLevel(logrus.DebugLevel)
-//
-// c := service.NewContainer(logger)
-// c.Register(rpc.ID, &rpc.Plugin{})
-// c.Register(ID, &Plugin{})
-//
-// assert.NoError(t, c.Init(&testCfg{
-// rpcCfg: `{"enable":true, "listen":"tcp://:` + strconv.Itoa(port) + `"}`,
-// metricsCfg: `{
-// "address": "localhost:` + portNum + `",
-// "collect":{
-// ` + metric + `
-// }
-// }`}))
-//
-// // rotate ports for travis
-// port++
-//
-// s, _ := c.Get(ID)
-// assert.NotNil(t, s)
-//
-// s2, _ := c.Get(rpc.ID)
-// rs := s2.(*rpc.Plugin)
-//
-// assert.True(t, s.(*Plugin).Enabled())
-//
-// go func() {
-// err := c.Serve()
-// if err != nil {
-// t.Errorf("error during the Serve: error %v", err)
-// }
-// }()
-// time.Sleep(time.Millisecond * 200)
-//
-// client, err := rs.Client()
-// assert.NoError(t, err)
-// if err != nil {
-// panic(err)
-// }
-//
-// return client, c
-// }
-//
-// func Test_Set_RPC(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge"
-// }`,
-// "2112",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// }, &ok))
-// assert.True(t, ok)
-//
-// out, _, err := get("http://localhost:2112/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `user_gauge 100`)
-// }
-//
-// func Test_Set_RPC_Vector(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2113",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// Labels: []string{"core", "first"},
-// }, &ok))
-// assert.True(t, ok)
-//
-// out, _, err := get("http://localhost:2113/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `user_gauge{section="first",type="core"} 100`)
-// }
-//
-// func Test_Set_RPC_CollectorError(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2114",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.Error(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge_2",
-// Value: 100.0,
-// Labels: []string{"missing"},
-// }, &ok))
-//}
-//
-// func Test_Set_RPC_MetricError(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2115",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.Error(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// Labels: []string{"missing"},
-// }, &ok))
-// }
-//
-// func Test_Set_RPC_MetricError_2(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2116",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.Error(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// }, &ok))
-// }
-//
-// func Test_Set_RPC_MetricError_3(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "histogram",
-// "labels": ["type", "section"]
-// }`,
-// "2117",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.Error(t, client.Call("metrics.Set", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// }, &ok))
-// }
-//
-// // sub
-//
-// func Test_Sub_RPC(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge"
-// }`,
-// "2118",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Add", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// }, &ok))
-// assert.True(t, ok)
-//
-// assert.NoError(t, client.Call("metrics.Sub", Metric{
-// Name: "user_gauge",
-// Value: 10.0,
-// }, &ok))
-// assert.True(t, ok)
-//
-// out, _, err := get("http://localhost:2118/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `user_gauge 90`)
-// }
-//
-// func Test_Sub_RPC_Vector(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2119",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Add", Metric{
-// Name: "user_gauge",
-// Value: 100.0,
-// Labels: []string{"core", "first"},
-// }, &ok))
-// assert.True(t, ok)
-//
-// assert.NoError(t, client.Call("metrics.Sub", Metric{
-// Name: "user_gauge",
-// Value: 10.0,
-// Labels: []string{"core", "first"},
-// }, &ok))
-// assert.True(t, ok)
+
//
-// out, _, err := get("http://localhost:2119/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `user_gauge{section="first",type="core"} 90`)
-// }
+
//
+
// func Test_Register_RPC_Histogram(t *testing.T) {
// client, c := setup(
// t,