summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-06-26 16:48:58 +0300
committerWolfy-J <[email protected]>2019-06-26 16:48:58 +0300
commite39fae803ee90384fb1fa1bf3104e583f02666fa (patch)
treea348268a181620b2ab0eb894678a7ec0f9b94684 /service
parent6508bd2e670017382d5c761c53018f9f49c15ffc (diff)
more tests
Diffstat (limited to 'service')
-rw-r--r--service/metrics/config_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/service/metrics/config_test.go b/service/metrics/config_test.go
new file mode 100644
index 00000000..bd02d1cf
--- /dev/null
+++ b/service/metrics/config_test.go
@@ -0,0 +1,27 @@
+package metrics
+
+import (
+ "encoding/json"
+ "github.com/spiral/roadrunner/service"
+ "github.com/stretchr/testify/assert"
+ "testing"
+)
+
+type mockCfg struct{ cfg string }
+
+func (cfg *mockCfg) Get(name string) service.Config { return nil }
+func (cfg *mockCfg) Unmarshal(out interface{}) error { return json.Unmarshal([]byte(cfg.cfg), out) }
+
+func Test_Config_Hydrate_Error1(t *testing.T) {
+ cfg := &mockCfg{`{"request": {"From": "Something"}}`}
+ c := &Config{}
+
+ assert.NoError(t, c.Hydrate(cfg))
+}
+
+func Test_Config_Hydrate_Error2(t *testing.T) {
+ cfg := &mockCfg{`{"dir": "/dir/"`}
+ c := &Config{}
+
+ assert.Error(t, c.Hydrate(cfg))
+}