forked from jrallison/go-workers
-
Notifications
You must be signed in to change notification settings - Fork 10
/
all_specs_test.go
54 lines (45 loc) · 1.23 KB
/
all_specs_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
51
52
53
54
package workers
import (
"testing"
"github.com/customerio/gospec"
)
// You will need to list every spec in a TestXxx method like this,
// so that gotest can be used to run the specs. Later GoSpec might
// get its own command line tool similar to gotest, but for now this
// is the way to go. This shouldn't require too much typing, because
// there will be typically only one top-level spec per class/feature.
func TestAllSpecs(t *testing.T) {
r := gospec.NewRunner()
r.Parallel = false
r.BeforeEach = func() {
Configure(Options{
Address: "localhost:6379",
ProcessID: "1",
Database: "15",
PoolSize: 1,
})
conn := Config.Pool.Get()
_, err := conn.Do("flushdb")
if err != nil {
panic("failed to flush db: " + err.Error())
}
err = conn.Close()
if err != nil {
panic("failed close connection: " + err.Error())
}
}
// List all specs here
r.AddSpec(WorkersSpec)
r.AddSpec(ConfigSpec)
r.AddSpec(MsgSpec)
r.AddSpec(FetchSpec)
r.AddSpec(WorkerSpec)
r.AddSpec(ManagerSpec)
r.AddSpec(ScheduledSpec)
r.AddSpec(EnqueueSpec)
r.AddSpec(MiddlewareSpec)
r.AddSpec(MiddlewareRetrySpec)
r.AddSpec(MiddlewareStatsSpec)
// Run GoSpec and report any errors to gotest's `testing.T` instance
gospec.MainGoTest(r, t)
}