feat: rename cwd to working-dir and add discover-path to integration-suites#50
Merged
Merged
Conversation
…suites
- Rename the `cwd` key in `integration-suites` entries to `working-dir`
for clarity. The key controls which directory pytest is invoked from
(e.g. the sub-charm root in monorepo layouts).
- Add `discover-path` key: when set, opcli uses it as the test discovery
root instead of the suite key. The suite key then serves purely as a
unique identifier (and the build/<key>/run/task.yaml path). This lets
the same test directory be run twice with different environments (e.g.
juju 3.6 vs juju 4) without requiring duplicate test files.
Example:
integration-suites:
tests/integration/:
working-dir: ./
summary: juju 3.6 tests
tests/integration/juju4/:
discover-path: tests/integration/
working-dir: ./
summary: juju 4 tests
environment:
CONCIERGE: concierge-juju4.yaml
- `discover-path` combined with `auto-discover: false` raises
ConfigurationError (the two options are incompatible).
- Extract `_resolve_effective_discover_path` helper to keep
`_build_suite_entry` under the C901 complexity limit.
Closes #46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add empty/whitespace path check in _validate_safe_path with clear error - Add TestValidateSafePath tests for empty and whitespace-only paths - Add end-to-end test for discover-path: "" raising ConfigurationError - Restore missing class TestGetSuiteConfig: header in test_spread.py - AGENTS.md: fix discover-path default '(suite key)' -> '(none)', fix 'Ignored' -> 'Raises an error', add note distinguishing discover-path (directory) from discover-pattern (glob), add 'Pytest artifact keys:' heading to clarify two-table structure - examples/spread.yaml: add juju3/juju4 discover-path example showing the multi-track monorepo pattern Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
examples/ is a live CI fixture — entries there are executed as real spread suites. The juju3/juju4 examples referenced concierge-juju3.yaml which doesn't exist, causing CI failures. The discover-path feature is already documented with a code snippet in AGENTS.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two improvements to
integration-suitesconfig:1.
cwd→working-dirRenames the key that controls which directory pytest is invoked from. The new name is clearer and self-explanatory without knowing the implementation detail.
Before:
After:
2. New
discover-pathkey (closes #46)Decouples the suite key (identity) from the directory used for test auto-discovery. This enables running the same test suite twice with different environments — e.g. juju 3.6 and juju 4 — without duplicating test files.
Here
tests/integration/juju4/need not exist on disk — it's just a unique suite identifier. Tests are discovered fromtests/integration/as usual.discover-pathcombined withauto-discover: falseraisesConfigurationError(they are mutually exclusive).Changes
src/opcli/core/spread.py: renamecwdkey, adddiscover-pathhandling, extract_resolve_effective_discover_pathhelper (keeps C901 complexity in check)src/opcli/commands/pytest_cmd.py: updatesuite_cfg["cwd"]→suite_cfg["working-dir"]tests/unit/test_spread.py: update all fixtures/assertions; add 5 newdiscover-pathteststests/unit/test_pytest_templates.py: updatecwd→working-dirin suite_config dictsexamples/spread.yaml,AGENTS.md,docs/ISD283.md: updated docs