This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
suite_test.go
68 lines (56 loc) · 1.55 KB
/
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
59
60
61
62
63
64
65
66
67
68
package resource_test
import (
"encoding/json"
"os"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var bins struct {
In string `json:"in"`
Out string `json:"out"`
Check string `json:"check"`
}
var (
githubURI = os.Getenv("ROMVER_TESTING_GITHUB_URI")
githubBranch = os.Getenv("ROMVER_TESTING_GITHUB_BRANCH")
githubUsername = os.Getenv("ROMVER_TESTING_GITHUB_USERNAME")
githubPassword = os.Getenv("ROMVER_TESTING_GITHUB_PASSWORD")
)
var _ = SynchronizedBeforeSuite(func() []byte {
var err error
b := bins
if _, err := os.Stat("/opt/resource/in"); err != nil {
b.In, err = gexec.Build("github.com/cappyzawa/romver-resource/cmd/in")
Expect(err).NotTo(HaveOccurred())
} else {
b.In = "/opt/resource/in"
}
if _, err := os.Stat("/opt/resource/out"); err != nil {
b.Out, err = gexec.Build("github.com/cappyzawa/romver-resource/cmd/out")
Expect(err).NotTo(HaveOccurred())
} else {
b.Out = "/opt/resource/out"
}
if _, err := os.Stat("/opt/resource/check"); err != nil {
b.Check, err = gexec.Build("github.com/cappyzawa/romver-resource/cmd/check")
Expect(err).NotTo(HaveOccurred())
} else {
b.Check = "/opt/resource/check"
}
j, err := json.Marshal(b)
Expect(err).ToNot(HaveOccurred())
return j
}, func(bp []byte) {
err := json.Unmarshal(bp, &bins)
Expect(err).ToNot(HaveOccurred())
})
var _ = SynchronizedAfterSuite(func() {
}, func() {
gexec.CleanupBuildArtifacts()
})
func TestRomverResource(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "RomverResource Suite")
}