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.go152
1 files changed, 0 insertions, 152 deletions
diff --git a/plugins/metrics/rpc_test.go b/plugins/metrics/rpc_test.go
index aab4a2ec..c3e3854f 100644
--- a/plugins/metrics/rpc_test.go
+++ b/plugins/metrics/rpc_test.go
@@ -1,157 +1,5 @@
package metrics
-// import (
-// "github.com/sirupsen/logrus"
-// "github.com/sirupsen/logrus/hooks/test"
-// "github.com/spiral/roadrunner/service"
-// "github.com/spiral/roadrunner/service/rpc"
-// "github.com/stretchr/testify/assert"
-// rpc2 "net/rpc"
-// "strconv"
-// "testing"
-// "time"
-// )
-//
-//
-
-//
-
-//
-
-// func Test_Register_RPC_Histogram(t *testing.T) {
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2319",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Declare", &NamedCollector{
-// Name: "custom_histogram",
-// Collector: Collector{
-// Namespace: "test_histogram",
-// Subsystem: "test_histogram",
-// Type: Histogram,
-// Help: "test_histogram",
-// Labels: nil,
-// Buckets: []float64{0.1, 0.2, 0.5},
-// },
-// }, &ok))
-// assert.True(t, ok)
-//
-// var ok2 bool
-// // histogram does not support Add, should be an error
-// assert.Error(t, client.Call("metrics.Add", Metric{
-// Name: "custom_histogram",
-// }, &ok2))
-// // ok should became false
-// assert.False(t, ok2)
-//
-// out, _, err := get("http://localhost:2319/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `TYPE test_histogram_test_histogram_custom_histogram histogram`)
-//
-// // check buckets
-// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.1"} 0`)
-// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.2"} 0`)
-// assert.Contains(t, out, `test_histogram_test_histogram_custom_histogram_bucket{le="0.5"} 0`)
-// }
-//
-// func Test_Register_RPC_Gauge(t *testing.T) {
-// // FOR register method, setup used just to init the rpc
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2324",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Declare", &NamedCollector{
-// Name: "custom_gauge",
-// Collector: Collector{
-// Namespace: "test_gauge",
-// Subsystem: "test_gauge",
-// Type: Gauge,
-// Help: "test_gauge",
-// Labels: []string{"type", "section"},
-// Buckets: nil,
-// },
-// }, &ok))
-// assert.True(t, ok)
-//
-// var ok2 bool
-// // Add to custom_gauge
-// assert.NoError(t, client.Call("metrics.Add", Metric{
-// Name: "custom_gauge",
-// Value: 100.0,
-// Labels: []string{"core", "first"},
-// }, &ok2))
-// // ok should became true
-// assert.True(t, ok2)
-//
-// // Subtract from custom runtime metric
-// var ok3 bool
-// assert.NoError(t, client.Call("metrics.Sub", Metric{
-// Name: "custom_gauge",
-// Value: 10.0,
-// Labels: []string{"core", "first"},
-// }, &ok3))
-// assert.True(t, ok3)
-//
-// out, _, err := get("http://localhost:2324/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `test_gauge_test_gauge_custom_gauge{section="first",type="core"} 90`)
-// }
-//
-// func Test_Register_RPC_Counter(t *testing.T) {
-// // FOR register method, setup used just to init the rpc
-// client, c := setup(
-// t,
-// `"user_gauge":{
-// "type": "gauge",
-// "labels": ["type", "section"]
-// }`,
-// "2328",
-// )
-// defer c.Stop()
-//
-// var ok bool
-// assert.NoError(t, client.Call("metrics.Declare", &NamedCollector{
-// Name: "custom_counter",
-// Collector: Collector{
-// Namespace: "test_counter",
-// Subsystem: "test_counter",
-// Type: Counter,
-// Help: "test_counter",
-// Labels: []string{"type", "section"},
-// Buckets: nil,
-// },
-// }, &ok))
-// assert.True(t, ok)
-//
-// var ok2 bool
-// // Add to custom_counter
-// assert.NoError(t, client.Call("metrics.Add", Metric{
-// Name: "custom_counter",
-// Value: 100.0,
-// Labels: []string{"type2", "section2"},
-// }, &ok2))
-// // ok should became true
-// assert.True(t, ok2)
-//
-// out, _, err := get("http://localhost:2328/metrics")
-// assert.NoError(t, err)
-// assert.Contains(t, out, `test_counter_test_counter_custom_counter{section="section2",type="type2"} 100`)
-// }
-//
// func Test_Register_RPC_Summary(t *testing.T) {
// // FOR register method, setup used just to init the rpc
// client, c := setup(