Skip to content

Commit

Permalink
Add delayed message tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Dec 25, 2024
1 parent c0c4704 commit 1b73731
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,27 @@ jobs:
with:
tf_path: tests/pass-output

- name: Initialize - Pass - Delayed
id: init-pass-delayed
- name: Initialize - Pass - Condition Delayed
id: init-pass-condition-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-delayed
- name: Run Tests - Pass - Delayed
id: tests-pass-delayed
tf_path: tests/pass-condition-delayed
- name: Run Tests - Pass - Condition Delayed
id: tests-pass-condition-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-delayed
tf_path: tests/pass-condition-delayed

- name: Initialize - Pass - Message Delayed
id: init-pass-message-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-message-delayed
- name: Run Tests - Pass - Message Delayed
id: tests-pass-message-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-message-delayed

- name: Initialize - Fail
id: init-fail
Expand All @@ -82,16 +93,27 @@ jobs:
with:
tf_path: tests/fail-output

- name: Initialize - Fail - Delayed
id: init-fail-delayed
- name: Initialize - Fail - Condition Delayed
id: init-fail-condition-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-condition-delayed
- name: Run Tests - Fail - Condition Delayed
id: tests-fail-condition-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-condition-delayed

- name: Initialize - Fail - Message Delayed
id: init-fail-message-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-delayed
- name: Run Tests - Fail - Delayed
id: tests-fail-delayed
tf_path: tests/fail-message-delayed
- name: Run Tests - Fail - Message Delayed
id: tests-fail-message-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-delayed
tf_path: tests/fail-message-delayed

# 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ override.tf.json

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

/tests/**/.terraform.lock.hcl
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/fail-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module "fail" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = false
error_message = uuid() == "" ? "should never happen" : "sample error"
}
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/pass-message-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module "pass" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() != ""
error_message = uuid() == "" ? "should never happen" : "sample error"
}

0 comments on commit 1b73731

Please sign in to comment.