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

test: standardize to 8 character commit SHA1 in assert_contributor_names #314

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cpb
Copy link

@cpb cpb commented Oct 8, 2024

This PR adds a script which provides a CLI similar to rails test, but runs the suite with a version of assert_contributor_names which:

  1. Resolves test failures from ambiguous OID exceptions by finding the unambiguous SHA1 prefix which passes the original assertion, and rewrites the assert_contributor_names call with the unambiguous SHA1 prefix.
  2. Rewrites the assert_contributor_names calls which pass with an 8 character long SHA1.

Example output running bin/lengthen-sha1 compared to bin/rails test. Note the difference in number of assertions: bin/lengthen-sha1 won't rewrite a SHA1 in an assert_contributor_names which does not pass with the original expectation.

$ bin/lengthen-sha1
Run options: --seed 18175

# Running:

...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Ambiguous sha1 842ce34 was lengthened to 842ce34b to pass rails test test/credits/canonical_names_test.rb:1463
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Ambiguous sha1 a5991d8 was lengthened to a5991d84 to pass rails test test/credits/canonical_names_test.rb:2067
..........................................................................................................................

Finished in 35.047266s, 40.6308 runs/s, 93.2740 assertions/s.
1424 runs, 3269 assertions, 0 failures, 0 errors, 0 skips

$ rails test
Run options: --seed 53663

# Running:

................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 18.365159s, 77.5381 runs/s, 100.2986 assertions/s.
1424 runs, 1842 assertions, 0 failures, 0 errors, 0 skips

This PR includes the modifications form the above example test run in:

cpb added 2 commits October 8, 2024 10:54
⚗️ Proof of concept SHA1 lengthening script

♻️ Decouple from specific test file

run whole suite instrumenting tests which include AssertContributorNames

🚚 Move to bin/lengthen-sha1, drop thor dependency

🚨 Fix whitespace

✏️ Missed dropping thor/action
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.

1 participant