Skip to content

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

@austinvalle

Description

@austinvalle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions