Skip to content

Commit

Permalink
chore: Convert tests to blueprint test framework (#710)
Browse files Browse the repository at this point in the history
* bootstrap go test

* fix lint

* add env var for missing input values

* add sleep after test setup for enabling api propagation

* increase sleep time to 3 minutes

* fix test assertion

* replicate env vars form converge to verify stage.

* fix type.

* skip default verify

* replicate env vars form converge to destroy stage.

* bump CFT version and update test

* update go.mod file

* add org test

* add org test asserts

* fix test

* disable backend bucket

* fix domains to allow env var name

* fix domains to allow value

* add domains to allow to setup output

* add go envs tests

* fix typo

* add tests for network, projects and app-infra

* disable auto.tfvars files and set access_context_manager_policy_id

* wait for four minutes for api propagation

* add target_name_server_addresses to setup output

* update list of terraform files to disable

* add access_context_manager_policy_id to env vars of step 4 projects

* add export to export of previous terraform script outputs

* read perimeter name from env var

* fix helper script

* source script to export variables

* export env var for the create stage of step 4 projects

* remove DefaultVerify from step 4 projects

* fix typo

* add plugin version configuration for step 5

* set instance details to sensitive in step 5

* read service account from env var in step 5

* add shared network step to integration tests

* export access context manager policy id for network shared step

* fix lint issues

* remove kitchem and inspec code

* fix default region configuration in the tests

* read step 3-networks output in the test execution of step 4-projects

* use gcloud to get the value of the access context manager policy ID

* remove access_context_manager_policy_id from projects/shared

* delete export_vars.sh script

* add instructions and use cft cli

* test new order of params

* add test-dir to the call to cft test in cloud buil bootstrap

* restore usage of go test to run the integration steps

* test HubAndSpoke

* restore values for test organization

* remove commented code

* fix lint build configuration

* use cft cli to run tests in the build

* remove replicated code from org test

* remove unnecessary struct from network test

* fix code review items

* restore ci project name

* restore call to helper function

* restore all calls to helper function in int build

* add missing call to helper function at app infra destroy stage

* add app infra tests

* migrate gcp tests for the step 4-projects

* migrate gcloud tests for the step 4-projects

* use gcloud.Runf if possible

* simplify usage of gcloud methods

* update go.mod

* migrate 3-networks tests

* fix variable names

* migrate 3 shared tests

* migrate tests

* fix subset assert

* fix folder output value to remove 'folders/'

* remove unnused test attribute for perimeter env var

* fix access to last element of slice

* update list of boolean org policies

* fix reading directory customer ID value

* add roles/resourcemanager.organizationViewe to the ci service account

* skip restrictedDomain verify

* fix log sink tests, log bucket test, and hub and spoke tests

* fix typo in env test

* fix retrieval of monitoring_workspace_users group

* fix assert.Contains base list

* add restrictedDomain verification

* fix cidrRange for shared test

* fix monitoring_workspace_users output for testing

* fix cloud router region in 3-networks/shared

* fix lint issue

* fix firewall tests

* get the len of the allowed ports array in the network test

* fix step 4 iam tests

* fix project iam test for base_shared_vpc_project

* fix param for search of vpc host project id

* fix param for search of restricted vpc host project id

* increase provider request timeout to prevente dns policy error 409:The resource 'entity.policy' named 'default-policy' already exists

* increase provider request timeout to 120s prevent dns policy error 409:The resource 'entity.policy' named 'default-policy' already exists

* use helper function to create list of strings

* remove initialization of string field with empty string

* remove monitoring_workspace_users from 2-environments output

* use Runf when passing a single parameter

* remove task_helper_functions script from integration build

* set TF_VAR_group_email as a global env var in integration build yaml

* use proper service account in step 5-app-infra
  • Loading branch information
daniel-cit authored May 11, 2022
1 parent 164e45b commit f2d7bc8
Show file tree
Hide file tree
Showing 72 changed files with 3,183 additions and 4,364 deletions.
125 changes: 0 additions & 125 deletions .kitchen.yml

This file was deleted.

4 changes: 2 additions & 2 deletions 3-networks/envs/development/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ locals {
*****************************************/
provider "google" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}

provider "google-beta" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}
4 changes: 2 additions & 2 deletions 3-networks/envs/non-production/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ locals {
*****************************************/
provider "google" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}

provider "google-beta" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}
4 changes: 2 additions & 2 deletions 3-networks/envs/production/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ locals {
*****************************************/
provider "google" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}

provider "google-beta" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}
4 changes: 2 additions & 2 deletions 3-networks/envs/shared/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ locals {
*****************************************/
provider "google" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}

provider "google-beta" {
impersonate_service_account = local.tf_sa
request_timeout = "60s"
request_timeout = "120s"
}
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/development/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ output "instances_zones" {
output "instances_details" {
description = "List of details for compute instances"
value = module.base_shared_gce_instance.instances_details
sensitive = true
}

output "available_zones" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2021 Google LLC
* Copyright 2022 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,7 +14,30 @@
* limitations under the License.
*/

output "dns_hub_project_id" {
value = module.shared.dns_hub_project_id
description = "The DNS hub project ID"
terraform {
required_version = ">= 0.13"

required_providers {

google = {
source = "hashicorp/google"
version = "~> 3.77"
}

google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.77"
}

null = {
source = "hashicorp/null"
version = "~> 2.1"
}

random = {
source = "hashicorp/random"
version = "~> 2.3"
}

}
}
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/non-production/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ output "instances_zones" {
output "instances_details" {
description = "List of details for compute instances"
value = module.base_shared_gce_instance.instances_details
sensitive = true
}

output "available_zones" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2021 Google LLC
* Copyright 2022 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,14 +14,30 @@
* limitations under the License.
*/

module "bootstrap" {
source = "../../../0-bootstrap"
parent_folder = var.parent_folder
org_id = var.org_id
group_org_admins = var.group_email
group_billing_admins = var.group_email
billing_account = var.billing_account
org_project_creators = var.org_project_creators
project_prefix = var.project_prefix
bucket_prefix = var.bucket_prefix
terraform {
required_version = ">= 0.13"

required_providers {

google = {
source = "hashicorp/google"
version = "~> 3.77"
}

google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.77"
}

null = {
source = "hashicorp/null"
version = "~> 2.1"
}

random = {
source = "hashicorp/random"
version = "~> 2.3"
}

}
}
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/production/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ output "instances_zones" {
output "instances_details" {
description = "List of details for compute instances"
value = module.base_shared_gce_instance.instances_details
sensitive = true
}

output "available_zones" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2021 Google LLC
* Copyright 2022 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,23 +14,30 @@
* limitations under the License.
*/

variable "terraform_service_account" {
description = "The SA that will be used for creating projects."
}
terraform {
required_version = ">= 0.13"

variable "folder_prefix" {
description = "Name prefix to use for folders created."
type = string
default = "fldr"
}
required_providers {

variable "parent_folder" {
description = "Optional - if using a folder for testing."
type = string
default = ""
}
google = {
source = "hashicorp/google"
version = "~> 3.77"
}

google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.77"
}

null = {
source = "hashicorp/null"
version = "~> 2.1"
}

random = {
source = "hashicorp/random"
version = "~> 2.3"
}

variable "org_id" {
description = "The organization id for the associated services"
type = string
}
}
Loading

0 comments on commit f2d7bc8

Please sign in to comment.