-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_test.go
42 lines (33 loc) · 887 Bytes
/
main_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
package main_test
import (
"net"
"os"
"os/exec"
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("main", func() {
var result *Session
var unixAddress string = "/tmp/test.sock"
BeforeEach(func() {
result = runSigner("-network", "unix", "-laddr", unixAddress)
time.Sleep(10 * time.Millisecond)
})
AfterEach(func() {
os.Remove(unixAddress)
result.Kill()
})
It("Listens on the network and address supplied by argument", func() {
_, err := net.Dial("unix", unixAddress)
Expect(err).ToNot(HaveOccurred())
})
})
func runSigner(args ...string) *Session {
path, err := Build("github.com/cloudfoundry/blobstore_url_signer/")
Expect(err).NotTo(HaveOccurred())
session, err := Start(exec.Command(path, args...), GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())
return session
}