forked from vmware-archive/voyager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
voyager_suite_test.go
58 lines (47 loc) · 1.12 KB
/
voyager_suite_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
55
56
57
58
package voyager_test
import (
"os"
"time"
"github.com/concourse/voyager/helpers"
"code.cloudfoundry.org/lager/lagertest"
"github.com/gobuffalo/packr"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
"testing"
)
func TestVoyager(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Voyager Suite")
}
var postgresRunner helpers.Runner
var dbProcess ifrit.Process
var logger *lagertest.TestLogger
var _ = BeforeSuite(func() {
postgresRunner = helpers.Runner{
Port: 5433 + GinkgoParallelNode(),
}
dbProcess = ifrit.Invoke(postgresRunner)
logger = lagertest.NewTestLogger("test")
})
var _ = BeforeEach(func() {
postgresRunner.CreateTestDB()
})
var _ = AfterEach(func() {
postgresRunner.DropTestDB()
})
var _ = AfterSuite(func() {
dbProcess.Signal(os.Interrupt)
Eventually(dbProcess.Wait(), 10*time.Second).Should(Receive())
})
var box = packr.NewBox("./migrations")
var asset = box.MustBytes
var assetNames = func() []string {
migrations := []string{}
for _, name := range box.List() {
if name != "migrations.go" {
migrations = append(migrations, name)
}
}
return migrations
}