purge ssh

This commit is contained in:
Alex Holliday committed 2026-09-04 14:33:13 -07:00
1 parent 074b94b061
commit 71fed33ecd
9 files changed
+13 -104

No files matched your search

@@ -608,7 +608,6 @@ describe("monitorValidation — Docker host url", () => {
type: "docker" as const,
url: "unix:///var/run/docker.sock",
};
const PRIVATE_KEY = "-----BEGIN OPENSSH PRIVATE KEY-----\nfake\n-----END OPENSSH PRIVATE KEY-----";
describe("createMonitorBodyValidation", () => {
it("accepts the default unix socket url", () => {
@@ -621,32 +620,15 @@ describe("monitorValidation — Docker host url", () => {
expect(parsed.url).toBe("/run/docker.sock");
});
it("accepts an ssh url with a private key and retains the key", () => {
for (const url of ["ssh://deploy@host", "ssh://deploy@host:2222"]) {
const parsed = createMonitorBodyValidation.parse({ ...baseDockerBody, url, sshPrivateKey: PRIVATE_KEY });
expect(parsed.sshPrivateKey).toBe(PRIVATE_KEY);
}
});
it("rejects container names and unsupported engine urls", () => {
for (const badUrl of ["my-container", "tcp://host:2375", "https://host", "unix://relative/path", ""]) {
for (const badUrl of ["my-container", "tcp://host:2375", "https://host", "ssh://deploy@host", "unix://relative/path", ""]) {
expect(() => createMonitorBodyValidation.parse({ ...baseDockerBody, url: badUrl })).toThrow();
}
});
it("rejects an ssh url without a user", () => {
expect(() => createMonitorBodyValidation.parse({ ...baseDockerBody, url: "ssh://host", sshPrivateKey: PRIVATE_KEY })).toThrow();
});
it("rejects an ssh url without a private key, attributing the issue to sshPrivateKey", () => {
const result = createMonitorBodyValidation.safeParse({ ...baseDockerBody, url: "ssh://deploy@host" });
expect(result.success).toBe(false);
expect(result.error?.issues.some((issue) => issue.path.includes("sshPrivateKey"))).toBe(true);
});
it("does not apply docker url rules to other monitor types", () => {
const parsed = createMonitorBodyValidation.parse({ name: "HTTP check", type: "http", url: "https://example.com" });
expect(parsed.sshPrivateKey).toBeUndefined();
expect(parsed.url).toBe("https://example.com");
});
});
@@ -660,7 +642,7 @@ describe("monitorValidation — Docker host url", () => {
expect(() => editMonitorBodyValidation.parse({ type: "docker", url: "my-container" })).toThrow();
});
it("rejects a docker edit switching to ssh without a key", () => {
it("rejects a docker edit with an ssh url", () => {
expect(() => editMonitorBodyValidation.parse({ type: "docker", url: "ssh://deploy@host" })).toThrow();
});
});