diff options
author | Wolfy-J <[email protected]> | 2018-06-13 14:07:05 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-13 14:07:05 +0300 |
commit | ca95f67317bcf8972b9e669869338a7dc09bf06d (patch) | |
tree | 4d199ceb8a78675242fef21bd87efb5a78b04029 /service/rpc | |
parent | c8e8afe79611941ce50453ee7dfae82d7915e9c4 (diff) |
more upload tests
Diffstat (limited to 'service/rpc')
-rw-r--r-- | service/rpc/service.go | 4 | ||||
-rw-r--r-- | service/rpc/service_test.go | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/service/rpc/service.go b/service/rpc/service.go index ce1e3351..6e26d3c2 100644 --- a/service/rpc/service.go +++ b/service/rpc/service.go @@ -21,9 +21,9 @@ type Service struct { serving bool } -// Configure must return configure service and return true if service hasStatus enabled. Must return error in case of +// 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) Configure(cfg service.Config, reg service.Container) (enabled bool, err error) { +func (s *Service) Init(cfg service.Config, reg service.Container) (enabled bool, err error) { config := &config{} if err := cfg.Unmarshal(config); err != nil { return false, err diff --git a/service/rpc/service_test.go b/service/rpc/service_test.go index f6aeb2aa..ce85d52f 100644 --- a/service/rpc/service_test.go +++ b/service/rpc/service_test.go @@ -19,7 +19,7 @@ func (cfg *testCfg) Unmarshal(out interface{}) error { return json.Unmarshal([]b func Test_ConfigError(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":false`}, nil) + ok, err := s.Init(&testCfg{`{"enable":false`}, nil) assert.Error(t, err) assert.False(t, ok) @@ -27,7 +27,7 @@ func Test_ConfigError(t *testing.T) { func Test_Disabled(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":false}`}, nil) + ok, err := s.Init(&testCfg{`{"enable":false}`}, nil) assert.NoError(t, err) assert.False(t, ok) @@ -45,7 +45,7 @@ func Test_RegisterNotConfigured(t *testing.T) { func Test_Enabled(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":true, "listen":"tcp://localhost:9008"}`}, nil) + ok, err := s.Init(&testCfg{`{"enable":true, "listen":"tcp://localhost:9008"}`}, nil) assert.NoError(t, err) assert.True(t, ok) @@ -53,7 +53,7 @@ func Test_Enabled(t *testing.T) { func Test_StopNonServing(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":true, "listen":"tcp://localhost:9008"}`}, nil) + ok, err := s.Init(&testCfg{`{"enable":true, "listen":"tcp://localhost:9008"}`}, nil) assert.NoError(t, err) assert.True(t, ok) @@ -62,7 +62,7 @@ func Test_StopNonServing(t *testing.T) { func Test_Serve_Errors(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":true, "listen":"mailformed"}`}, nil) + ok, err := s.Init(&testCfg{`{"enable":true, "listen":"mailformed"}`}, nil) assert.NoError(t, err) assert.True(t, ok) @@ -75,7 +75,7 @@ func Test_Serve_Errors(t *testing.T) { func Test_Serve_Client(t *testing.T) { s := &Service{} - ok, err := s.Configure(&testCfg{`{"enable":true, "listen":"tcp://localhost:9018"}`}, nil) + ok, err := s.Init(&testCfg{`{"enable":true, "listen":"tcp://localhost:9018"}`}, nil) assert.NoError(t, err) assert.True(t, ok) |