Skip to content

Commit

Permalink
Add test to verify service instance name matches supplied name value
Browse files Browse the repository at this point in the history
  • Loading branch information
rahearn committed Jun 18, 2024
1 parent 8ec0c9b commit 3616a5e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions s3/tests/creation.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variables {
name = "terraform-cloudgov-s3-test"
}

run "test_creation" {
run "test_bucket_creation" {
assert {
condition = can(regex("^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$", output.bucket_id))
error_message = "Bucket ID should be a GUID"
Expand All @@ -22,7 +22,12 @@ run "test_creation" {
}

assert {
condition = cloudfoundry_service_instance.bucket.service_plan == data.cloudfoundry_service.s3.service_plans["basic-sandbox"]
error_message = "Service Plan should be 'basic-sandbox'"
condition = cloudfoundry_service_instance.bucket.service_plan == data.cloudfoundry_service.s3.service_plans[var.s3_plan_name]
error_message = "Service Plan should match the s3_plan_name variable"
}

assert {
condition = cloudfoundry_service_instance.bucket.name == var.name
error_message = "Service instance name should match the name variable"
}
}

0 comments on commit 3616a5e

Please sign in to comment.