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] ListUsage filters by time range #11507

Merged
merged 1 commit into from
Jul 22, 2022
Merged

[usage] ListUsage filters by time range #11507

merged 1 commit into from
Jul 22, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Jul 20, 2022

Description

Implements filtering of Usage records by time

  • When range is not supplied, it takes now as the end, and fetches last 31 days

Related Issue(s)

Fixes #

How to test

Unit tests

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ
Copy link
Member Author

easyCZ commented Jul 21, 2022

/werft run

👍 started the job as gitpod-build-mp-usage-query-range.7
(with .werft/ from main)

@laushinka
Copy link
Contributor

laushinka commented Jul 22, 2022

  • When range is not supplied, it takes now as the end, and fetches last 31 days

Thanks for this! Is there a reason for choosing 31 instead of 30? Not that I'm leaning towards either.

@laushinka
Copy link
Contributor

Hmm, the tests in both apiv1 and db are failing for me. Interestingly the tests in apiv1 passed the first time, and then when I ran it again it failed.

@easyCZ
Copy link
Member Author

easyCZ commented Jul 22, 2022

Thanks for this! Is there a reason for choosing 31 instead of 30? Not that I'm leaning towards either.

Just to account for months that have 31 days. It's not ideal but "works".

@@ -16,87 +16,6 @@ import (
"github.com/stretchr/testify/require"
)

func TestCanCreateUsageRecords(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was also covered later when it tests the records get updated, there was no reason to keep it.

}
}

func TestNoErrorOnCreatingDuplicateRecords(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Likewise, this is also tested in the test below which ensures we can update fields

@roboquat roboquat merged commit 0674341 into main Jul 22, 2022
@roboquat roboquat deleted the mp/usage-query-range branch July 22, 2022 09:57
@roboquat roboquat added the deployed: webapp Meta team change is running in production label Jul 26, 2022
@roboquat roboquat added the deployed Change is completely running in production label Jul 26, 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/XL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants