Fix output validation tests to work with plan command
Some checks failed
Code Quality & Security Scan / TFLint (push) Successful in 18s
Code Quality & Security Scan / Terraform Destroy (push) Has been skipped
Code Quality & Security Scan / Tfsec Security Scan (push) Successful in 24s
Code Quality & Security Scan / Checkov Security Scan (push) Successful in 38s
Code Quality & Security Scan / Terraform Tests (push) Failing after 1m27s
Code Quality & Security Scan / SonarQube Trigger (push) Has been skipped
Code Quality & Security Scan / Terraform Init (push) Has been skipped
Code Quality & Security Scan / Terraform Apply (push) Has been skipped
Some checks failed
Code Quality & Security Scan / TFLint (push) Successful in 18s
Code Quality & Security Scan / Terraform Destroy (push) Has been skipped
Code Quality & Security Scan / Tfsec Security Scan (push) Successful in 24s
Code Quality & Security Scan / Checkov Security Scan (push) Successful in 38s
Code Quality & Security Scan / Terraform Tests (push) Failing after 1m27s
Code Quality & Security Scan / SonarQube Trigger (push) Has been skipped
Code Quality & Security Scan / Terraform Init (push) Has been skipped
Code Quality & Security Scan / Terraform Apply (push) Has been skipped
- Removed assertions that check resource IDs (not available during plan) - Kept resource_pool_names output test (based on variables) - Added verification for expected resource group keys in output - Fixes: "Unknown condition value" error in verify_outputs test Resource IDs are only known after apply, so they can't be validated during plan phase. The remaining tests verify output structure using variable-based data that is available during plan.
This commit is contained in:
parent
74940bdc29
commit
58b600c1d2
@ -112,32 +112,26 @@ run "verify_default_resource_pool_config" {
|
||||
}
|
||||
}
|
||||
|
||||
# Test 6: Verify outputs are generated correctly
|
||||
# Test 6: Verify outputs structure is correct
|
||||
run "verify_outputs" {
|
||||
command = plan
|
||||
|
||||
# Resource pool IDs output
|
||||
assert {
|
||||
condition = length(keys(output.resource_pool_ids)) == 5
|
||||
error_message = "Should output 5 resource pool IDs"
|
||||
}
|
||||
|
||||
# Resource pool names output
|
||||
# Resource pool names output (based on variables, available during plan)
|
||||
assert {
|
||||
condition = length(keys(output.resource_pool_names)) == 5
|
||||
error_message = "Should output 5 resource pool names"
|
||||
}
|
||||
|
||||
# Environment tag ID output
|
||||
# Verify the output contains expected resource group keys
|
||||
assert {
|
||||
condition = output.environment_tag_id != null
|
||||
error_message = "Environment tag ID should not be null"
|
||||
}
|
||||
|
||||
# Resource group tag IDs output
|
||||
assert {
|
||||
condition = length(keys(output.resource_group_tag_ids)) == 5
|
||||
error_message = "Should output 5 resource group tag IDs"
|
||||
condition = alltrue([
|
||||
contains(keys(output.resource_pool_names), "kubernetes"),
|
||||
contains(keys(output.resource_pool_names), "docker"),
|
||||
contains(keys(output.resource_pool_names), "infra"),
|
||||
contains(keys(output.resource_pool_names), "databases"),
|
||||
contains(keys(output.resource_pool_names), "app-servers")
|
||||
])
|
||||
error_message = "Output should contain all expected resource group keys"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user