-
Notifications
You must be signed in to change notification settings - Fork 2.7k
assorted test updates #3885
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
assorted test updates #3885
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #3885 +/- ##
==========================================
+ Coverage 56.63% 56.76% +0.13%
==========================================
Files 106 106
Lines 10674 10674
==========================================
+ Hits 6045 6059 +14
+ Misses 3955 3940 -15
- Partials 674 675 +1 ☔ View full report in Codecov by Sentry. |
0c84c60
to
cda9591
Compare
@milosgajdos @corhere ptal |
@squizzi PTAL |
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.
If I read this PR correctly, it seems to be that most of these are renames, race condition fixes [in parallelised subtests] and a small refactoring. On the first pass it LGTM but I have one stylistic comment
context/trace_test.go
Outdated
func checkContextForValues(ctx context.Context, t *testing.T, tests []valueTestCase) { | ||
for _, tc := range tests { | ||
tc := tc | ||
t.Run(tc.key, func(t *testing.T) { |
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.
I am not sure I like the idea of calling a subtest from inside a private func
. I like to be explicit about these thiings and call them inside the Test
funcs. Also, we could parallelise this too 🤔
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.
Yeah; looks like this function was written to make the test more DRY, but effectively this "helper" was running subtests. Changing it to be TestXX
wouldn't work because it doesn't have the right signature, so I just pushed a commit that inlines what it does (at cost of duplicating a couple of lines of code)
I am also assuming we've split these updates into dedicated commits per change so we can do some git archaeology in the future if it comes to it? |
cda9591
to
87f631c
Compare
Yes, both to keep history, to keep the changes in a bit more sizeable chunks, and to split them up a bit into per-package changes. |
Either way; updated; PTAL 🤗 |
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.
Just making sure some parallel changes weren't missed and a typo on a test name we might as well update; otherwise lgtm
registry/api/errcode/errors_test.go
Outdated
} | ||
|
||
if ec.Message() != desc.Message { | ||
t.Fatalf("ec.Message doesn't mtach desc.Message: %q != %q", ec.Message(), desc.Message) |
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.
t.Fatalf("ec.Message doesn't mtach desc.Message: %q != %q", ec.Message(), desc.Message) | |
t.Fatalf("ec.Message doesn't match desc.Message: %q != %q", ec.Message(), desc.Message) |
t.Fatalf("route for name %q not found", testcase.RouteName) | ||
} | ||
for _, tc := range tests { | ||
tc := tc |
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.
Do you intend to have checkTestRouter
be parallel? Looks like t.Parallel()
is missing.
t.Run(name, func(t *testing.T) { | ||
assertEqual(t, testCase.Expected, eligibleForS3(testCase.Context, awsIPs)) | ||
for _, tc := range tests { | ||
tc := tc |
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.
Once again, seems like you're intending for this to be parallel? Just making sure you're not forgetting these if it's intended, if not disregard.
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.
I think I did these mostly "in case" but I might as well go all the way and enable t.Parallel()
t.Run(name, func(t *testing.T) { | ||
assertEqual(t, testCase.Expected, eligibleForS3(testCase.Context, awsIPs)) | ||
for _, tc := range tests { | ||
tc := tc |
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.
And again, seems like you're intending for this to be parallel? Just making sure you're not forgetting these if it's intended, if not disregard.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also renamed a var that collided with a type, and marked a helper as t.Helper() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
checkContextForValues was effectively running sub-tests, but disguided as a helper (to DRY). While it helped some duplication, rewriting it to run subtests within a helper also was a bit confusing, so just inline what it does. While updating, also run tests with t.Parallel() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also marked assertBlobUploadStateEquals as t.Helper() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
8a1f366
to
f03d966
Compare
@squizzi @milosgajdos I think I addressed all comments; ptal |
Uh oh!
There was an error while loading. Please reload this page.