Skip to content

Commit

Permalink
chore(CI): add new verify
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Aug 26, 2024
1 parent f67f416 commit 318577c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions examples/simple_autopilot_public/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module "gke" {
gcs_fuse_csi_driver = true
stateful_ha = false
gke_backup_agent_config = false
enable_gcfs = true
ray_operator_config = {
enabled = true
logging_enabled = true
Expand Down
12 changes: 4 additions & 8 deletions examples/simple_autopilot_public/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ module "gcp-network" {

subnets = [
{
subnet_name = local.subnet_name
subnet_ip = "10.0.0.0/17"
subnet_region = var.region
},
{
subnet_name = local.master_auth_subnetwork
subnet_ip = "10.60.0.0/17"
subnet_region = var.region
subnet_name = local.subnet_name
subnet_ip = "10.0.0.0/17"
subnet_region = var.region
subnet_private_access = true
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
"github.com/stretchr/testify/assert"
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/testutils"
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/utils"
)

func TestSimpleAutopilotPublic(t *testing.T) {
Expand All @@ -32,6 +33,8 @@ func TestSimpleAutopilotPublic(t *testing.T) {
bpt.DefineVerify(func(assert *assert.Assertions) {
//Skipping Default Verify as the Verify Stage fails due to change in Client Cert Token
// bpt.DefaultVerify(assert)
utils.TGKEVerify(t, bpt, assert)
bpt.DefaultVerify(assert)

projectId := bpt.GetStringOutput("project_id")
location := bpt.GetStringOutput("location")
Expand Down
19 changes: 19 additions & 0 deletions test/integration/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
package utils

import (
"slices"
"testing"
"time"

"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
tfjson "github.com/hashicorp/terraform-json"
"github.com/stretchr/testify/assert"
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/testutils"
)

Expand All @@ -32,3 +35,19 @@ func GetTestProjectFromSetup(t *testing.T, idx int) string {
}
return projectIDs[idx]
}

var (
// TGKEVerify Exempt Resources. e.g. google_container_cluster.primary
verifyExemptResources = []string{}
)

func TGKEVerify(t *testing.T, b *tft.TFBlueprintTest, assert *assert.Assertions) {
_, ps := b.PlanAndShow()
for _, r := range ps.ResourceChangesMap {
if slices.Contains(verifyExemptResources, r.Address) {
t.Logf("Exempt plan address: %s", r.Address)
continue
}
assert.Equal(tfjson.Actions{tfjson.ActionNoop}, r.Change.Actions, "plan must be no-op for resource: %s", r.Address)
}
}

0 comments on commit 318577c

Please sign in to comment.