Repository navigation
feat(e2e): Add jobs e2e tests w/ fixes, mock inference provider - #179
Conversation
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
|
📝 WalkthroughWalkthroughThis PR adds two complementary E2E test suites with supporting infrastructure: inference gateway tests validating mock provider routing and features, and job execution tests covering subprocess-backed job lifecycle, data handling, and state management. ChangesInference Gateway E2E Tests (Mock Provider Mode)
Job Execution E2E Tests (Subprocess Backend)
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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/test_jobs.py`:
- Around line 216-218: The test currently fetches step_logs once via
sdk.jobs.get_logs(workspace, name=job.name) and asserts immediately that the
combined messages contain "Data from first step", which races OTLP flush/ingest;
change this to poll/retry fetching step_logs until the expected message appears
or a timeout elapses (e.g., loop with small sleep and overall timeout), using
sdk.jobs.get_logs(workspace, name=job.name) and job.name as the identifier, then
assert after the poll completes or fail with a clear message if timed out.
🪄 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: fa3aff01-46ff-4be4-9c4a-3406e8420069
📒 Files selected for processing (5)
e2e/conftest.pye2e/test_inference.pye2e/test_jobs.pyservices/core/files/src/nmp/core/files/api/v2/otlp/endpoints.pyservices/core/jobs/src/nmp/core/jobs/controllers/backends/subprocess_runtime.py
mckornfield
left a comment
There was a problem hiding this comment.
I reviewed a PR ryan did as well that added the test_jobs file, might be worth coordinating
Summary
Adds e2e test coverage for the platform jobs system running on the subprocess executor, enables mock inference provider for e2e tests, and fixes a bug where subprocess job logs had epoch-zero timestamps causing wrong ordering.
Part of the e2e test migration tracked by AIRCORE-715.
Changes
e2e/conftest.py--service-group allfrom thenemo services runargs. Plainnemo services runstarts all services and controllers via the default fallback. Passing--service-group allexplicitly populatedselected_services, which skipped the fallback that also starts controllers — meaning the jobs scheduler never ran and jobs stayed increatedforever.pytest_configurehook that setsNMP_INFERENCE_GATEWAY_MOCK_PROVIDER_PREFIX=igw-mock-and clears theConfigurationcache, soadd_mock_provider()works in e2e tests.e2e/test_jobs.py— 13 tests (8 passing, 5 skipped), ported from Platform-Deploytest_basic_platform_job_lifecycle— create, run, complete, check logstest_job_logs_across_multiple_batches— OTLP log capture across batches with ordering assertiontest_job_config_is_readable— job reads config from$NEMO_JOB_STEP_CONFIG_FILE_PATHtest_job_passing_data_between_steps— multi-step job with persistent storagetest_job_using_secret_environment_variable— secret injected as env vartest_job_with_expected_failure— non-zero exit → error statustest_job_cancel_immediately— cancel right after creationtest_job_cancel_once_active— wait for active, then cancel via SIGTERMtest_job_pause_resume— skipped: subprocess backend has no SIGSTOP/SIGCONT handling (AIRCORE-721)test_job_pause_and_cancel— skipped: same reasontest_job_using_additional_volume— skipped: Docker-only (container volume mounts)test_job_invalid_image_format— skipped: image is discarded by cpu→subprocess translatione2e/test_inference.py— 10 tests for mock inference providersubprocess_runtime.py— bug fixSubprocessOtelLogger.emit()was not passing atimestampto the OpenTelemetry logger. This causedtimeUnixNano=0in the protobuf payload (protobuf defaultsNoneto0for uint64). All logs got epoch-zero timestamps, soORDER BY timestampproduced arbitrary ordering.timestamp=time_ns().otlp/endpoints.py— defensive fixtimeUnixNanois0, fall back toobservedTimeUnixNano(which OpenTelemetry auto-populates). Protects against any other OTLP emitter that omits the timestamp.How jobs work in subprocess mode
Tests submit jobs with
CPUExecutionProviderSpec(same as Docker). The jobs service'stranslate_cpu_container_steps_to_subprocess()automatically rewritescpu/defaultsteps tosubprocess/default— discarding the container image and running the command directly on the host. This means the same test code works across both backends.Test plan
uv run --frozen pytest e2e/ -v --run-e2e— 22 passed, 5 skippeduv run --frozen pytest services/core/jobs/tests/controllers/test_subprocess_runtime.py -v— 8 passedtest_health_readypasses (was failing when--service-group allwas used due to controllers not starting)🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Chores