summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-04 23:25:52 +0300
committerWolfy-J <[email protected]>2019-05-04 23:25:52 +0300
commitdb838d7465cc6b147c5d7f672d71c6523df54209 (patch)
tree8dad85059a1f60c60a0f179ef8bff71bf9566f29 /service
parent2fb995876b208dc40912d11764262e33920dd4fa (diff)
more tests
Diffstat (limited to 'service')
-rw-r--r--service/limit/config_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/service/limit/config_test.go b/service/limit/config_test.go
index 2f647819..b8a6c0aa 100644
--- a/service/limit/config_test.go
+++ b/service/limit/config_test.go
@@ -5,6 +5,7 @@ import (
"github.com/spiral/roadrunner/service"
"github.com/stretchr/testify/assert"
"testing"
+ "time"
)
type mockCfg struct{ cfg string }
@@ -18,3 +19,27 @@ func Test_Config_Hydrate_Error1(t *testing.T) {
assert.Error(t, c.Hydrate(cfg))
}
+
+func Test_Controller_Default(t *testing.T) {
+ cfg := &mockCfg{`
+{
+ "services":{
+ "http": {
+ "TTL": 1
+ }
+ }
+}
+`}
+ c := &Config{}
+ c.InitDefaults()
+
+ assert.NoError(t, c.Hydrate(cfg))
+ assert.Equal(t, time.Second, c.Interval)
+
+ list := c.Controllers(func(event int, ctx interface{}) {
+ })
+
+ sc := list["http"]
+
+ assert.Equal(t, time.Second, sc.(*controller).tick)
+}