forked from cloudfoundry/cf-acceptance-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cats_suite_test.go
101 lines (79 loc) · 4.25 KB
/
cats_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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package cats_test
import (
"fmt"
"os"
"os/exec"
"testing"
"time"
. "github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers"
_ "github.com/cloudfoundry/cf-acceptance-tests/apps"
_ "github.com/cloudfoundry/cf-acceptance-tests/backend_compatibility"
_ "github.com/cloudfoundry/cf-acceptance-tests/detect"
_ "github.com/cloudfoundry/cf-acceptance-tests/docker"
_ "github.com/cloudfoundry/cf-acceptance-tests/internet_dependent"
_ "github.com/cloudfoundry/cf-acceptance-tests/isolation_segments"
_ "github.com/cloudfoundry/cf-acceptance-tests/route_services"
_ "github.com/cloudfoundry/cf-acceptance-tests/routing"
_ "github.com/cloudfoundry/cf-acceptance-tests/security_groups"
_ "github.com/cloudfoundry/cf-acceptance-tests/services"
_ "github.com/cloudfoundry/cf-acceptance-tests/ssh"
_ "github.com/cloudfoundry/cf-acceptance-tests/tasks"
_ "github.com/cloudfoundry/cf-acceptance-tests/v3"
"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
"github.com/cloudfoundry-incubator/cf-test-helpers/workflowhelpers"
. "github.com/cloudfoundry/cf-acceptance-tests/helpers/buildpacks"
. "github.com/cloudfoundry/cf-acceptance-tests/helpers/cli_version_check"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/config"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const minCliVersion = "6.16.1"
func TestCATS(t *testing.T) {
RegisterFailHandler(Fail)
var validationError error
Config, validationError = config.NewCatsConfig(os.Getenv("CONFIG"))
var _ = SynchronizedBeforeSuite(func() []byte {
installedVersion, err := GetInstalledCliVersionString()
Expect(err).ToNot(HaveOccurred(), "Error trying to determine CF CLI version")
fmt.Println("Running CATs with CF CLI version ", installedVersion)
Expect(ParseRawCliVersionString(installedVersion).AtLeast(ParseRawCliVersionString(minCliVersion))).To(BeTrue(), "CLI version "+minCliVersion+" is required")
return []byte{}
}, func([]byte) {
var err error
if validationError != nil {
fmt.Println("Invalid configuration. ")
fmt.Println(validationError)
Fail("Please fix the contents of $CONFIG:\n " + os.Getenv("CONFIG") + "\nbefore proceeding.")
}
TestSetup = workflowhelpers.NewTestSuiteSetup(Config)
if Config.GetIncludeSsh() {
ScpPath, err = exec.LookPath("scp")
Expect(err).NotTo(HaveOccurred())
SftpPath, err = exec.LookPath("sftp")
Expect(err).NotTo(HaveOccurred())
}
workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.GetScaledTimeout(1*time.Minute), func() {
buildpacks, err := GetBuildpacks()
Expect(err).ToNot(HaveOccurred(), "Error getting buildpacks")
Expect(buildpacks).To(ContainSubstring(Config.GetBinaryBuildpackName()), "Missing the binary buildpack specified in the integration_config.json. There may be other missing buildpacks as well; please double-check your configuration against the buildpacks listed below.")
Expect(buildpacks).To(ContainSubstring(Config.GetGoBuildpackName()), "Missing the go buildpack specified in the integration_config.json. There may be other missing buildpacks as well; please double-check your configuration against the buildpacks listed below.")
Expect(buildpacks).To(ContainSubstring(Config.GetJavaBuildpackName()), "Missing the java buildpack specified in the integration_config.json. There may be other missing buildpacks as well; please double-check your configuration against the buildpacks listed below.")
Expect(buildpacks).To(ContainSubstring(Config.GetNodejsBuildpackName()), "Missing the NodeJS buildpack specified in the integration_config.json. There may be other missing buildpacks as well; please double-check your configuration against the buildpacks listed below.")
Expect(buildpacks).To(ContainSubstring(Config.GetRubyBuildpackName()), "Missing the ruby buildpack specified in the integration_config.json. There may be other missing buildpacks as well; please double-check your configuration against the buildpacks listed below.")
})
TestSetup.Setup()
})
AfterSuite(func() {
if TestSetup != nil {
TestSetup.Teardown()
}
})
rs := []Reporter{}
if validationError == nil {
if Config.GetArtifactsDirectory() != "" {
helpers.EnableCFTrace(Config, "CATS")
rs = append(rs, helpers.NewJUnitReporter(Config, "CATS"))
}
}
RunSpecsWithDefaultAndCustomReporters(t, "CATS", rs)
}