summaryrefslogtreecommitdiff
path: root/service/container_test.go
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-12-23 14:52:06 +0300
committerGitHub <[email protected]>2019-12-23 14:52:06 +0300
commit921e1f55e23ab75b8250045916c8d1ffad1b8bde (patch)
tree00b16331b9ff3b3b846ba22989dddde721cc959d /service/container_test.go
parent921354df1aa4687837e3ba6ac0eb04d39321c149 (diff)
parent2093cb9058f94668fff0a97beb76b0cab66c7b63 (diff)
Merge branch 'master' into Fix_warning_and_issues
Diffstat (limited to 'service/container_test.go')
-rw-r--r--service/container_test.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/service/container_test.go b/service/container_test.go
index 33ad9491..5350de41 100644
--- a/service/container_test.go
+++ b/service/container_test.go
@@ -132,6 +132,20 @@ func TestContainer_Has(t *testing.T) {
assert.False(t, c.Has("another"))
}
+func TestContainer_List(t *testing.T) {
+ logger, hook := test.NewNullLogger()
+ logger.SetLevel(logrus.DebugLevel)
+
+ c := NewContainer(logger)
+ c.Register("test", &testService{})
+
+ assert.Equal(t, 0, len(hook.Entries))
+ assert.Equal(t, 1, len(c.List()))
+
+ assert.True(t, c.Has("test"))
+ assert.False(t, c.Has("another"))
+}
+
func TestContainer_Get(t *testing.T) {
logger, hook := test.NewNullLogger()
logger.SetLevel(logrus.DebugLevel)
@@ -428,6 +442,10 @@ func TestContainer_InitErrorB(t *testing.T) {
type testInitC struct{}
+func (r *testInitC) Test() bool {
+ return true
+}
+
func TestContainer_NoInit(t *testing.T) {
logger, _ := test.NewNullLogger()
logger.SetLevel(logrus.DebugLevel)
@@ -449,7 +467,6 @@ func (c *DCfg) Hydrate(cfg Config) error {
if err := cfg.Unmarshal(c); err != nil {
return err
}
-
if c.V == "fail" {
return errors.New("failed config")
}