-
Notifications
You must be signed in to change notification settings - Fork 513
NO-OPIK fix sign up error leading to flakiness in demo-data test #2021
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request addresses a sign-up error causing test flakiness by generating a random suffix that avoids consecutive repeating characters.
- Added a new helper function, generate_suffix_no_consecutive, to produce a random string with no adjacent duplicate characters.
- Updated temp_user_with_api_key fixture to leverage the new function for generating the random suffix.
Comments suppressed due to low confidence (1)
tests_end_to_end/tests/Admin/conftest.py:47
- [nitpick] While 'generate_suffix_no_consecutive' accurately describes its behavior, consider renaming it (e.g., 'generate_username_suffix') if its use is primarily for generating user-related strings.
random_suffix = generate_suffix_no_consecutive(length=20)
allowed_chars = string.ascii_lowercase + string.digits | ||
if len(allowed_chars) < 2 and length > 1: | ||
raise ValueError( | ||
"Cannot generate non-consecutive string of length > 1 with < 2 unique characters." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider including the provided 'length' value in the ValueError message to aid debugging when the set of allowed characters is insufficient.
"Cannot generate non-consecutive string of length > 1 with < 2 unique characters." | |
f"Cannot generate non-consecutive string of length {length} with < 2 unique characters." |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor comment,
return "" | ||
|
||
allowed_chars = string.ascii_lowercase + string.digits | ||
if len(allowed_chars) < 2 and length > 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: validation is a bit pointless, as these are built-in constants and the alphabet and digits won't change anytime soon haha.
string.ascii_lowercase + string.digits
No description provided.