feat : overwite buzz.sudloh.com/guide
This commit is contained in:
@@ -37,6 +37,9 @@ describe("production deployment contract", () => {
|
||||
expect(service).toContain("targetPort: http");
|
||||
expect(ingress).toContain("ingressClassName: traefik");
|
||||
expect(ingress).toContain("host: guide.sudloh.com");
|
||||
expect(ingress).toContain("host: buzz.sudloh.com");
|
||||
expect(ingress).toContain("path: /guide");
|
||||
expect(ingress).toContain("name: buzz-sheet-mirror");
|
||||
expect(ingress).toContain(
|
||||
'traefik.ingress.kubernetes.io/read-timeout: "200"',
|
||||
);
|
||||
@@ -44,6 +47,24 @@ describe("production deployment contract", () => {
|
||||
expect(ingress).not.toContain("router.tls");
|
||||
});
|
||||
|
||||
it("runs the public mirror as an independently resilient workload", async () => {
|
||||
const [deployment, service, hpa, pdb] = await Promise.all([
|
||||
repositoryFile("k8s/base/mirror-deployment.yaml"),
|
||||
repositoryFile("k8s/base/mirror-service.yaml"),
|
||||
repositoryFile("k8s/base/mirror-hpa.yaml"),
|
||||
repositoryFile("k8s/base/mirror-pdb.yaml"),
|
||||
]);
|
||||
|
||||
expect(deployment).toContain("name: buzz-sheet-mirror");
|
||||
expect(deployment).toContain("replicas: 2");
|
||||
expect(deployment).toContain("path: /guide/api/health");
|
||||
expect(deployment).toContain('value: "true"');
|
||||
expect(service).toContain("app.kubernetes.io/component: public-mirror");
|
||||
expect(hpa).toContain("name: buzz-sheet-mirror");
|
||||
expect(hpa).toContain("maxReplicas: 6");
|
||||
expect(pdb).toContain("minAvailable: 1");
|
||||
});
|
||||
|
||||
it("keeps availability and scaling bounds explicit", async () => {
|
||||
const [hpa, pdb] = await Promise.all([
|
||||
repositoryFile("k8s/base/hpa.yaml"),
|
||||
@@ -63,12 +84,16 @@ describe("production deployment contract", () => {
|
||||
"k8s/base/namespace.yaml",
|
||||
"k8s/base/configmap.yaml",
|
||||
"k8s/base/deployment.yaml",
|
||||
"k8s/base/mirror-deployment.yaml",
|
||||
"k8s/base/worker-deployment.yaml",
|
||||
"k8s/base/discord-worker-deployment.yaml",
|
||||
"k8s/base/service.yaml",
|
||||
"k8s/base/mirror-service.yaml",
|
||||
"k8s/base/ingress.yaml",
|
||||
"k8s/base/hpa.yaml",
|
||||
"k8s/base/mirror-hpa.yaml",
|
||||
"k8s/base/pdb.yaml",
|
||||
"k8s/base/mirror-pdb.yaml",
|
||||
"k8s/base/ci-rbac.yaml",
|
||||
"k8s/migration/job.yaml",
|
||||
];
|
||||
@@ -110,6 +135,9 @@ describe("production deployment contract", () => {
|
||||
expect(workflow).toContain("bun run lint");
|
||||
expect(workflow).toContain("kubectl kustomize k8s/");
|
||||
expect(workflow).toContain("--target app");
|
||||
expect(workflow).toContain("--build-arg NEXT_PUBLIC_BASE_PATH=/guide");
|
||||
expect(workflow).toContain("--build-arg PUBLIC_MIRROR=true");
|
||||
expect(workflow).toContain("mirror-${{ gitea.sha }}");
|
||||
expect(workflow).toContain('--build-arg BASE_URL="$BASE_URL"');
|
||||
expect(workflow).toContain(
|
||||
'--build-arg NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID="$NEXT_PUBLIC_GOOGLE_ADSENSE_CLIENT_ID"',
|
||||
@@ -123,6 +151,7 @@ describe("production deployment contract", () => {
|
||||
);
|
||||
expect(workflow).toContain("migrate-${{ gitea.sha }}");
|
||||
expect(workflow).toContain("deployment/buzz-sheet-discord-worker");
|
||||
expect(workflow).toContain("deployment/buzz-sheet-mirror");
|
||||
const deleteMigrationJob = workflow.indexOf(
|
||||
'delete job buzz-sheet-migrate --ignore-not-found',
|
||||
);
|
||||
@@ -145,11 +174,22 @@ describe("production deployment contract", () => {
|
||||
]);
|
||||
|
||||
expect(layout).toContain("<DeploymentUpdateNotifier");
|
||||
expect(notifier).toContain('new EventSource("/api/active")');
|
||||
expect(notifier).toContain('new EventSource(withBasePath("/api/active"))');
|
||||
expect(notifier).toContain("window.location.reload()");
|
||||
expect(notifier).toContain('label: "รีโหลด"');
|
||||
expect(route).toContain('channel.sendNamed("deployment", deploymentId)');
|
||||
});
|
||||
|
||||
it("blocks private routes only in the public mirror build", async () => {
|
||||
const proxy = await repositoryFile("proxy.ts");
|
||||
|
||||
expect(proxy).toContain('process.env.PUBLIC_MIRROR === "true"');
|
||||
expect(proxy).toContain('"/admin/:path*"');
|
||||
expect(proxy).toContain('"/api/admin/:path*"');
|
||||
expect(proxy).toContain('"/api/auth/:path*"');
|
||||
expect(proxy).toContain("status: 404");
|
||||
expect(proxy).toContain("NextResponse.next()");
|
||||
});
|
||||
});
|
||||
|
||||
describe("environment template contract", () => {
|
||||
|
||||
Reference in New Issue
Block a user