-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathstarter_suite_test.go
More file actions
37 lines (28 loc) · 950 Bytes
/
starter_suite_test.go
File metadata and controls
37 lines (28 loc) · 950 Bytes
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
package main_test
import (
"github.com/cloud66-oss/starter/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os/exec"
"testing"
"time"
)
var binPath string = "./starter"
func TestStarter(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Starter Suite")
}
var _ = BeforeSuite(func() {
current_date := time.Now().Format("2006-01-02")
err := exec.Command("go", "build", "-ldflags", "-X \"main.VERSION=test\" -X \"main.BUILDDATE="+current_date+"\"").Run()
Expect(err).NotTo(HaveOccurred())
Expect(common.FileExists(binPath)).To(BeTrue())
err = exec.Command(binPath, "-daemon", "-templates", "templates").Start()
// daemon takes time to start up - works fine without waiting in a Docker container, but codeship needs some time to start it
time.Sleep(5 * time.Second)
Expect(err).NotTo(HaveOccurred())
})
var _ = AfterSuite(func() {
err := exec.Command("rm", binPath).Run()
Expect(err).NotTo(HaveOccurred())
})