-
Notifications
You must be signed in to change notification settings - Fork 30
Mount testing-jiras into agent containers for e2e mock repos #565
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -91,7 +91,7 @@ def _load_test_cases(fixtures_dir: str | Path) -> list[BackportAgentTestCase]: | |||||
| return cases | ||||||
|
|
||||||
|
|
||||||
| test_cases = _load_test_cases(os.getenv("BACKPORT_MOCK_REPOS_DIR", str(DEFAULT_FIXTURES_DIR))) | ||||||
| test_cases = _load_test_cases(os.getenv("BACKPORT_MOCK_REPOS_DIR") or str(DEFAULT_FIXTURES_DIR)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||
|
|
||||||
|
|
||||||
| _span_processor = None | ||||||
|
|
@@ -131,7 +131,7 @@ def mock_centos_stream_repos(): | |||||
| Yields: | ||||||
| Control to the test session after repos are prepared. | ||||||
| """ | ||||||
| fixtures_dir = os.getenv("BACKPORT_MOCK_REPOS_DIR", str(DEFAULT_FIXTURES_DIR)) | ||||||
| fixtures_dir = os.getenv("BACKPORT_MOCK_REPOS_DIR") or str(DEFAULT_FIXTURES_DIR) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly,
Suggested change
|
||||||
| configs = load_all_fixture_configs(fixtures_dir) | ||||||
|
|
||||||
| if SHARED_BARE_REPOS_DIR.exists(): | ||||||
|
|
@@ -166,7 +166,7 @@ def _load_reference_patch(test_case: "BackportAgentTestCase") -> str | None: | |||||
| ref_patch_rel = test_case.expected.get("reference_patch") | ||||||
| if not ref_patch_rel: | ||||||
| return None | ||||||
| fixtures_dir = Path(os.getenv("BACKPORT_MOCK_REPOS_DIR", str(DEFAULT_FIXTURES_DIR))) | ||||||
| fixtures_dir = Path(os.getenv("BACKPORT_MOCK_REPOS_DIR") or str(DEFAULT_FIXTURES_DIR)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, converting
Suggested change
|
||||||
| ref_patch_path = fixtures_dir / ref_patch_rel | ||||||
| if ref_patch_path.is_file(): | ||||||
| return ref_patch_path.read_text() | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,18 @@ Clone the repository and set `MOCK_REPOS_HOST` in your `.env`: | |||||
| MOCK_REPOS_HOST=/path/to/testing-jiras/mock_data | ||||||
| ``` | ||||||
|
|
||||||
| It is recommended to run the E2E tests via compose. | ||||||
|
|
||||||
| You can also symlink the `mock_data/` subdirectories here for running tests on the host: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The instruction says "symlink the
Suggested change
|
||||||
| ```bash | ||||||
| ln -s /path/to/testing-jiras/mock_data/triage ymir/agents/tests/e2e/mock_repos/triage | ||||||
| ln -s /path/to/testing-jiras/mock_data/backport ymir/agents/tests/e2e/mock_repos/backport | ||||||
| ``` | ||||||
|
|
||||||
| > **Note:** Symlinks only work when running tests on the host. Podman bind | ||||||
| > mounts do not follow symlinks pointing outside the mounted tree, so | ||||||
| > containerized e2e tests require the compose-based approach. | ||||||
|
|
||||||
| This mounts the fixture data into E2E test containers at `/home/beeai/mock_repos/`. | ||||||
| The compose services set `MOCK_REPOS_DIR` and `BACKPORT_MOCK_REPOS_DIR` to point | ||||||
| at the `triage/` and `backport/` subdirectories respectively. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -199,7 +199,7 @@ def mock_centos_stream_repos(tmp_path_factory): | |||||||||||||
| Yields: | ||||||||||||||
| Control to the test session after repos are prepared. | ||||||||||||||
| """ | ||||||||||||||
| fixtures_dir = os.getenv("MOCK_REPOS_DIR", str(DEFAULT_FIXTURES_DIR)) | ||||||||||||||
| fixtures_dir = os.getenv("MOCK_REPOS_DIR") or str(DEFAULT_FIXTURES_DIR) | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a defensive check to ensure the fixtures directory exists. This prevents confusing downstream errors (like git clone/fetch failures) if
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||||||
| configs = load_all_fixture_configs(fixtures_dir) | ||||||||||||||
|
|
||||||||||||||
| if git_repo_basepath := os.getenv("GIT_REPO_BASEPATH"): | ||||||||||||||
|
|
||||||||||||||
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.
Instead of repeating the environment variable lookup and fallback logic across multiple functions, define a single module-level
FIXTURES_DIRconstant. Additionally, add a defensive check to ensure the directory exists, preventing silent test collection failures or empty test runs if the environment variable is misconfigured.