/
worker.go
59 lines (49 loc) · 1.82 KB
/
worker.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
package windows
import (
"fmt"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
. "github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets"
logshelper "github.com/cloudfoundry/cf-acceptance-tests/helpers/logs"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
)
var _ = WindowsDescribe("apps without a port", func() {
var (
appName string
logs *Session
)
BeforeEach(func() {
workerPath, err := BuildWithEnvironment(filepath.Join(assets.NewAssets().WindowsWorker, "worker.go"),
[]string{"GOARCH=amd64", "GOOS=windows"})
Expect(err).NotTo(HaveOccurred())
appName = random_name.CATSRandomName("APP")
Expect(cf.Cf("push", appName,
"--no-route",
"--no-start",
"-p", filepath.Dir(workerPath),
"-c", fmt.Sprintf(".\\%s", filepath.Base(workerPath)),
"-u", "none",
"-b", Config.GetBinaryBuildpackName(),
"-s", Config.GetWindowsStack()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
logs = logshelper.TailFollow(Config.GetUseLogCache(), appName)
Expect(cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
})
AfterEach(func() {
app_helpers.AppReport(appName)
Expect(cf.Cf("delete", appName, "-f", "-r").Wait()).Should(Exit(0))
CleanupBuildArtifacts()
})
It("runs the app (and doesn't run healthcheck)", func() {
// check that the app keeps running
// by checking we see incrementing integers in the logs
Eventually(logs.Out).Should(Say(`Running Worker \d`))
Eventually(logs.Out).Should(Say(`Running Worker \d{2}`))
Expect(logs.Out).ToNot(Say("healthcheck"))
})
})