-
Notifications
You must be signed in to change notification settings - Fork 3
/
suite_test.go
65 lines (53 loc) · 1.25 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
package main_test
import (
"encoding/json"
"os"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"testing"
)
var checkPath string
var inPath string
var outPath string
type suiteData struct {
CheckPath string
InPath string
OutPath string
}
var _ = SynchronizedBeforeSuite(func() []byte {
gp, err := gexec.Build("github.com/redfactorlabs/concourse-smuggler-resource")
Ω(err).ShouldNot(HaveOccurred())
gpDir := filepath.Dir(gp)
cp := filepath.Join(gpDir, "check")
os.Symlink(gp, cp)
Ω(err).ShouldNot(HaveOccurred())
ip := filepath.Join(gpDir, "in")
os.Symlink(gp, ip)
Ω(err).ShouldNot(HaveOccurred())
op := filepath.Join(gpDir, "out")
os.Symlink(gp, op)
Ω(err).ShouldNot(HaveOccurred())
data, err := json.Marshal(suiteData{
CheckPath: cp,
InPath: ip,
OutPath: op,
})
Ω(err).ShouldNot(HaveOccurred())
return data
}, func(data []byte) {
var sd suiteData
err := json.Unmarshal(data, &sd)
Ω(err).ShouldNot(HaveOccurred())
checkPath = sd.CheckPath
inPath = sd.InPath
outPath = sd.OutPath
})
var _ = SynchronizedAfterSuite(func() {}, func() {
gexec.CleanupBuildArtifacts()
})
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Commands Suite")
}