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 flaky test case in CacheStoreBehavior #44386

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Conversation

ghousemohamed
Copy link
Contributor

@ghousemohamed ghousemohamed commented Feb 10, 2022

Summary

In a PR I had raised earlier, one of the test cases in ActiveSupport was failing, even though the PR did not touch any piece of code related to ActiveSupport. Upon closer inspection, I found that this is the test case that was failing:

PR: #44385
Ref: https://buildkite.com/rails/rails/builds/84552#2c168cf4-a799-4b58-a1ec-cc3032854894/1183-1205

def test_keys_are_case_sensitive
key = SecureRandom.alphanumeric
@cache.write(key, "bar")
assert_nil @cache.read(key.upcase)
end

Since SecureRandom.alphanumeric returns a string in which the alphabets are not guaranteed to be all be lowercase, it can possibly return a string with only uppercase letters and numbers present in it. And since in this test case we are testing for case sensitivity, in the rare occasion a string is returned with only uppercase letters, this test case will fail.

This PR intends to account for this edge case.

Thanks!

Other Information

@ghousemohamed ghousemohamed changed the title Fix possible flaky test case in CacheStoreBehavior Fix flaky test case in CacheStoreBehavior Feb 10, 2022
Copy link
Contributor

@nvasilevski nvasilevski left a comment

Choose a reason for hiding this comment

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

Good catch!

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.

None yet

3 participants