Something went wrong. Try again.
Terraform and Bun scripts to deploy one self-hosted Knot server to Hetzner VM
knot tailscale typescript bun terraform hetzner
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738/** * Tests the rollout command builder without touching a remote host. * The guard is a shell command, so these checks pin the safety-critical text. */
import { expect, test } from "bun:test";
import { buildRolloutCommand } from "./rollout";
/** Builds the smallest complete rollout input for command rendering tests. */function rolloutInput(allowEmptyRepositories: boolean) { return { allowEmptyRepositories, composeEnvFilePath: "compose.env", composeFilePath: "compose.yaml", dockerhubPullTokenFilePath: "dockerhub.pull.token", dockerhubUsername: "kaychaks", knotEnvFilePath: "knot.env", };}
test("rollout guard refuses an unexpected empty repository directory", () => { const command = buildRolloutCommand(rolloutInput(false));
expect(command).toContain("allow_empty_repositories=0"); expect(command).toContain("repository_count=$(find /opt/knot/repositories"); expect(command).toContain( "Refusing rollout: /opt/knot/repositories is empty while /opt/knot/server/knotserver.db exists.", ); expect(command).toContain("KNOT_ROLLOUT_ALLOW_EMPTY_REPOSITORIES=1");});
test("rollout guard renders the explicit empty-repository override", () => { const command = buildRolloutCommand(rolloutInput(true));
expect(command).toContain("allow_empty_repositories=1");});