Skip to content

Commit

Permalink
helper/resource: Go documentation intentions for ErrorCheck and Expec…
Browse files Browse the repository at this point in the history
…tError

Reference: #238

This is a quick followup recent clarification changes in error messages to better mention intended use and message compatibility with `TestCase.ErrorCheck` and `TestStep.ExpectError`.
  • Loading branch information
bflad committed Dec 7, 2023
1 parent 20d9c65 commit e4c05b7
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit e4c05b7

Please sign in to comment.