-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[usage] Fix test for listing usage with pagination #12562
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
Conversation
@@ -204,112 +201,87 @@ func TestUsageService_ListBilledUsage_Pagination(t *testing.T) { | |||
} | |||
|
|||
scenarios := []Scenario{ | |||
(func() Scenario { |
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.
This wrapping in a self-invoking anonymous function isn't needed. It would be useful we wanted to do some imperative work, but we're doing only declarative statements.
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.
💡 thanks 💯
@@ -175,11 +175,8 @@ func TestUsageService_ListBilledUsage_Pagination(t *testing.T) { | |||
ctx := context.Background() | |||
|
|||
type Expectation struct { | |||
count int64 |
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.
these properties were not used in the test anywhere...
started the job as gitpod-build-mp-usage-fix-tests.1 because the annotations in the pull request description changed |
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.
Awesome!
Nice lesson.
Description
There are test hooks for record deletion. However, these wouldn't run after each test when the test setup up was hooked up to the top level
*testing.T
(because the hook would only run after they finished). Instead, we need to bind the hooks to each subtest.Related Issue(s)
Fixes unit tests from #12562
How to test
unit tests
Release Notes
Documentation
Werft options: