Skip to content

test(e2e): add nemo-deployments plugin e2e tests for docker and k8s backends - #766

Merged
benmccown merged 3 commits into
mainfrom
deployments-plugin-e2e
Jul 22, 2026
Merged

test(e2e): add nemo-deployments plugin e2e tests for docker and k8s backends#766
benmccown merged 3 commits into
mainfrom
deployments-plugin-e2e

Conversation

@benmccown

@benmccown benmccown commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Adds e2e coverage for the nemo-deployments plugin's own public API (DeploymentConfig / Deployment / Volume CRUD) end to end through the reconcile controller, on both the Docker and Kubernetes executor backends. Mirrors the existing nemo-agents deployment e2e structure (test_nemo_agents_docker.py / test_nemo_agents_k8s.py + shared helpers).

Files

  • e2e/deployments_helpers.py — backend-agnostic scenario cores driven via sdk._client against /apis/deployments/v2/...:
    • service (restart_policy=Always nginx) → READY with a routable endpoint
    • job (restart_policy=Never alpine) → SUCCEEDED, exit 0
    • volume round-trip: provision → mount into a job → write sentinel → read back
  • e2e/test_nemo_deployments_docker.py — subprocess harness + docker executor (subprocess_only); skips cleanly without a reachable Docker daemon.
  • e2e/test_nemo_deployments_k8s.py — external kind cluster + k8s executor (container_only); wider timeouts for pod scheduling / PVC binding.
  • e2e/configs/local-docker-deployments.yaml — subprocess platform wired with a docker deployments executor (pull_images enabled, tightened reconcile loop).

Notes

  • Workload image refs default to docker.io/library/alpine|nginx and are env-overridable (NMP_E2E_DEPLOYMENTS_ALPINE_IMAGE / _NGINX_IMAGE), matching the POSTGRES_IMAGE / BUSYBOX_IMAGE knobs the kind e2e install already exposes. Pulling public docker.io/library/* at cluster runtime is the same pattern the kind CPU e2e job already relies on for postgres/busybox/cloud-provider-kind (no pull-through cache is configured today).
  • The k8s tests run under the existing kind-cpu-e2e job (whole e2e/ dir), gated by container_only. Docker tests are subprocess_only.
  • Opened as draft to see how the tests fare in CI.

Local: ruff check, ruff format --check, and ty check all pass; full e2e/ collects.

Summary by CodeRabbit

  • New Features

    • Expanded end-to-end coverage for the deployments plugin on local Docker and Kubernetes.
    • Added lifecycle validation for long-running services, one-shot jobs, and a Docker volume round-trip (provision, mount, write, and read back).
  • Tests

    • Introduced shared helpers for creating, polling, and reliably tearing down deployment-related resources.
    • Added Docker daemon–gated E2E tests with best-effort cleanup and clear READY/SUCCEEDED assertions.
    • Added a Docker-specific E2E runtime configuration with faster reconcile timing and deployment convergence timeouts.
  • Chores

    • Centralized common E2E scenario runners for consistency across backends.

@github-actions github-actions Bot added the test conventional-commit type label Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 27113/34832 77.8% 62.1%
Integration Tests 15892/33443 47.5% 19.9%

@benmccown
benmccown marked this pull request as ready for review July 17, 2026 18:12
@benmccown
benmccown requested review from a team as code owners July 17, 2026 18:12
@benmccown benmccown self-assigned this Jul 17, 2026
@benmccown
benmccown requested a review from tylersbray July 17, 2026 18:12
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4c7e32f6-18e2-4a8a-ab0f-f1c23814a7a3

📥 Commits

Reviewing files that changed from the base of the PR and between 6869a80 and e600447.

📒 Files selected for processing (4)
  • e2e/configs/local-docker-deployments.yaml
  • e2e/deployments_helpers.py
  • e2e/test_nemo_deployments_docker.py
  • e2e/test_nemo_deployments_k8s.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • e2e/configs/local-docker-deployments.yaml
  • e2e/test_nemo_deployments_k8s.py
  • e2e/test_nemo_deployments_docker.py
  • e2e/deployments_helpers.py

📝 Walkthrough

Walkthrough

Added shared REST and lifecycle helpers for the deployments plugin, a local Docker E2E configuration, and Docker/Kubernetes tests covering services, jobs, and volume round trips.

Changes

Deployments E2E coverage

Layer / File(s) Summary
Deployment API primitives
e2e/deployments_helpers.py
Adds image constants, REST wrappers, resource listing, unique naming, and idempotent deletion for deployment configs, volumes, and deployments.
Lifecycle convergence and round trips
e2e/deployments_helpers.py
Adds status and deletion polling plus reusable service, job, and volume workflows with cleanup.
Backend test harnesses
e2e/configs/local-docker-deployments.yaml, e2e/test_nemo_deployments_docker.py, e2e/test_nemo_deployments_k8s.py
Configures local Docker execution and wires Docker availability, subprocess, and Kubernetes test settings.
Backend lifecycle scenarios
e2e/test_nemo_deployments_docker.py, e2e/test_nemo_deployments_k8s.py
Adds service readiness, successful job, and volume read/write E2E tests for Docker and Kubernetes.

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant NeMoDeploymentsAPI
  participant ReconcileController
  participant Backend
  E2ETest->>NeMoDeploymentsAPI: Create deployment resources
  NeMoDeploymentsAPI->>ReconcileController: Reconcile resources
  ReconcileController->>Backend: Provision workload or volume
  E2ETest->>NeMoDeploymentsAPI: Poll status and validate result
  E2ETest->>NeMoDeploymentsAPI: Delete resources
Loading

Suggested reviewers: mckornfield, tylersbray, svvarom

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the new E2E test coverage for nemo-deployments on Docker and Kubernetes backends.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deployments-plugin-e2e

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
e2e/configs/local-docker-deployments.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/deployments_helpers.py`:
- Around line 444-485: Move the create_volume, wait_for_volume_status, and
create_deployment_config calls into the existing try block so every resource
creation and polling operation is protected by teardown. Keep the existing
cleanup logic and deployment configuration unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2f6944f3-bb15-4656-ae97-c6ee01f1e9b5

📥 Commits

Reviewing files that changed from the base of the PR and between 44cee38 and a3ef017.

📒 Files selected for processing (4)
  • e2e/configs/local-docker-deployments.yaml
  • e2e/deployments_helpers.py
  • e2e/test_nemo_deployments_docker.py
  • e2e/test_nemo_deployments_k8s.py

Comment thread e2e/deployments_helpers.py Outdated

@tylersbray tylersbray 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.

Approving modulo knocking out code rabbit comments.

…ackends

Exercise the nemo-deployments plugin's own public API
(DeploymentConfig / Deployment / Volume CRUD) end to end through the
reconcile controller on both the Docker and Kubernetes executor
backends, mirroring the existing nemo-agents deployment e2e structure.

- deployments_helpers.py: backend-agnostic scenario cores driven via
  sdk._client against /apis/deployments/v2/... (service->READY,
  job->SUCCEEDED, and a volume provision+mount+read-back round-trip).
  Workload image refs default to docker.io/library/alpine|nginx and are
  env-overridable, matching the POSTGRES_IMAGE/BUSYBOX_IMAGE knobs the
  kind e2e install already exposes.
- test_nemo_deployments_docker.py: subprocess harness + docker executor
  (subprocess_only), skips cleanly without a reachable Docker daemon.
- test_nemo_deployments_k8s.py: external kind cluster + k8s executor
  (container_only), wider timeouts for pod scheduling / PVC binding.
- configs/local-docker-deployments.yaml: subprocess platform wired with a
  docker deployments executor (pull_images enabled, tightened reconcile
  loop).

Signed-off-by: Ben McCown <bmccown@nvidia.com>
…mer)

Manual testing in a kind cluster surfaced a hard deadlock in the k8s
volume round-trip: DeploymentReconciler gates a deployment's create on
every mounted Volume already being BOUND (volume_mounts_ready), but
kind's default local-path StorageClass binds WaitForFirstConsumer, so
the PVC only binds once a consumer pod is scheduled — which never happens
while the deployment is gated. The Kind CPU e2e job uses this same
storage class, so the test would have hung until timeout in CI.

This mirrors a known limitation the k8s reconcile integration test
already documents and sidesteps (tests/integration/test_reconcile_k8s.py).

- Remove the volume scenario from test_nemo_deployments_k8s.py (keeps
  service->READY and job->SUCCEEDED, both verified passing against a
  kind Helm platform).
- Keep the volume round-trip in the docker module, where volumes bind
  eagerly (verified passing); tighten its volume-status wait to require
  BOUND rather than tolerating PENDING.
- Document the storage-binding portability constraint in both the k8s
  module and the run_volume_deployment_round_trip helper.

Signed-off-by: Ben McCown <bmccown@nvidia.com>
Address CodeRabbit review feedback on PR #766: in the shared deployments
e2e lifecycle helpers, resource-creation calls sat before the try block,
so a failure during setup (e.g. a volume-status poll timing out or a
config create erroring) would bypass the finally cleanup and leak the
already-created resources.

Move all resource creation inside the existing try in the three scenario
cores (run_service_deployment_lifecycle, run_job_deployment_lifecycle,
run_volume_deployment_round_trip). The finally blocks are already
idempotent (_safe + *_if_exists), so cleaning up not-yet-created
resources is a no-op.

Signed-off-by: Ben McCown <bmccown@nvidia.com>
@benmccown
benmccown force-pushed the deployments-plugin-e2e branch from 6869a80 to e600447 Compare July 22, 2026 16:26
@benmccown
benmccown added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 7662279 Jul 22, 2026
109 of 110 checks passed
@benmccown
benmccown deleted the deployments-plugin-e2e branch July 22, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test conventional-commit type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants