Adding the GCP examples to our CI runs
MODIFY
.travis.yml
.travis.yml
@@ -4,6 +4,9 @@ go: 1.12.x
sudo: true # give us 7.5GB and >2 bursted cores.
git:
depth: false
+cache:
+ directories:
+ - $HOME/google-cloud-sdk/
before_install:
- git clone https://github.com/pulumi/scripts ${GOPATH}/src/github.com/pulumi/scripts
- source ${GOPATH}/src/github.com/pulumi/scripts/ci/prepare-environment.sh

MODIFY
gcp-py-instance-nginx/__main__.py
gcp-py-instance-nginx/__main__.py
@@ -14,6 +14,10 @@ firewall = compute.Firewall(
{
"protocol": "tcp",
"ports": ["22"]
+ },
+ {
+ "protocol": "tcp",
+ "ports": ["80"]
}
]
)

MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -601,6 +601,106 @@ func TestExamples(t *testing.T) {
})
},
}),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-js-webserver"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ endpoint := stack.Outputs["instanceIP"].(string)
+ assertHTTPResult(t, endpoint, func(body string) bool {
+ return assert.Contains(t, body, "Hello, World!")
+ })
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-py-functions"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-py-gke"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ "password": "S4cretPassword!",
+ "node_count": "3",
+ "node_machine_type": "n1-standard-2",
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-py-instance-nginx"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ endpoint := stack.Outputs["external_ip"].(string)
+ assertHTTPResult(t, endpoint, func(body string) bool {
+ return assert.Contains(t, body, "Test Page for the Nginx HTTP Server on Fedora")
+ })
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-ts-functions"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ endpoint := stack.Outputs["url"].(string)
+ assertHTTPResult(t, endpoint, func(body string) bool {
+ return assert.Contains(t, body, "Greetings from Google Cloud Functions!")
+ })
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-ts-gke"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ "password": "S4cretPassword123!",
+ "nodeCount": "3",
+ "nodeMachineType": "n1-standard-2",
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-ts-gke-hello-world"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ endpoint := stack.Outputs["servicePublicIP"].(string)
+ assertHTTPResult(t, endpoint, func(body string) bool {
+ return assert.Contains(t, body, "Welcome to nginx")
+ })
+ },
+ }),
+ // gcp-ts-k8s-ruby-on-rails-postgresql we need to think about what we do with dockerhub password
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-ts-serverless-raw"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
+ endpoint := stack.Outputs["goEndpoint"].(string)
+ assertHTTPResult(t, endpoint, func(body string) bool {
+ return assert.Contains(t, body, "Hello World!")
+ })
+ },
+ }),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "gcp-ts-slackbot"),
+ Config: map[string]string{
+ "gcp:project": "pulumi-ci-gcp-provider",
+ "gcp:zone": "us-central1-a",
+ },
+ }),
}
longTests := []integration.ProgramTestOptions{

Adding the GCP examples to our CI runs