-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cg_space test with mocked provider
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
mock_provider "cloudfoundry" { | ||
override_data { | ||
target = data.cloudfoundry_user.managers["[email protected]"] | ||
values = { | ||
id = "1e5143a4-aa47-483c-8352-557988d5cc7a" | ||
} | ||
} | ||
override_data { | ||
target = data.cloudfoundry_user.deployers["[email protected]"] | ||
values = { | ||
id = "1e5143a4-aa47-483c-8352-557988d5cc7a" | ||
} | ||
} | ||
override_data { | ||
target = data.cloudfoundry_user.developers["[email protected]"] | ||
values = { | ||
id = "2c945842-13ee-4383-84ad-34ecbcde5ce6" | ||
} | ||
} | ||
} | ||
|
||
variables { | ||
cf_org_name = "gsa-tts-devtools-prototyping" | ||
cf_space_name = "terraform-cloudgov-ci-tests-egress" | ||
} | ||
|
||
run "test_space_creation" { | ||
assert { | ||
condition = cloudfoundry_space.space.id == output.space_id | ||
error_message = "Space ID output must match the new space" | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space.space.name == var.cf_space_name | ||
error_message = "Space name should match the cf_space_name variable" | ||
} | ||
} | ||
|
||
run "test_manager_only" { | ||
variables { | ||
managers = ["[email protected]"] | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space_users.space_permissions.managers == toset(["1e5143a4-aa47-483c-8352-557988d5cc7a"]) | ||
error_message = "Should be able to set Space Managers" | ||
} | ||
|
||
assert { | ||
condition = length(cloudfoundry_space_users.space_permissions.developers) == 0 | ||
error_message = "Should not have set any Space Developers" | ||
} | ||
} | ||
|
||
run "test_individual_permissions" { | ||
variables { | ||
managers = ["[email protected]"] | ||
developers = ["[email protected]"] | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space_users.space_permissions.managers == toset(["1e5143a4-aa47-483c-8352-557988d5cc7a"]) | ||
error_message = "Should be able to set Space Managers" | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space_users.space_permissions.developers == toset(["2c945842-13ee-4383-84ad-34ecbcde5ce6"]) | ||
error_message = "Should be able to set Space Developers" | ||
} | ||
} | ||
|
||
run "test_deployer_permissions" { | ||
variables { | ||
developers = ["[email protected]"] | ||
deployers = ["[email protected]"] | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space_users.space_permissions.managers == toset(["1e5143a4-aa47-483c-8352-557988d5cc7a"]) | ||
error_message = "Should be able to set Space Managers via var.deployers" | ||
} | ||
|
||
assert { | ||
condition = cloudfoundry_space_users.space_permissions.developers == toset(["2c945842-13ee-4383-84ad-34ecbcde5ce6", "1e5143a4-aa47-483c-8352-557988d5cc7a"]) | ||
error_message = "Should set Space Developers to var.developers + var.deployers" | ||
} | ||
} |