- Notifications
You must be signed in to change notification settings - Fork928
chore(coderd): add MockAuditor.Contains test helper#10421
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
// Contains returns true if, for each non-zero-valued field in expected, | ||
// there exists a corresponding audit log in the mock auditor that matches | ||
// the expected values. Returns false otherwise. | ||
func (a *MockAuditor) Contains(t testing.TB, expected database.AuditLog) bool { |
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.
Might be useful to be able to require multiple log entries and thus, also that the order is correct? Just a thought, feel free to disregard if it's premature.
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 could assert relative ordering perhaps, but asserting absolute ordering would likely run into the same kinds of issues we saw in#10396.
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
4a95a79
tof015c3c
Compare
Fixes#10396
Contains()
method onMockAuditor
to help with asserting the presence of an audit log with specific fields.verifyAuditWorkspaceCreated
to use the new helper