feat(runtime-provider-kata): add NerdctlKataAdapter, harden KataSession, healthCheck & E2E tests#412
Merged
feat(runtime-provider-kata): add NerdctlKataAdapter, harden KataSession, healthCheck & E2E tests#412
Conversation
…on, healthCheck & E2E tests - Implement NerdctlKataAdapter backed by nerdctl CLI with createSandbox, execInSandbox, stopSandbox, destroySandbox, and healthCheck methods - Harden KataSession with destroyed guard, ExecOptions forwarding (cwd, env, timeoutMs), and idempotent destroy with stop-then-rm pattern - Add healthCheck() to KataProvider delegating to adapter - Add optional healthCheck to KataAdapter interface - Update StubKataAdapter with healthCheck returning stub version - Export NerdctlKataAdapter and StubKataAdapter from barrel - Add 8 nerdctl-adapter unit tests - Add 14 KataSession hardening and healthCheck unit tests - Add 2 barrel-export smoke tests - Add 8 gated E2E tests (CADRE_E2E_KATA=1)
…onfig option
- Add DockerKataAdapter backed by Docker CLI with --runtime flag
- Add kata.backend ('nerdctl' | 'docker') to isolation config schema
- Add kata.image to isolation config schema
- Update provider-loader to select adapter based on kata.backend
- Add path mappings for runtime-provider packages in root tsconfig
- Export DockerKataAdapter and DockerKataAdapterOptions from barrel
- Add 11 DockerKataAdapter unit tests
- Add 1 barrel-export smoke test
- Add 3 config-schema tests for kata options
- Add 2 provider-loader tests for backend selection
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #412 +/- ##
==========================================
- Coverage 91.32% 91.28% -0.04%
==========================================
Files 213 215 +2
Lines 22904 23203 +299
Branches 3600 3666 +66
==========================================
+ Hits 20916 21182 +266
- Misses 1940 1973 +33
Partials 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Implements the full
kata-provider-e2etask: real nerdctl-backed adapter, session hardening, health checks, and a gated E2E test suite for@cadre-dev/runtime-provider-kata.Changes
New:
NerdctlKataAdapter(src/nerdctl-adapter.ts)KataAdapterimplementation backed bynerdctl(containerd CLI with Kata runtime support)createSandbox()— buildsnerdctl runargs fromKataSessionConfig(runtime, network isolation, memory, cpu-shares, read-only rootfs)execInSandbox()— delegates tonerdctl execstopSandbox()/destroySandbox()— graceful stop then force-remove, errors silencedhealthCheck()— probesnerdctl infofor server versionnode:child_processexecFile; injectable for testingHardened:
KataSession(src/kata-provider.ts)exec()throws afterdestroy(), matchingDockerSessionbehaviordestroy()is a no-op; callsstopSandboxthendestroySandboxwith independent try/catch sodestroySandboxalways runscwdvia shell wrapper (sh -c 'cd ... && exec "$@"'),envviaenv K=Vprefix, composable when both presentPromise.racewithtimeoutMs; returns{ exitCode: 124, timedOut: true }on timeoutNew:
healthCheck()onKataProvideradapter.healthCheck()if the method existshealthCheck(e.g.,StubKataAdapterin unit tests)Updated:
StubKataAdapterhealthCheck()returning{ healthy: true, version: 'stub' }Updated: Barrel Exports (
src/index.ts)NerdctlKataAdapter,NerdctlKataAdapterOptions,StubKataAdapterTests
src/tests/nerdctl-adapter.test.tssrc/kata-provider.test.ts__tests__/index.test.tsNerdctlKataAdapterandStubKataAdaptersrc/tests/kata-e2e.test.tsCADRE_E2E_KATA=1Test results: 188 passed, 8 skipped (E2E), 0 failures. All existing tests unaffected.
How to validate