blob: 3a2bf405e1db95bff8c2f8005144c1a5fee0cd61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package service
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/sirupsen/logrus/hooks/test"
"github.com/sirupsen/logrus"
)
func TestContainer_Init(t *testing.T) {
logger, hook := test.NewNullLogger()
logger.SetLevel(logrus.DebugLevel)
svc := &testService{ok: true}
c := NewContainer(logger)
c.Register("test", svc)
c.Register("test2", struct{}{})
assert.Equal(t, 2, len(hook.Entries))
assert.NoError(t, c.Serve())
c.Stop()
}
|