summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/entry_test.go16
-rw-r--r--service/rpc/service.go2
-rw-r--r--service/static/service.go2
3 files changed, 18 insertions, 2 deletions
diff --git a/service/entry_test.go b/service/entry_test.go
new file mode 100644
index 00000000..67f982ba
--- /dev/null
+++ b/service/entry_test.go
@@ -0,0 +1,16 @@
+package service
+
+import (
+ "testing"
+ "github.com/stretchr/testify/assert"
+)
+
+func TestEntry_CanServeFalse(t *testing.T) {
+ e := &entry{svc: nil}
+ assert.False(t, e.canServe())
+}
+
+func TestEntry_CanServeTrue(t *testing.T) {
+ e := &entry{svc: &testService{}}
+ assert.True(t, e.canServe())
+}
diff --git a/service/rpc/service.go b/service/rpc/service.go
index 621348e8..6e231048 100644
--- a/service/rpc/service.go
+++ b/service/rpc/service.go
@@ -20,7 +20,7 @@ type Service struct {
}
// Init rpc service. Must return true if service is enabled.
-func (s *Service) Init(cfg *Config) (enabled bool, err error) {
+func (s *Service) Init(cfg *Config) (bool, error) {
if !cfg.Enable {
return false, nil
}
diff --git a/service/static/service.go b/service/static/service.go
index 968cb594..98d8313c 100644
--- a/service/static/service.go
+++ b/service/static/service.go
@@ -21,7 +21,7 @@ type Service struct {
// Init must return configure service and return true if service hasStatus enabled. Must return error in case of
// misconfiguration. Services must not be used without proper configuration pushed first.
-func (s *Service) Init(cfg *Config, r *rrttp.Service) (enabled bool, err error) {
+func (s *Service) Init(cfg *Config, r *rrttp.Service) (bool, error) {
if !cfg.Enable || r == nil {
return false, nil
}