feat: add garage tooling
This commit is contained in:
@@ -7,6 +7,7 @@ import { logs } from "../../command/logs";
|
||||
import { initializeCompletion, main } from "../../command/main";
|
||||
import { ps } from "../../command/ps";
|
||||
import { restart } from "../../command/restart";
|
||||
import { s3 } from "../../command/s3";
|
||||
import { start } from "../../command/start";
|
||||
import { stop } from "../../command/stop";
|
||||
import { up } from "../../command/up";
|
||||
@@ -24,6 +25,7 @@ describe("CLI command definitions", () => {
|
||||
["start", "Start deployments without rebuilding images", start],
|
||||
["stop", "Scale managed deployments to zero", stop],
|
||||
["restart", "Roll out a restart for managed deployments", restart],
|
||||
["s3", "Inspect managed S3 storage", s3],
|
||||
["down", "Delete managed resources except ingress and PVCs", down],
|
||||
["ps", "List deployments", ps],
|
||||
["logs", "Show deployment logs", logs],
|
||||
@@ -37,7 +39,8 @@ describe("CLI command definitions", () => {
|
||||
(name, description, command) => {
|
||||
const definition = command as Command;
|
||||
expect(definition.meta).toEqual({ name, description });
|
||||
if (name !== "db") expect(typeof definition.run).toBe("function");
|
||||
if (name !== "db" && name !== "s3")
|
||||
expect(typeof definition.run).toBe("function");
|
||||
},
|
||||
);
|
||||
|
||||
@@ -77,6 +80,21 @@ describe("CLI command definitions", () => {
|
||||
expect(typeof subCommands?.creds?.run).toBe("function");
|
||||
});
|
||||
|
||||
test("defines S3 inspection subcommands", () => {
|
||||
const subCommands = (s3 as Command).subCommands;
|
||||
expect(Object.keys(subCommands ?? {}).sort()).toEqual([
|
||||
"creds",
|
||||
"ls",
|
||||
"ui",
|
||||
]);
|
||||
expect(subCommands?.ls?.meta?.name).toBe("ls");
|
||||
expect(subCommands?.creds?.meta?.name).toBe("creds");
|
||||
expect(subCommands?.ui?.meta?.name).toBe("ui");
|
||||
expect(typeof subCommands?.ls?.run).toBe("function");
|
||||
expect(typeof subCommands?.creds?.run).toBe("function");
|
||||
expect(typeof subCommands?.ui?.run).toBe("function");
|
||||
});
|
||||
|
||||
test("registers shell completion on the root command", async () => {
|
||||
await initializeCompletion();
|
||||
expect((await Promise.resolve(main.meta))?.name).toBe("kuber");
|
||||
|
||||
Reference in New Issue
Block a user