-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Migrate more testing helpers into tfdiags package #36474
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
Conversation
127c61f to
457b09a
Compare
457b09a to
c03e7d7
Compare
SarahFrench
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlighting where the helper functions used to be located
| func assertNoDiagnostics(t *testing.T, diags tfdiags.Diagnostics) bool { | ||
| t.Helper() | ||
| return assertDiagnosticCount(t, diags, 0) | ||
| } | ||
|
|
||
| func assertDiagnosticCount(t *testing.T, diags tfdiags.Diagnostics, want int) bool { | ||
| t.Helper() | ||
| if len(diags) != want { | ||
| t.Errorf("wrong number of diagnostics %d; want %d", len(diags), want) | ||
| for _, diag := range diags { | ||
| t.Logf("- %#v", diag) | ||
| } | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed functions here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the other place where helper functions were moved from
* Add new `AssertNoDiagnostics` and `AssertDiagnosticCount` test helpers in tfdiags package * Add new `AssertNoErrors` and `LogDiagnostics` test helpers in tfdiags package * Refactor existing tests to use new helpers * Refactor more recent tests * Revert change - wrong function replaced * Refactor to account for function no longer returning a boolean * Fix comment
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Moves these functions into testing.go in the tfdiags package:
Removes implementations of these functions from other packages
Refactors existing tests to use the new helpers in tfdiags
Target Release
N/A
CHANGELOG entry