-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Modified tests to use tlogger. #3343
Modified tests to use tlogger. #3343
Conversation
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.
A couple tiny things that won't depend on your upcoming changes.
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.
Looks really good - just a couple minor things (reporting unmet errors and some minor restructuring).
internal/grpctest/tlogger.go
Outdated
logger.errors[re] += n | ||
} | ||
|
||
// ErrorsLeft checks if expected errors were not encountered. |
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.
We should make sure the unencountered expectations are reported by name. I think passing the testing.T
here and calling t.Errorf()
would be easiest; then you can remove the return value and call this EndTest
or Cleanup
or something.
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.
Function is changed to EndTest() and it reports the unmatched error regular expressions by name now.
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.
Looks good, just a couple small things in a test. Thanks!
internal/grpctest/tlogger_test.go
Outdated
TLogger.ExpectError("Expected error") | ||
TLogger.ExpectError("Expected ln error") | ||
TLogger.ExpectError("Expected formatted error") | ||
TLogger.ExpectErrorN("Expected repeated error", 10) |
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.
10
->numErrors
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.
Fixed this.
internal/grpctest/tlogger_test.go
Outdated
splitFuncName := strings.Split(runtime.FuncForPC(reflect.ValueOf(testFunc).Pointer()).Name(), ".") | ||
t.Run(splitFuncName[len(splitFuncName)-1], testFunc) | ||
func (s) TestError(t *testing.T) { | ||
numErrors := 10 |
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.
const numErrors = 10
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.
Fixed this.
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.
🎉
Modified most tests to use tlogger and leak checker from grpctest.
Updates #3006