-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test(e2e): migrate test-hermes-root-entrypoint-smoke.sh to vitest [IND-4] #5220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jyaunches
merged 17 commits into
main
from
e2e-migrate/test-hermes-root-entrypoint-smoke
Jun 12, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3e3448a
test(e2e): migrate Hermes root entrypoint smoke
jyaunches f00d47c
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches da55fed
ci(e2e): allow Hermes root smoke dispatch
jyaunches cdf6199
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches 2647e83
ci(e2e): align hermes-root-entrypoint-smoke-vitest dispatch
jyaunches f0d7eb4
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches 38a4c9c
fix(e2e): harden hermes smoke workflow coverage
jyaunches 52d4e1f
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches be59903
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches 78390e9
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches 186dda4
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches 6027ed6
fix(e2e): isolate hermes smoke docker auth
jyaunches 90fb61d
fix(e2e): route docker probe through env boundary
jyaunches d47a4f5
style(e2e): format hermes root smoke
jyaunches 354a1fe
test(e2e): cover docker diagnostic redaction
jyaunches 366edde
ci(e2e): avoid sandbox checkout credentials
jyaunches 7368ec4
Merge remote-tracking branch 'origin/main' into e2e-migrate/test-herm…
jyaunches File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { | ||
| spawnSync, | ||
| type SpawnSyncOptionsWithStringEncoding, | ||
| type SpawnSyncReturns, | ||
| } from "node:child_process"; | ||
| import fs from "node:fs"; | ||
| import os from "node:os"; | ||
| import path from "node:path"; | ||
|
|
||
| import type { ArtifactSink } from "./artifacts.ts"; | ||
| import { buildChildEnv } from "./redaction.ts"; | ||
| import type { SecretStore } from "./secrets.ts"; | ||
|
|
||
| export type DockerCommandResult = { | ||
| command: string[]; | ||
| exitCode: number | null; | ||
| signal: NodeJS.Signals | null; | ||
| stdout: string; | ||
| stderr: string; | ||
| error?: string; | ||
| }; | ||
|
|
||
| export type DockerProbeRunner = ( | ||
| command: string, | ||
| args: string[], | ||
| options: SpawnSyncOptionsWithStringEncoding, | ||
| ) => SpawnSyncReturns<string>; | ||
|
|
||
| const DOCKER_ENV_ALLOWLIST = [ | ||
| "DOCKER_HOST", | ||
| "DOCKER_CONTEXT", | ||
| "DOCKER_TLS_VERIFY", | ||
| "DOCKER_CERT_PATH", | ||
| "XDG_RUNTIME_DIR", | ||
| ] as const; | ||
|
|
||
| function safeName(value: string): string { | ||
| return ( | ||
| value | ||
| .trim() | ||
| .toLowerCase() | ||
| .replace(/[^a-z0-9._-]+/g, "-") | ||
| .replace(/^-+|-+$/g, "") || "docker" | ||
| ); | ||
| } | ||
|
|
||
| export function buildDockerProbeEnv( | ||
| base: NodeJS.ProcessEnv, | ||
| dockerConfigDir: string, | ||
| ): NodeJS.ProcessEnv { | ||
| return buildChildEnv(base, { | ||
| additionalAllowedEnv: DOCKER_ENV_ALLOWLIST, | ||
| fixtureOverlay: { | ||
| DOCKER_CONFIG: dockerConfigDir, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function redactDockerProbeResult( | ||
| result: DockerCommandResult, | ||
| redact: SecretStore["redact"], | ||
| ): DockerCommandResult { | ||
| return { | ||
| command: result.command.map((part) => redact(part)), | ||
| exitCode: result.exitCode, | ||
| signal: result.signal, | ||
| stdout: redact(result.stdout), | ||
| stderr: redact(result.stderr), | ||
| error: result.error ? redact(result.error) : undefined, | ||
| }; | ||
| } | ||
|
|
||
| export function resultText(result: DockerCommandResult): string { | ||
| return [ | ||
| `$ ${result.command.join(" ")}`, | ||
| result.stdout.trim(), | ||
| result.stderr.trim(), | ||
| result.error ? `error: ${result.error}` : "", | ||
| ] | ||
| .filter(Boolean) | ||
| .join("\n"); | ||
| } | ||
|
|
||
| export class DockerProbe { | ||
| private sequence = 0; | ||
| private readonly dockerConfigDir: string; | ||
|
|
||
| constructor( | ||
| private readonly artifacts: ArtifactSink, | ||
| private readonly redact: SecretStore["redact"], | ||
| private readonly runDocker: DockerProbeRunner = spawnSync, | ||
| ) { | ||
| this.dockerConfigDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-docker-config-")); | ||
| } | ||
|
|
||
| async run( | ||
| args: string[], | ||
| options: { artifactName: string; timeoutMs?: number } = { artifactName: "docker" }, | ||
| ): Promise<DockerCommandResult> { | ||
| fs.mkdirSync(this.dockerConfigDir, { recursive: true }); | ||
| const command = ["docker", ...args]; | ||
| const result = this.runDocker("docker", args, { | ||
| cwd: path.resolve(import.meta.dirname, "../../.."), | ||
| encoding: "utf8", | ||
| env: buildDockerProbeEnv(process.env, this.dockerConfigDir), | ||
| maxBuffer: 10 * 1024 * 1024, | ||
| timeout: options.timeoutMs ?? 30_000, | ||
| }); | ||
| const commandResult = redactDockerProbeResult( | ||
| { | ||
| command, | ||
| exitCode: result.status, | ||
| signal: result.signal, | ||
| stdout: result.stdout ?? "", | ||
| stderr: result.stderr ?? "", | ||
| error: result.error instanceof Error ? result.error.message : undefined, | ||
| }, | ||
| this.redact, | ||
| ); | ||
| const artifactBase = `docker/${String(++this.sequence).padStart(3, "0")}-${safeName( | ||
| options.artifactName, | ||
| )}`; | ||
| await this.artifacts.writeText(`${artifactBase}.stdout.txt`, commandResult.stdout); | ||
| await this.artifacts.writeText(`${artifactBase}.stderr.txt`, commandResult.stderr); | ||
| await this.artifacts.writeJson(`${artifactBase}.result.json`, commandResult); | ||
| return commandResult; | ||
| } | ||
|
|
||
| async expect( | ||
| args: string[], | ||
| options: { artifactName: string; timeoutMs?: number }, | ||
| ): Promise<DockerCommandResult> { | ||
| const result = await this.run(args, options); | ||
| if (result.exitCode !== 0) { | ||
| throw new Error(resultText(result)); | ||
| } | ||
| return result; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.