Skip to content

Commit

Permalink
chore(CI): migrate tests to cft
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Jan 8, 2025
1 parent 70a28a0 commit f8d92dc
Show file tree
Hide file tree
Showing 6 changed files with 935 additions and 15 deletions.
7 changes: 0 additions & 7 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ suites:
# systems:
# - name: stub_domains_private
# backend: local
- name: "upstream_nameservers"
transport:
root_module_directory: test/fixtures/upstream_nameservers
verifier:
systems:
- name: upstream_nameservers
backend: local
- name: "stub_domains_upstream_nameservers"
transport:
root_module_directory: test/fixtures/stub_domains_upstream_nameservers
Expand Down
10 changes: 5 additions & 5 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,21 @@ steps:
- verify stub-domains-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy stub-domains-local']
- id: converge upstream-nameservers-local
- id: apply upstream-nameservers-local
waitFor:
- create-all
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge upstream-nameservers-local']
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage apply --verbose --test-dir test/integration']
- id: verify upstream-nameservers-local
waitFor:
- converge upstream-nameservers-local
- apply upstream-nameservers-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify upstream-nameservers-local']
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage verify --verbose --test-dir test/integration']
- id: destroy upstream-nameservers-local
waitFor:
- verify upstream-nameservers-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy upstream-nameservers-local']
args: ['/bin/bash', '-c', 'cft test run TestUpstreamNameservers --stage destroy --verbose --test-dir test/integration']
- id: converge stub-domains-upstream-nameservers-local
waitFor:
- create-all
Expand Down
8 changes: 6 additions & 2 deletions test/fixtures/upstream_nameservers/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,10 @@
* limitations under the License.
*/

locals {
compute_engine_service_account = var.compute_engine_service_accounts[1]
}

module "example" {
source = "../../../examples/upstream_nameservers"

Expand All @@ -24,6 +28,6 @@ module "example" {
subnetwork = google_compute_subnetwork.main.name
ip_range_pods = google_compute_subnetwork.main.secondary_ip_range[0].range_name
ip_range_services = google_compute_subnetwork.main.secondary_ip_range[1].range_name
compute_engine_service_account = var.compute_engine_service_accounts[1]
compute_engine_service_account = local.compute_engine_service_account
}

10 changes: 9 additions & 1 deletion test/fixtures/upstream_nameservers/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,3 +56,11 @@ output "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`."
value = module.example.service_account
}

output "random_string" {
value = random_string.suffix.result
}

output "compute_engine_service_account" {
value = local.compute_engine_service_account
}
Loading

0 comments on commit f8d92dc

Please sign in to comment.