diff options
author | Valery Piashchynski <[email protected]> | 2020-03-14 00:57:28 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-03-14 00:57:28 +0300 |
commit | 4ae5a7e7213798892d511a7a53ecd148e22ca7f6 (patch) | |
tree | c246bb679d5ba3f8bdb4857df074d9ea51e9deeb /service/container_test.go | |
parent | bb96eee28c4a171ad663861e08fce73708ce09ad (diff) |
Fix panic in Serve
Add test for the bug
Uncomment test in container. It's working properly now
Diffstat (limited to 'service/container_test.go')
-rw-r--r-- | service/container_test.go | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/service/container_test.go b/service/container_test.go index 94bc243f..d7ca73a7 100644 --- a/service/container_test.go +++ b/service/container_test.go @@ -302,22 +302,23 @@ func TestContainer_ConfigureTwice(t *testing.T) { assert.Error(t, c.Init(&testCfg{`{"test":"something"}`})) } -//func TestContainer_ServeEmptyContainer(t *testing.T) { -// logger, hook := test.NewNullLogger() -// logger.SetLevel(logrus.DebugLevel) -// -// svc := &testService{ok: true} -// -// c := NewContainer(logger) -// c.Register("test", svc) -// assert.Equal(t, 0, len(hook.Entries)) -// -// go assert.NoError(t, c.Serve()) -// -// time.Sleep(time.Millisecond * 500) -// -// c.Stop() -//} +// bug #276 test +func TestContainer_ServeEmptyContainer(t *testing.T) { + logger, hook := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + svc := &testService{ok: true} + + c := NewContainer(logger) + c.Register("test", svc) + assert.Equal(t, 0, len(hook.Entries)) + + go assert.NoError(t, c.Serve()) + + time.Sleep(time.Millisecond * 500) + + c.Stop() +} func TestContainer_Serve(t *testing.T) { logger, hook := test.NewNullLogger() |