merge: 同步远端主线
This commit is contained in:
@@ -24,6 +24,7 @@ import { readTransSshBackendConfig, type TransSshBackendConfig } from "./trans-c
|
||||
import { readCliOutputPolicy } from "./output";
|
||||
import { readHostK8sPublicHost } from "./host-k8s-config";
|
||||
import {
|
||||
buildK3sTargetCommand,
|
||||
buildWindowsPowerShellInvocation,
|
||||
effectiveApplyPatchV2Invocation,
|
||||
normalizeSshOperationArgs,
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
formatSshStdoutTruncationHint,
|
||||
formatSshTruncationCompletionSummary,
|
||||
parseSshInvocation,
|
||||
remoteCommandForRoute,
|
||||
sshTruncationCompletionSummary,
|
||||
sshCaptureBackendPlan,
|
||||
sshStderrStreamMaxBytes,
|
||||
@@ -219,6 +220,25 @@ describe("ssh direct argv boundaries and plane diagnostics", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("ssh k3s file transfer command builder", () => {
|
||||
test("routes download stream commands through the shared k3s target builder", () => {
|
||||
const invocation = parseSshInvocation(
|
||||
"NC01:k3s:hwlab:deployment:hwlab-cloud-api",
|
||||
["download", "/tmp/trace.json", "/tmp/trace.json"],
|
||||
);
|
||||
const remoteCommand = remoteCommandForRoute(
|
||||
invocation.route,
|
||||
["sh", "-c", "cat -- \"$1\"", "unidesk-download", "/tmp/trace.json"],
|
||||
);
|
||||
|
||||
expect(remoteCommand).toContain("'KUBECONFIG=/etc/rancher/k3s/k3s.yaml'");
|
||||
expect(remoteCommand).toContain("'kubectl' 'exec' '-n' 'hwlab'");
|
||||
expect(remoteCommand).toContain("'deployment/hwlab-cloud-api'");
|
||||
expect(remoteCommand).toContain("'cat -- \"$1\"'");
|
||||
expect(remoteCommand).toContain("'/tmp/trace.json'");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ssh host apply-patch fs backend", () => {
|
||||
test("uses POSIX bulk fs operations for host routes", async () => {
|
||||
const invocation = parseSshInvocation("D601:/mnt/f/Work/ConStart", ["apply-patch"]);
|
||||
|
||||
+1
-1
@@ -1367,7 +1367,7 @@ function buildK3sTargetObjectCommand(action: "get" | "describe", route: ParsedSs
|
||||
return shellArgv(["env", `KUBECONFIG=${nativeK3sKubeconfig}`, "kubectl", action, "-n", route.namespace, normalizeK3sRouteResource(route.resource), ...args]);
|
||||
}
|
||||
|
||||
function buildK3sTargetCommand(route: ParsedSshRoute, command: string[], options: { stdin?: boolean } = {}): string {
|
||||
export function buildK3sTargetCommand(route: ParsedSshRoute, command: string[], options: { stdin?: boolean } = {}): string {
|
||||
return buildK3sExecCommand([...k3sRouteTargetArgs(route), ...(options.stdin === true ? ["--stdin"] : []), "--", ...command]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user