diff options
author | Valery Piashchynski <[email protected]> | 2020-11-13 13:42:40 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-13 13:42:40 +0300 |
commit | 002eb4bb1981558fa5e614aed22d322f0f45d7ea (patch) | |
tree | 9c03ebf549741e31875c5b354de72d14ce0e8b97 /plugins/metrics/tests/metrics_test.go | |
parent | 7eb675a031d751787b31bd6894c936e86b190ebf (diff) |
Move all interfaces to the separate folder [RPC, METRICS, LOGGER]
RPC for the metrics update to the working state
RCP interface renamed to the RPCer
Diffstat (limited to 'plugins/metrics/tests/metrics_test.go')
-rw-r--r-- | plugins/metrics/tests/metrics_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/plugins/metrics/tests/metrics_test.go b/plugins/metrics/tests/metrics_test.go new file mode 100644 index 00000000..d04c75d3 --- /dev/null +++ b/plugins/metrics/tests/metrics_test.go @@ -0,0 +1,51 @@ +package tests + +import ( + "fmt" + "testing" + + "github.com/spiral/endure" + "github.com/spiral/roadrunner/v2/plugins/config" + "github.com/spiral/roadrunner/v2/plugins/logger" + "github.com/spiral/roadrunner/v2/plugins/metrics" +) + +func TestMetricsInit(t *testing.T) { + cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.DebugLevel)) + if err != nil { + t.Fatal(err) + } + + cfg := &config.Viper{} + cfg.Prefix = "rr" + cfg.Path = ".rr-test.yaml" + + err = cont.Register(cfg) + if err != nil { + t.Fatal(err) + } + + err = cont.Register(&metrics.Plugin{}) + if err != nil { + t.Fatal(err) + } + + err = cont.Register(&logger.ZapLogger{}) + if err != nil { + t.Fatal(err) + } + + err = cont.Init() + if err != nil { + t.Fatal(err) + } + + errCh, err := cont.Serve() + + for { + select { + case e := <-errCh: + fmt.Println(e) + } + } +} |