-
Notifications
You must be signed in to change notification settings - Fork 347
Expand file tree
/
Copy pathinit_test.go
More file actions
89 lines (73 loc) · 2.85 KB
/
init_test.go
File metadata and controls
89 lines (73 loc) · 2.85 KB
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
package integration_test
import (
"flag"
"os"
"path/filepath"
"testing"
"time"
"github.com/cloudfoundry/switchblade"
"github.com/onsi/gomega/format"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
. "github.com/onsi/gomega"
)
var settings struct {
Buildpack struct {
Version string
Path string
}
Cached bool
Serial bool
KeepFailedContainers bool
FixturesPath string
GitHubToken string
Platform string
Stack string
}
func init() {
flag.BoolVar(&settings.Cached, "cached", false, "run cached buildpack tests")
flag.BoolVar(&settings.Serial, "serial", false, "run serial buildpack tests")
flag.BoolVar(&settings.KeepFailedContainers, "keep-failed-containers", false, "preserve failed test containers for debugging")
flag.StringVar(&settings.Platform, "platform", "cf", `switchblade platform to test against ("cf" or "docker")`)
flag.StringVar(&settings.GitHubToken, "github-token", "", "use the token to make GitHub API requests")
flag.StringVar(&settings.Stack, "stack", "cflinuxfs4", "stack to use as default when pusing apps")
}
func TestIntegration(t *testing.T) {
var Expect = NewWithT(t).Expect
format.MaxLength = 0
SetDefaultEventuallyTimeout(10 * time.Second)
root, err := filepath.Abs("./../../..")
Expect(err).NotTo(HaveOccurred())
fixtures := filepath.Join(root, "fixtures")
platform, err := switchblade.NewPlatform(settings.Platform, settings.GitHubToken, settings.Stack)
Expect(err).NotTo(HaveOccurred())
err = platform.Initialize(
switchblade.Buildpack{
Name: "php_buildpack",
URI: os.Getenv("BUILDPACK_FILE"),
},
)
Expect(err).NotTo(HaveOccurred())
// Dynatrace mock server temporarily disabled - not needed for basic extension tests
// dynatraceName, err := switchblade.RandomName()
// Expect(err).NotTo(HaveOccurred())
// dynatraceDeployment, _, err := platform.Deploy.
// WithBuildpacks("go_buildpack").
// Execute(dynatraceName, filepath.Join(fixtures, "util", "dynatrace"))
// Expect(err).NotTo(HaveOccurred())
suite := spec.New("integration", spec.Report(report.Terminal{}), spec.Parallel())
suite("Default", testDefault(platform, fixtures))
suite("Modules", testModules(platform, fixtures))
suite("Composer", testComposer(platform, fixtures))
suite("WebServers", testWebServers(platform, fixtures))
suite("AppFrameworks", testAppFrameworks(platform, fixtures))
suite("Placeholders", testPlaceholders(platform, fixtures))
// suite("BuildpackPythonExtension", testPythonExtension(platform, fixtures)) // Skipped for now
// suite("APMs", testAPMs(platform, fixtures, dynatraceDeployment.InternalURL)) // Needs dynatrace mock
if settings.Cached {
suite("Offline", testOffline(platform, fixtures))
}
suite.Run(t)
Expect(os.Remove(os.Getenv("BUILDPACK_FILE"))).To(Succeed())
Expect(platform.Deinitialize()).To(Succeed())
}