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

reference: rewrite test to use sub-tests, add benchmark #3883

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Apr 29, 2023

reference: TestParseDockerRef: capture test in loop

reference: TestParseRepositoryInfo: use subtests

reference: add BenchmarkParse

BenchmarkParse
BenchmarkParse-10    	   12696	     93805 ns/op	    9311 B/op	     185 allocs/op
PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    BenchmarkParse
    BenchmarkParse-10    	   12696	     93805 ns/op	    9311 B/op	     185 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter
Copy link

Codecov Report

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

Comparison is base (29b5e79) 56.63% compared to head (49e2de2) 56.81%.

📣 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    #3883      +/-   ##
==========================================
+ Coverage   56.63%   56.81%   +0.17%     
==========================================
  Files         106      106              
  Lines       10674    10674              
==========================================
+ Hits         6045     6064      +19     
+ Misses       3955     3936      -19     
  Partials      674      674              

see 3 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.

@@ -677,6 +683,7 @@ func TestParseDockerRef(t *testing.T) {
},
}
for _, test := range testcases {
test := test
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch. I would also love this var to (and the range var) to be called tc for consistency's sake but I appreciate making tests consistent would've been a proper effort

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, 💯. Both for the OCD side of me, but also because having a common pattern / naming helps with cognitive overload when reading code (when reading tc you don't have to "think" what it is).

Probably best to do so in a one-time pass over all existing tests and update them.

@thaJeztah thaJeztah mentioned this pull request Apr 30, 2023
1 task
@thaJeztah
Copy link
Member Author

@milosgajdos milosgajdos merged commit 0ea92a1 into distribution:main May 2, 2023
12 checks passed
@thaJeztah thaJeztah deleted the reference_update_tests_and_add_benchmark branch May 2, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants