Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider allowing PlanCheck implementations to trigger (*testing.T).Skip() #108

Open
austinvalle opened this issue Mar 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@austinvalle
Copy link
Member

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

@austinvalle austinvalle added the enhancement New feature or request label Mar 21, 2023
@austinvalle austinvalle changed the title Consider allowing Plan Check implementations to trigger (*testing.T).Skip() Consider allowing PlanCheck implementations to trigger (*testing.T).Skip() Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant