github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/migration/migration_suite_test.go (about) 1 package migration_test 2 3 import ( 4 "os" 5 "time" 6 7 "github.com/pf-qiu/concourse/v6/atc/postgresrunner" 8 "github.com/gobuffalo/packr" 9 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/gomega" 11 "github.com/tedsuo/ifrit" 12 13 "testing" 14 ) 15 16 func TestMigration(t *testing.T) { 17 RegisterFailHandler(Fail) 18 RunSpecs(t, "Migration Suite") 19 } 20 21 var postgresRunner postgresrunner.Runner 22 var dbProcess ifrit.Process 23 24 var _ = BeforeSuite(func() { 25 postgresRunner = postgresrunner.Runner{ 26 Port: 5433 + GinkgoParallelNode(), 27 } 28 dbProcess = ifrit.Invoke(postgresRunner) 29 }) 30 31 var _ = BeforeEach(func() { 32 postgresRunner.CreateTestDB() 33 }) 34 35 var _ = AfterEach(func() { 36 postgresRunner.DropTestDB() 37 }) 38 39 var _ = AfterSuite(func() { 40 dbProcess.Signal(os.Interrupt) 41 Eventually(dbProcess.Wait(), 10*time.Second).Should(Receive()) 42 }) 43 44 var asset = packr.NewBox("./migrations").MustBytes