Skip to content

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

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

Conversation

AndreiCautisanu
Copy link
Contributor

No description provided.

@AndreiCautisanu AndreiCautisanu requested review from a team as code owners May 5, 2025 06:32
@Nimrod007 Nimrod007 requested a review from Copilot May 5, 2025 07:01
Copy link

@Copilot Copilot AI left a 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."
Copy link
Preview

Copilot AI May 5, 2025

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.

Suggested change
"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.

Copy link
Collaborator

@andrescrz andrescrz left a 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:
Copy link
Collaborator

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

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