Skip to content

Add test coverage#179

Merged
hi-liang merged 3 commits into
mainfrom
add-test-coverage
May 28, 2026
Merged

Add test coverage#179
hi-liang merged 3 commits into
mainfrom
add-test-coverage

Conversation

@hi-liang

@hi-liang hi-liang commented May 28, 2026

Copy link
Copy Markdown
Member

Adds unit, CLI, and Docker-backed integration tests, plus a CI job that runs them on ubuntu-24.04.

Also fixes a latent bug where --oi-env / --oi-env-force modifications were applied in memory but never persisted back to config.json (src/main.rs), caught by the new integration suite.

hi-liang added 3 commits May 28, 2026 00:48
- parse_env_var: accepts K=V (incl. multi-`=` values); rejects missing
  `=`, empty name, empty value, empty input
- get_bundle_path: covers all four flag forms (`-b path`, `-b=path`,
  `--bundle path`, `--bundle=path`), absent flag, empty args, and `-b`
  with no following arg
Resolves #117

- exercises clap short-circuit paths; no Docker or runc required so
  runs as part of default `cargo test`
- --oi-version output contains CARGO_PKG_VERSION
- --oi-help output contains --oi-runtime-path
- uses CARGO_BIN_EXE_oci-interceptor; no new deps
- modify_env_vars left spec_modified=false, so spec.save() was skipped
  and the env override was silently discarded unless paired with
  --oi-readonly-networking-mounts
- caught by integration tests on first CI run against ubuntu-24.04
@hi-liang hi-liang force-pushed the add-test-coverage branch from 071c7d2 to 976d577 Compare May 28, 2026 04:57
@hi-liang hi-liang requested a review from Copilot May 28, 2026 05:00
@hi-liang hi-liang merged commit dd7b8d6 into main May 28, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds automated test coverage around oci-interceptor behavior, including CLI smoke tests, Docker-based end-to-end integration tests, and new unit tests for parsing/option heuristics. This also wires the integration suite into CI and updates documentation for running tests locally.

Changes:

  • Add Docker-gated end-to-end integration tests covering passthrough behavior, networking mount RO enforcement, env var overrides, and debug output files.
  • Add always-on CLI smoke tests for clap short-circuit flags (--oi-help, --oi-version) plus new unit tests for env var parsing and bundle flag detection.
  • Extend CI workflow and README to document/run the integration test suite; mark specs as modified when env var overrides are applied (so debug “modified” output is emitted).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/integration.rs New Docker-gated end-to-end suite exercising runtime wrapper behavior via the Docker daemon.
tests/cli.rs New smoke tests ensuring --oi-help / --oi-version work without Docker.
src/main.rs Marks env-var-driven spec edits as “modified” and adds unit tests for get_bundle_path.
src/env_vars.rs Adds unit tests for parse_env_var edge cases.
README.md Documents how to run unit vs. integration tests locally and in CI.
.github/workflows/CI.yml Adds an integration job that configures Docker runtimes and runs the integration test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/CI.yml
@hi-liang hi-liang deleted the add-test-coverage branch May 28, 2026 05:48
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