Skip to content

Improve E2E test local setup and set User-Agent on all HTTP requests - #526

Merged
TomasTomecek merged 4 commits into
packit:mainfrom
TomasTomecek:e2e-improvements
Jun 2, 2026
Merged

TomasTomecek merged 4 commits into
packit:mainfrom
TomasTomecek:e2e-improvements

Conversation

@TomasTomecek

@TomasTomecek TomasTomecek commented May 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Make Jira mock files path configurable via JIRA_MOCK_FILES_HOST env var in compose.yaml, so the testing-jiras/jiras/ directory can be mounted directly into the mcp-gateway container without copying files
  • Document the full local E2E test setup in CONTRIBUTING.md (symlinks for mock repos, JIRA_MOCK_FILES_HOST for Jira fixtures)
  • Set User-Agent: redhat-ymir-agent on all outgoing aiohttp HTTP requests to prevent upstream servers (e.g. thekelleys.org.uk for dnsmasq) from rejecting requests as bots

Test plan

  • Run make run-triage-agent-e2e-tests DRY_RUN=true locally with JIRA_MOCK_FILES_HOST set to verify tests pass
  • Verify no regressions in unit tests: make check-in-container

🤖 Generated with Claude Code

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

Copy link
Copy Markdown
Contributor

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 introduces a global YMIR_USER_AGENT constant and configures various aiohttp and HTTP clients across the codebase to include this header. It also updates documentation and docker-compose configurations to facilitate local E2E testing with mock Jira data. The reviewer feedback suggests enforcing request timeouts on several newly modified aiohttp.ClientSession instances to prevent requests from hanging indefinitely, and recommends extending the User-Agent header to requests.Session in http_utils.py for completeness.

Comment thread ymir/agents/utilities/compare_xunit.py
Comment thread ymir/agents/utilities/compare_xunit.py
Comment thread ymir/tools/unprivileged/read_readme.py
Comment thread ymir/tools/unprivileged/read_readme.py
Comment thread ymir/tools/unprivileged/search_resultsdb.py
Comment on lines +58 to +59
aiohttp.ClientSession(headers={"User-Agent": YMIR_USER_AGENT}) as session,
session.get(url) as response,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Set a timeout on the ClientSession to prevent requests from hanging indefinitely if the remote server is slow or unresponsive.

        aiohttp.ClientSession(
            timeout=AIOHTTP_TIMEOUT, headers={"User-Agent": YMIR_USER_AGENT}
        ) as session,
        session.get(url) as response,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lol, all comments are about timeouts, why?

Comment thread ymir/supervisor/http_utils.py
TomasTomecek and others added 2 commits May 28, 2026 11:31
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
Assisted-by: Claude
…rable

Add JIRA_MOCK_FILES_HOST env var support to compose.yaml so the testing-jiras
jiras/ directory can be mounted directly into the container without copying files.
Document the full local setup in CONTRIBUTING.md and update the data/README.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
majamassarini
majamassarini previously approved these changes May 28, 2026
Comment thread CONTRIBUTING.md Outdated
Comment thread CONTRIBUTING.md Outdated
lbarcziova
lbarcziova previously approved these changes May 28, 2026
artifacts_urls = tool_input.artifacts_urls
target_path = tool_input.target_path
async with aiohttp.ClientSession(timeout=AIOHTTP_TIMEOUT) as session:
async with aiohttp.ClientSession(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice! Should we also add instructions to the agents to include the User-Agent when doing curl and similar requests? 👀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh yeah, that's an excellent point!

TomasTomecek and others added 2 commits May 28, 2026 15:37
Add YMIR_USER_AGENT constant and apply it everywhere aiohttp is used so
requests to upstream servers like thekelleys.org.uk are not rejected as bots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Hardcode DRY_RUN=true in run-triage-agent-e2e-tests Makefile target
  (mock Jira is writable; without it the agent writes comments back to
  fixture files, corrupting subsequent runs)
- Simplify CONTRIBUTING.md run commands and explain why DRY_RUN is needed
- Clarify that testing-jiras is only needed for initial clone, not during runs
- Set User-Agent on requests.Session in supervisor/http_utils.py
- Add -A "redhat-ymir-agent" to curl commands in backport agent prompt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@TomasTomecek
TomasTomecek merged commit 23c28fa into packit:main Jun 2, 2026
9 checks passed
@TomasTomecek
TomasTomecek deleted the e2e-improvements branch June 2, 2026 07:29
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.

4 participants