summaryrefslogtreecommitdiff
path: root/service/reload/config_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/reload/config_test.go')
-rw-r--r--service/reload/config_test.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/service/reload/config_test.go b/service/reload/config_test.go
new file mode 100644
index 00000000..c9c05a1e
--- /dev/null
+++ b/service/reload/config_test.go
@@ -0,0 +1,55 @@
+package reload
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+ "time"
+)
+
+func Test_Config_Valid(t *testing.T) {
+ services := make(map[string]ServiceConfig)
+ services["test"] = ServiceConfig{
+ Recursive: false,
+ Patterns: nil,
+ Dirs: nil,
+ Ignore: nil,
+ service: nil,
+ }
+
+ cfg := &Config{
+ Interval: time.Second,
+ Patterns: nil,
+ Services: services,
+ }
+ assert.NoError(t, cfg.Valid())
+}
+
+func Test_Fake_ServiceConfig(t *testing.T) {
+ services := make(map[string]ServiceConfig)
+ cfg := &Config{
+ Interval: time.Second,
+ Patterns: nil,
+ Services: services,
+ }
+ assert.Error(t, cfg.Valid())
+}
+
+func Test_Interval(t *testing.T) {
+ services := make(map[string]ServiceConfig)
+ cfg := &Config{
+ Interval: time.Millisecond,
+ Patterns: nil,
+ Services: services,
+ }
+ assert.Error(t, cfg.Valid())
+}
+
+func Test_NoServiceConfig(t *testing.T) {
+ services := make(map[string]ServiceConfig)
+ cfg := &Config{
+ Interval: time.Millisecond,
+ Patterns: nil,
+ Services: services,
+ }
+ assert.Error(t, cfg.Valid())
+}