-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Description
Plan Checks can currently return an error in PlanCheckResponse.Error to trigger the equivalent of (*testing.T).Error() and exit a test if the plan fails the assertion made. We should consider adding functionality to allow plan checks the ability to trigger (*testing.T).Skip() with a message.
For example, given a data source attribute value, skip the rest of this test. In the real world, this could be as trivial as a configuration such as:
data "aws_partition" "test" {}
# ... other resource configuration ...And wanting to skip the test if data.aws_partition.test.name != "aws" for services only available in the AWS Commercial partition.
This could prevent provider developers from needing to implement TestCase.ErrorCheck based on API error messaging they may not control.
Proposal
Add a Skip string field to the CheckPlanResponse struct. Any plan check that sets this field would immediately invoke (*testing.T).Skip(skipMsg) with the string provided. All normal cleanup/defer functions should still be run - i.e. post-test destroy and temp file cleanup.
References
- Dependent on Plan Check functionality Add support for Plan Checks with
plancheck.ExpectResourceAction,plancheck.ExpectEmptyPlan, andplancheck.ExpectNonEmptyPlan#63