Skip to content

Commit f8d92dc

Browse files
committed
chore(CI): migrate tests to cft
1 parent 70a28a0 commit f8d92dc

File tree

6 files changed

+935
-15
lines changed

6 files changed

+935
-15
lines changed

.kitchen.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ suites:
6464
# systems:
6565
# - name: stub_domains_private
6666
# backend: local
67-
- name: "upstream_nameservers"
68-
transport:
69-
root_module_directory: test/fixtures/upstream_nameservers
70-
verifier:
71-
systems:
72-
- name: upstream_nameservers
73-
backend: local
7467
- name: "stub_domains_upstream_nameservers"
7568
transport:
7669
root_module_directory: test/fixtures/stub_domains_upstream_nameservers

build/int.cloudbuild.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,21 @@ steps:
215215
- verify stub-domains-local
216216
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
217217
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy stub-domains-local']
218-
- id: converge upstream-nameservers-local
218+
- id: apply upstream-nameservers-local
219219
waitFor:
220220
- create-all
221221
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
222-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge upstream-nameservers-local']
222+
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage apply --verbose --test-dir test/integration']
223223
- id: verify upstream-nameservers-local
224224
waitFor:
225-
- converge upstream-nameservers-local
225+
- apply upstream-nameservers-local
226226
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
227-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify upstream-nameservers-local']
227+
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage verify --verbose --test-dir test/integration']
228228
- id: destroy upstream-nameservers-local
229229
waitFor:
230230
- verify upstream-nameservers-local
231231
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
232-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy upstream-nameservers-local']
232+
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage destroy --verbose --test-dir test/integration']
233233
- id: converge stub-domains-upstream-nameservers-local
234234
waitFor:
235235
- create-all

test/fixtures/upstream_nameservers/example.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2018-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,6 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17+
locals {
18+
compute_engine_service_account = var.compute_engine_service_accounts[1]
19+
}
20+
1721
module "example" {
1822
source = "../../../examples/upstream_nameservers"
1923

@@ -24,6 +28,6 @@ module "example" {
2428
subnetwork = google_compute_subnetwork.main.name
2529
ip_range_pods = google_compute_subnetwork.main.secondary_ip_range[0].range_name
2630
ip_range_services = google_compute_subnetwork.main.secondary_ip_range[1].range_name
27-
compute_engine_service_account = var.compute_engine_service_accounts[1]
31+
compute_engine_service_account = local.compute_engine_service_account
2832
}
2933

test/fixtures/upstream_nameservers/outputs.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2018-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,3 +56,11 @@ output "service_account" {
5656
description = "The service account to default running nodes as if not overridden in `node_pools`."
5757
value = module.example.service_account
5858
}
59+
60+
output "random_string" {
61+
value = random_string.suffix.result
62+
}
63+
64+
output "compute_engine_service_account" {
65+
value = local.compute_engine_service_account
66+
}

0 commit comments

Comments
 (0)