Skip to content

feat: rename cwd to working-dir and add discover-path to integration-suites#50

Merged
javierdelapuente merged 3 commits into
mainfrom
feat/integration-suites-improvements
Jun 2, 2026
Merged

feat: rename cwd to working-dir and add discover-path to integration-suites#50
javierdelapuente merged 3 commits into
mainfrom
feat/integration-suites-improvements

Conversation

@javierdelapuente
Copy link
Copy Markdown
Collaborator

Summary

Two improvements to integration-suites config:

1. cwdworking-dir

Renames the key that controls which directory pytest is invoked from. The new name is clearer and self-explanatory without knowing the implementation detail.

Before:

integration-suites:
  tests/integration/:
    cwd: ./

After:

integration-suites:
  tests/integration/:
    working-dir: ./

2. New discover-path key (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.

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

Here tests/integration/juju4/ need not exist on disk — it's just a unique suite identifier. Tests are discovered from tests/integration/ as usual.

discover-path combined with auto-discover: false raises ConfigurationError (they are mutually exclusive).

Changes

  • src/opcli/core/spread.py: rename cwd key, add discover-path handling, extract _resolve_effective_discover_path helper (keeps C901 complexity in check)
  • src/opcli/commands/pytest_cmd.py: update suite_cfg["cwd"]suite_cfg["working-dir"]
  • tests/unit/test_spread.py: update all fixtures/assertions; add 5 new discover-path tests
  • tests/unit/test_pytest_templates.py: update cwdworking-dir in suite_config dicts
  • examples/spread.yaml, AGENTS.md, docs/ISD283.md: updated docs

javierdelapuente and others added 3 commits June 2, 2026 10:09
…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>
@javierdelapuente javierdelapuente merged commit 2d75ac3 into main Jun 2, 2026
22 checks passed
@javierdelapuente javierdelapuente deleted the feat/integration-suites-improvements branch June 2, 2026 10:39
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.

feat: add discover-path key to integration-suites to decouple suite identity from test directory

1 participant