Skip to content

Commit

Permalink
Add stderr check
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Dec 26, 2024
1 parent 8cd53c2 commit 7f80898
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ jobs:
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev
with:
tf_path: tests/pass-message-delayed
stderr_contains: Unsuitable value for error message

- name: Initialize - Pass - Condition & Message Delayed
id: init-pass-condition-message-delayed
uses: Invicton-Labs/terraform-module-testing/initialize@dev
with:
tf_path: tests/pass-condition-message-delayed
- name: Run Tests - Pass - Condition & Message Delayed
id: tests-pass-condition-message-delayed
uses: Invicton-Labs/terraform-module-testing/apply-destroy@dev
with:
tf_path: tests/pass-condition-message-delayed

- name: Initialize - Fail
id: init-fail
Expand All @@ -81,6 +93,7 @@ jobs:
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev
with:
tf_path: tests/fail
stderr_contains: sample error

- name: Initialize - Fail (Output)
id: init-fail-output
Expand All @@ -92,6 +105,7 @@ jobs:
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev
with:
tf_path: tests/fail-output
stderr_contains: sample error

- name: Initialize - Fail - Condition Delayed
id: init-fail-condition-delayed
Expand All @@ -103,6 +117,7 @@ jobs:
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev
with:
tf_path: tests/fail-condition-delayed
stderr_contains: sample error

- name: Initialize - Fail - Message Delayed
id: init-fail-message-delayed
Expand All @@ -114,6 +129,19 @@ jobs:
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev
with:
tf_path: tests/fail-message-delayed
stderr_contains: Unsuitable value for error message

- name: Initialize - Fail - Condition & Message Delayed
id: init-fail-condition-message-delayed
uses: Invicton-Labs/terraform-module-testing/initialize@dev
with:
tf_path: tests/fail-condition-message-delayed
- name: Run Tests - Fail - Condition & Message Delayed
id: tests-fail-condition-message-delayed
uses: Invicton-Labs/terraform-module-testing/apply-failure@dev
with:
tf_path: tests/fail-condition-message-delayed
stderr_contains: sample error

# This job just waits for all other jobs to pass. We have it here
# so our branch protection rule can reference a single job, instead
Expand Down
7 changes: 7 additions & 0 deletions tests/fail-condition-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "fail" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() == ""
// Use a message that isn't known until the apply step
error_message = "sample error: ${uuid()}"
}
6 changes: 3 additions & 3 deletions tests/fail-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "fail" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() == ""
source = "../../"
condition = false
// Use a message that isn't known until the apply step
error_message = "sample error: ${uuid()}"
}
7 changes: 7 additions & 0 deletions tests/pass-condition-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "pass" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() != ""
// Use a message that isn't known until the apply step
error_message = "sample error: ${uuid()}"
}
6 changes: 3 additions & 3 deletions tests/pass-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "pass" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() != ""
source = "../../"
condition = true
// Use a message that isn't known until the apply step
error_message = "sample error: ${uuid()}"
}

0 comments on commit 7f80898

Please sign in to comment.