summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
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)
+}