Skip to content

Commit 08702b6

Browse files
Add tasks to run test suites on Concourse
Currently, the test suites take an exorbitant amount of time to run. Since there are eight different test suites, parallelizing the ability to run them should save developers considerable time when testing changes. This commit adds a make target to be able to run all eight test suites simultaneously on Concourse.
1 parent 567c586 commit 08702b6

16 files changed

+297
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ credentials.json
5050

5151
# File to populate env vars used by Docker test runs
5252
.envrc
53+
54+
.concourse

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
1212
* Add `remove_default_node_pool` set to `false` by default #15
1313
* Allow arbitrary key-value pairs to be set on node pool metadata. #52
1414
* Add `initial_node_count` parameter to node_pool block. #60
15+
* Fix issue with regional cluster roll outs causing version skews #108
1516

1617
## [v0.4.0] - 2018-12-19
1718
### Added

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ check_headers:
7676
test_integration:
7777
test/ci_integration.sh
7878

79+
.PHONY: test_integration_concourse
80+
test_integration_concourse:
81+
test/ci_integration_concourse.sh
82+
7983
.PHONY: generate_docs
8084
generate_docs:
8185
@source test/make.sh && generate_docs

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ The test-kitchen instances in `test/fixtures/` wrap identically-named examples i
264264

265265
Alternatively, you can simply run `make test_integration_docker` to run all the test steps non-interactively.
266266

267+
If you wish to parallelize running the test suites, it is also possible to offload the work onto Concourse to run each test suite for you using the command `make test_integration_concourse`. The `.concourse` directory will be created and contain all of the logs from the running test suites.
268+
267269
#### Test configuration
268270

269271
Each test-kitchen instance is configured with a `variables.tfvars` file in the test fixture directory, e.g. `test/fixtures/node_pool/terraform.tfvars`.

autogen/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ The test-kitchen instances in `test/fixtures/` wrap identically-named examples i
275275

276276
Alternatively, you can simply run `make test_integration_docker` to run all the test steps non-interactively.
277277

278+
If you wish to parallelize running the test suites, it is also possible to offload the work onto Concourse to run each test suite for you using the command `make test_integration_concourse`. The `.concourse` directory will be created and contain all of the logs from the running test suites.
279+
278280
#### Test configuration
279281

280282
Each test-kitchen instance is configured with a `variables.tfvars` file in the test fixture directory, e.g. `test/fixtures/node_pool/terraform.tfvars`.

autogen/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ data "google_container_engine_versions" "region" {
157157
}
158158

159159
data "google_container_engine_versions" "zone" {
160-
provider = "google-beta"
161160
// Work around to prevent a lack of zone declaration from causing regional cluster creation from erroring out due to error
162161
//
163162
// data.google_container_engine_versions.zone: Cannot determine zone: set in this resource, or set provider-level zone.

modules/private-cluster/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ The test-kitchen instances in `test/fixtures/` wrap identically-named examples i
270270

271271
Alternatively, you can simply run `make test_integration_docker` to run all the test steps non-interactively.
272272

273+
If you wish to parallelize running the test suites, it is also possible to offload the work onto Concourse to run each test suite for you using the command `make test_integration_concourse`. The `.concourse` directory will be created and contain all of the logs from the running test suites.
274+
273275
#### Test configuration
274276

275277
Each test-kitchen instance is configured with a `variables.tfvars` file in the test fixture directory, e.g. `test/fixtures/node_pool/terraform.tfvars`.
@@ -323,4 +325,4 @@ are as follows:
323325
is a compiled language so there is no standard linter.
324326
* Terraform - terraform has a built-in linter in the 'terraform validate'
325327
command.
326-
* Dockerfiles - hadolint. Can be found in homebrew
328+
* Dockerfiles - hadolint. Can be found in homebrew
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: deploy-service-local

test/ci/tasks/node-pool-local.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: node-pool-local

test/ci/tasks/shared-vpc-local.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: shared-vpc-local
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: simple-regional-local
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: simple-regional-private-local

test/ci/tasks/simple-zonal-local.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: simple-zonal-local
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: simple-zonal-private-local

test/ci/tasks/stub-domains-local.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
platform: linux
2+
3+
image_resource:
4+
type: docker-image
5+
source:
6+
repository: gcr.io/cloud-foundation-cicd/cft/kitchen-terraform_terraform-google-kubernetes-engine
7+
tag: f6b7f4ec0a865371531657731b6d52673a0bcd64
8+
username: _json_key
9+
password: |-
10+
<INSERT_KEY_JSON>
11+
12+
inputs:
13+
- name: terraform-google-kubernetes-engine
14+
15+
caches:
16+
- path: terraform-google-kubernetes-engine
17+
18+
run:
19+
path: bash
20+
args: ["-c", "./test/ci_integration.sh"]
21+
dir: terraform-google-kubernetes-engine
22+
23+
params:
24+
COMPUTE_ENGINE_SERVICE_ACCOUNT: COMPUTE_ENGINE_SERVICE_ACCOUNT
25+
PROJECT_ID: PROJECT_ID
26+
REGION: REGION
27+
ZONES: ZONES
28+
SERVICE_ACCOUNT_JSON: SERVICE_ACCOUNT_JSON
29+
CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE
30+
GOOGLE_APPLICATION_CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS
31+
SUITE: stub-domains-local

test/ci_integration_concourse.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#! /usr/bin/env bash
2+
3+
# Copyright 2018 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eou
18+
19+
run_pipelines() {
20+
if [[ ! -d .concourse/logs ]]; then
21+
mkdir -p .concourse/logs
22+
fi
23+
24+
for file in test/ci/tasks/*; do
25+
tmp="$(mktemp -d)"
26+
awk -v input="${SERVICE_ACCOUNT_JSON}" 'NR == 1, /<INSERT_KEY_JSON>/ { sub(/<INSERT_KEY_JSON>/, input) } 1' "${file}" | sed '11,49s/^/ /' | tee "${tmp}/$(basename "${file}")"
27+
fly -t cft execute -c "${tmp}/$(basename "${file}")" >.concourse/logs/"$(basename "${file%.yml}").log" 2>&1 &
28+
done
29+
}
30+
31+
main() {
32+
run_pipelines
33+
}
34+
35+
main "$@"

0 commit comments

Comments
 (0)