Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+58
@@ -0,0 +1,58 @@
|
||||
// @vitest-environment node
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildDeployMetadata, getDeployAdminSnapshot } from "./deploy-admin.server";
|
||||
|
||||
describe("admin deploy snapshot service", () => {
|
||||
it("builds deploy metadata from runtime env", () => {
|
||||
expect(
|
||||
buildDeployMetadata({
|
||||
NODE_ENV: "production",
|
||||
SENTRY_ENVIRONMENT: "staging",
|
||||
APP_REVISION: "abc123",
|
||||
SENTRY_RELEASE: "rel-1",
|
||||
GIT_BRANCH: "main",
|
||||
DOCKER_IMAGE: "git.tool-ctrl.de/toolctrl-labs/hivegrid-web:abc123",
|
||||
BUILD_TIME: "2026-07-09T00:00:00.000Z",
|
||||
})
|
||||
).toEqual({
|
||||
environment: "staging",
|
||||
nodeEnv: "production",
|
||||
release: "rel-1",
|
||||
revision: "abc123",
|
||||
branch: "main",
|
||||
image: "git.tool-ctrl.de/toolctrl-labs/hivegrid-web:abc123",
|
||||
buildTime: "2026-07-09T00:00:00.000Z",
|
||||
});
|
||||
});
|
||||
|
||||
it("merges repo migrations with applied DB state", async () => {
|
||||
const snapshot = await getDeployAdminSnapshot({
|
||||
env: { NODE_ENV: "production", APP_REVISION: "abc123" },
|
||||
listMigrationNames: () => ["20260701000000_init", "20260702000000_next", "20260703000000_failed"],
|
||||
listAppliedMigrations: async () => [
|
||||
{ migration_name: "20260701000000_init", finished_at: new Date("2026-07-01T00:00:00.000Z"), rolled_back_at: null, logs: null },
|
||||
{ migration_name: "20260703000000_failed", finished_at: null, rolled_back_at: null, logs: "failed" },
|
||||
],
|
||||
});
|
||||
|
||||
expect(snapshot.migrationDbReachable).toBe(true);
|
||||
expect(snapshot.migrations.map((migration) => [migration.name, migration.state])).toEqual([
|
||||
["20260703000000_failed", "failed"],
|
||||
["20260702000000_next", "pending"],
|
||||
["20260701000000_init", "applied"],
|
||||
]);
|
||||
});
|
||||
|
||||
it("falls back to unknown migration state when DB is unreachable", async () => {
|
||||
const snapshot = await getDeployAdminSnapshot({
|
||||
env: { NODE_ENV: "development" },
|
||||
listMigrationNames: () => ["20260701000000_init"],
|
||||
listAppliedMigrations: async () => {
|
||||
throw new Error("db unavailable");
|
||||
},
|
||||
});
|
||||
|
||||
expect(snapshot.migrationDbReachable).toBe(false);
|
||||
expect(snapshot.migrations).toEqual([{ name: "20260701000000_init", state: "unknown" }]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user