-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
roachtest: fix parameters passed to require.NoError #95842
Conversation
When context is passed to an assertion, the parameters *must* be a string format, followed by arguments (as you would in a call to `fmt.Sprintf`). The previous code would panic trying to cast int to string. Informs cockroachdb#95416 Release note: None
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.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @herkolategan and @srosenberg)
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.
I wonder if this could have been picked up by one of the linters?
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @herkolategan and @renatolabs)
pkg/cmd/roachtest/tests/multitenant_distsql.go
line 142 at r1 (raw file):
// procede to report error } require.NoError(t, err, "instance idx = %d, iter = %d", li, iter)
It essentially fails the typecast,
if len(msgAndArgs) > 1 {
return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)
}
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.
Reviewable status: complete! 3 of 0 LGTMs obtained (waiting on @renatolabs)
We don't have any linters checking for that (not sure if there's something out there that we could use, a quick Google search didn't reveal anything). bors r=yuzefovich,srosenberg,herkolategan |
[1]
|
Not quite? It is similar, but it makes two assumptions that wouldn't work well for this purpose:
In other words, we'd have to teach the semantics of
That said, this is a good experiment for the tools you mentioned recently ( |
Build succeeded: |
When context is passed to an assertion, the parameters must be a string format, followed by arguments (as you would in a call to
fmt.Sprintf
). The previous code would panic trying to cast int to string.Informs #95416
Release note: None