Skip to content

helper/resource: Go documentation intentions for ErrorCheck and ExpectError #242

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

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions helper/resource/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ type TestCase struct {

// ErrorCheck allows providers the option to handle errors such as skipping
// tests based on certain errors.
//
// This functionality is only intended for provider-controlled error
// messaging. While in certain scenarios this can also catch testing logic
// error messages, those messages are not protected by compatibility
// promises.
ErrorCheck ErrorCheckFunc

// Steps are the apply sequences done within the context of the
Expand Down Expand Up @@ -564,6 +569,11 @@ type TestStep struct {
// ExpectError allows the construction of test cases that we expect to fail
// with an error. The specified regexp must match against the error for the
// test to pass.
//
// This functionality is only intended for provider-controlled error
// messaging. While in certain scenarios this can also catch testing logic
// error messages, those messages are not protected by compatibility
// promises.
ExpectError *regexp.Regexp

// ConfigPlanChecks allows assertions to be made against the plan file at different points of a Config (apply) test using a plan check.
Expand Down