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

[FIX] eliminate hash collisions in test caching #4808

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

jtwaleson
Copy link
Collaborator

@jtwaleson jtwaleson commented Nov 25, 2023

Description

In a recent PR Felienne noticed something weird: a test that should fail actually succeeded. aa3f4d9

After debugging we figured out that:

  • we expect some tests to succeed
  • in some tests we expect to raise an exception

When the same snippet and level is used across tests, the test runner would use a cached result from another run, reporting the wrong outcome.

Example:

  • Test 1: Snippet A - Level 3 - expect successful execution -> this runs fine
  • Test 2: Snippet A - Level 3 - expect an error -> this should fail because we don't get an exception BUT it does not raise an error because it re-uses the cached result from Test 1.

In this PR we include not just the snippet and level but ALL of the arguments to the single_level_tester method. This way, if we expect an exception, it will result in a different hash.

How to test

Checklist
Done? Check if you have it all in place using this list: (mark with x if done)

  • Contains one of the PR categories in the name
  • Describes changes in the format above
  • Links to an existing issue or discussion -> no, this PR describes the issue that was discussed on Discord
  • Has a "How to test" section

@ghost
Copy link

ghost commented Nov 25, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@jtwaleson jtwaleson marked this pull request as ready for review November 25, 2023 12:55
Copy link
Member

@Felienne Felienne left a comment

Choose a reason for hiding this comment

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

Thanks for the extensive detective work!!

Copy link
Contributor

mergify bot commented Nov 29, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit b8a67da into main Nov 29, 2023
11 checks passed
@mergify mergify bot deleted the fix-for-test-hash-collision branch November 29, 2023 17:27
Copy link
Contributor

mergify bot commented Nov 29, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

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.

2 participants