-
Notifications
You must be signed in to change notification settings - Fork 15
/
backend_local_test.go
50 lines (40 loc) · 977 Bytes
/
backend_local_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dingo_test
import (
"testing"
"github.com/mission-liao/dingo"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
//
// Reporter
//
func TestLocalReporter(t *testing.T) {
ass := assert.New(t)
var reporter dingo.Reporter
reporter, err := dingo.NewLocalBackend(dingo.DefaultConfig(), nil)
// test case for Report/Unbind
reports := make(chan *dingo.ReportEnvelope, 10)
_, err = reporter.Report("TestLocalReporter", reports)
ass.Nil(err)
// teardown
reporter.(dingo.Object).Close()
}
//
// Backend generic test cases
//
type localBackendTestSuite struct {
dingo.BackendTestSuite
}
func TestLocalBackendSuite(t *testing.T) {
suite.Run(t, &localBackendTestSuite{
dingo.BackendTestSuite{
Gen: func() (b dingo.Backend, err error) {
b, err = dingo.NewLocalBackend(dingo.DefaultConfig(), nil)
if err == nil {
err = b.(dingo.Object).Expect(dingo.ObjT.Reporter | dingo.ObjT.Store)
}
return
},
},
})
}