Skip to content
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

[usage] Cleanup usage records after test #12681

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Sep 6, 2022

Description

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ easyCZ requested a review from a team September 6, 2022 10:22
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 6, 2022
@@ -563,6 +563,10 @@ func TestUsageService_ReconcileUsageWithLedger(t *testing.T) {
to := time.Date(2022, 05, 1, 1, 00, 00, 00, time.UTC)
attributionID := db.NewTeamAttributionID(uuid.New().String())

t.Cleanup(func() {
require.NoError(t, dbconn.Where("attributionId = ?", attributionID).Delete(&db.Usage{}).Error)
Copy link
Member Author

@easyCZ easyCZ Sep 6, 2022

Choose a reason for hiding this comment

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

We expect the controller to create Usage records with this Attribution ID, so we clean them up here in the hook. When the controller runs, it doesn't hook into the test (because it's the function under test)

@roboquat roboquat merged commit 3328f57 into main Sep 6, 2022
@roboquat roboquat deleted the mp/usage-cleanup-usage-after-test branch September 6, 2022 10:35
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XS team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants