Skip to content

Commit 14e81ec

Browse files
committed
fix bootstrap test
1 parent 113ed63 commit 14e81ec

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

test/integration/bootstrap/bootstrap_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ func TestBootstrap(t *testing.T) {
147147
bootstrap.DefineVerify(
148148
func(assert *assert.Assertions) {
149149

150+
parentFolder := terraform.OutputMap(t, bootstrap.GetTFOptions(), "common_config")["parent_folder"]
151+
150152
// cloud build project
151153
cbProjectID := bootstrap.GetStringOutput("cloudbuild_project_id")
152154
artifactsBktName := terraform.OutputMap(t, bootstrap.GetTFOptions(), "gcs_bucket_cloudbuild_artifacts")
@@ -304,17 +306,17 @@ func TestBootstrap(t *testing.T) {
304306
assert.Subset(listRoles, sa.orgRoles, fmt.Sprintf("service account %s should have organization level roles", terraformSAEmail))
305307
}
306308
}
309+
// boolean organization policies
310+
for _, booleanConstraint := range []string{
311+
"constraints/compute.skipDefaultNetworkCreation",
312+
"constraints/iam.automaticIamGrantsForDefaultServiceAccounts",
313+
} {
314+
orgPolicy := gcloud.Runf(t, "resource-manager org-policies describe %s --folder %s", booleanConstraint, parentFolder)
315+
assert.True(orgPolicy.Get("booleanPolicy.enforced").Bool(), fmt.Sprintf("org policy %s should be enforced", booleanConstraint))
316+
}
307317
})
308318

309-
// boolean organization policies
310-
for _, booleanConstraint := range []string{
311-
"constraints/compute.skipDefaultNetworkCreation",
312-
"constraints/iam.disableServiceAccountKeyCreation",
313319

314-
} {
315-
orgPolicy := gcloud.Runf(t, "resource-manager org-policies describe %s --folder %s", booleanConstraint, parentFolder)
316-
assert.True(orgPolicy.Get("booleanPolicy.enforced").Bool(), fmt.Sprintf("org policy %s should be enforced", booleanConstraint))
317-
}
318320

319321
bootstrap.DefineTeardown(func(assert *assert.Assertions) {
320322
// configure options to pull state from GCS bucket

0 commit comments

Comments
 (0)