Skip to content

Commit 43363b4

Browse files
authored
fix: do not run build run if builds are not passed in (#209)
1 parent 3519489 commit 43363b4

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

solutions/project/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module "build" {
9191

9292
resource "terraform_data" "run_build" {
9393
depends_on = [module.build]
94+
count = length(local.updated_builds) > 0 ? 1 : 0
9495

9596
provisioner "local-exec" {
9697
interpreter = ["/bin/bash", "-c"]

tests/pr_test.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ func TestUpgradeCEProjectDA(t *testing.T) {
190190
t.Parallel()
191191

192192
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
193-
Testing: t,
194-
TerraformDir: projectSolutionsDir,
195-
Prefix: "ce-da",
193+
Testing: t,
194+
TerraformDir: projectSolutionsDir,
195+
Prefix: "ce-da",
196+
CheckApplyResultForUpgrade: true,
196197
})
197198

198199
options.TerraformVars = map[string]interface{}{
@@ -365,3 +366,25 @@ func writeTfvarsFile(t *testing.T, path string, vars map[string]interface{}) err
365366
}
366367
return err
367368
}
369+
370+
// test edge case when only empty project is created
371+
func TestCEProjectDABasic(t *testing.T) {
372+
t.Parallel()
373+
374+
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
375+
Testing: t,
376+
TerraformDir: projectSolutionsDir,
377+
Prefix: "ce-da-empty",
378+
})
379+
380+
options.TerraformVars = map[string]interface{}{
381+
"existing_resource_group_name": resourceGroup,
382+
"provider_visibility": "public",
383+
"prefix": options.Prefix,
384+
"project_name": "proj-test",
385+
}
386+
387+
output, err := options.RunTestConsistency()
388+
assert.Nil(t, err, "This should not have errored")
389+
assert.NotNil(t, output, "Expected some output")
390+
}

0 commit comments

Comments
 (0)