Skip to content

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Apr 30, 2023

@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.13 🎉

Comparison is base (29b5e79) 56.63% compared to head (0c84c60) 56.76%.

📣 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     

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@thaJeztah thaJeztah force-pushed the rename_table_tests branch from 0c84c60 to cda9591 Compare May 2, 2023 20:02
@thaJeztah thaJeztah marked this pull request as ready for review May 2, 2023 20:03
@thaJeztah
Copy link
Member Author

@milosgajdos @corhere ptal

@corhere
Copy link
Collaborator

corhere commented May 2, 2023

@squizzi PTAL

Copy link
Member

@milosgajdos milosgajdos left a 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

func checkContextForValues(ctx context.Context, t *testing.T, tests []valueTestCase) {
for _, tc := range tests {
tc := tc
t.Run(tc.key, func(t *testing.T) {
Copy link
Member

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 🤔

Copy link
Member Author

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)

@milosgajdos
Copy link
Member

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?

@thaJeztah thaJeztah force-pushed the rename_table_tests branch from cda9591 to 87f631c Compare May 4, 2023 11:11
@thaJeztah
Copy link
Member Author

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?

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.

@thaJeztah
Copy link
Member Author

Either way; updated; PTAL 🤗

@milosgajdos milosgajdos requested a review from squizzi May 4, 2023 11:54
Copy link
Collaborator

@squizzi squizzi left a 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

}

if ec.Message() != desc.Message {
t.Fatalf("ec.Message doesn't mtach desc.Message: %q != %q", ec.Message(), desc.Message)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Member Author

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
Copy link
Collaborator

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.

thaJeztah added 14 commits May 9, 2023 13:54
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>
thaJeztah added 2 commits May 9, 2023 14:00
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the rename_table_tests branch from 8a1f366 to f03d966 Compare May 9, 2023 12:40
@thaJeztah
Copy link
Member Author

@squizzi @milosgajdos I think I addressed all comments; ptal

@milosgajdos milosgajdos merged commit c9b844e into distribution:main May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants