Skip to content

fix: implement fake DeleteOldWorkspaceAgentStats #11076

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 4 commits into from
Dec 7, 2023
Merged

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Dec 7, 2023

Fixes: #10955

This PR implements the DeleteOldWorkspaceAgentStats function with basic test coverage.

@mtojek mtojek self-assigned this Dec 7, 2023
@mtojek mtojek requested a review from johnstcn December 7, 2023 12:53
@mtojek mtojek marked this pull request as ready for review December 7, 2023 12:53
Comment on lines +71 to +80
require.Eventually(t, func() bool {
// Query all stats created not earlier than 7 months ago
stats, err = db.GetWorkspaceAgentStats(ctx, now.Add(-7*30*24*time.Hour))
if err != nil {
return false
}
return !containsWorkspaceAgentStat(stats, first) &&
containsWorkspaceAgentStat(stats, second)
}, testutil.WaitShort, testutil.IntervalFast, stats)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of scope of this PR: it would be cool to be able to pass a chan into dbpurge and wait for it to tick

@mtojek mtojek merged commit 941e387 into main Dec 7, 2023
@mtojek mtojek deleted the 10955-dbpurge-tests-2 branch December 7, 2023 13:08
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 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.

2 participants