Skip to content

fix: use random generated namespace in TestOthersRepositoryCreation#2458

Merged
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:fix-repository-e2e-test
Feb 8, 2026
Merged

fix: use random generated namespace in TestOthersRepositoryCreation#2458
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:fix-repository-e2e-test

Conversation

@zakisk
Copy link
Copy Markdown
Member

@zakisk zakisk commented Feb 8, 2026

e2e test TestOthersRepositoryCreation was failing because constant namespace name was used 'test-repo' in it which was sometime giving already exist namespace.

📝 Description of the Change

👨🏻‍ Linked Jira

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

e2e test TestOthersRepositoryCreation was failing because constant
namespace name was used 'test-repo' in it which was sometime
giving already exist namespace.

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @zakisk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an intermittent failure in the TestOthersRepositoryCreation end-to-end test. The core issue stemmed from using static namespace names, which occasionally led to conflicts when a namespace already existed from a previous test run. By introducing dynamic, randomly suffixed namespace generation, the test now reliably creates unique environments, preventing these conflicts and improving the overall stability of the test suite.

Highlights

  • E2E Test Fix: Resolved a flakiness issue in the TestOthersRepositoryCreation end-to-end test.
  • Dynamic Namespace Generation: Implemented the use of names.SimpleNameGenerator.RestrictLengthWithRandomSuffix to create unique namespaces for test resources.
  • Prevented Namespace Conflicts: Eliminated "already exist namespace" errors that caused test failures due to constant namespace names.
Changelog
  • test/repository_webhook_test.go
    • Added an import for github.com/tektoncd/pipeline/pkg/names.
    • Updated the targetNs variable to generate a unique name using names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("test-repo").
    • Updated the targetNsNew variable to generate a unique name using names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("test-repo-new").
Activity
  • The pull request was opened by zakisk to address a bug.
  • The change is categorized as a bug fix (fix:).
  • End-to-end tests are the primary testing strategy for this change.
  • The author confirmed no AI assistance was used in this PR.
  • The submitter checklist indicates adherence to commit message guidelines and local checks.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a flaky e2e test by replacing hardcoded namespace names with randomly generated ones. The approach is correct and effectively solves the problem of potential namespace conflicts during concurrent test runs. The suggestion to further improve the consistency and robustness of the test code by randomizing the repository name is valid and has been retained.

Comment on lines +39 to 40
targetNsNew := names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("test-repo-new")
repo.Name = "test-repo-new"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency and to make the test more robust, the repository name should also use the newly generated random name. Currently, targetNsNew is randomized, but repo.Name is assigned a hardcoded value. This is inconsistent with how targetNs is used for the repository name in the first part of the test.

Suggested change
targetNsNew := names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("test-repo-new")
repo.Name = "test-repo-new"
targetNsNew := names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("test-repo-new")
repo.Name = targetNsNew

@chmouel chmouel merged commit 848af5a into tektoncd:main Feb 8, 2026
8 checks passed
@zakisk zakisk deleted the fix-repository-e2e-test branch February 8, 2026 07:43
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