Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

johnstcn
Copy link
Member

Fixes #10396

// 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 {
Copy link
Member

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.

Copy link
Member Author

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.

johnstcn and others added 2 commits November 6, 2023 09:05
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
@johnstcn johnstcn force-pushed the cj/flake/test-workspace-dormant branch from 4a95a79 to f015c3c Compare November 6, 2023 09:05
@johnstcn johnstcn merged commit 26c3c12 into main Nov 6, 2023
@johnstcn johnstcn deleted the cj/flake/test-workspace-dormant branch November 6, 2023 09:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: TestWorkspaceDormant/OK reports too many audit logs
3 participants