Skip to content

Commit f826fc8

Browse files
committed
[red] Reproduce cache and rollback deployment failures
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent 63c370a commit f826fc8

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

tools/web/src/test/vps-deployment-contract.test.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ describe("Cloudflare-fronted VPS deployment", () => {
112112
readFile(join(deploymentRoot, "vps", "deploy.sh"), "utf8"),
113113
]);
114114

115-
expect(config).toContain(
116-
'~^/social/pyble-beta-og-1200x630\\.(?:png|svg)(?:\\?|$) "no-store";',
117-
);
115+
for (const extension of ["png", "svg"]) {
116+
const path = `/social/pyble-beta-og-1200x630.${extension}`;
117+
expect(config).toContain(`"${path}" "no-store";`);
118+
expect(config).toContain(`~^${path.replace(".", "\\.")}\\? "no-store";`);
119+
}
118120
expect(script).toContain("retired_public_asset_paths=(");
119121
expect(script).toContain("/social/pyble-beta-og-1200x630.png");
120122
expect(script).toContain("/social/pyble-beta-og-1200x630.svg");
@@ -257,6 +259,24 @@ describe("Cloudflare-fronted VPS deployment", () => {
257259
);
258260
});
259261

262+
it("routes explicit post-activation smoke rejections through rollback", async () => {
263+
const script = await readFile(
264+
join(deploymentRoot, "vps", "deploy.sh"),
265+
"utf8",
266+
);
267+
const smokeStart = script.indexOf("trap rollback_on_smoke_error ERR");
268+
const smokeEnd = script.indexOf("trap - ERR", smokeStart + 1);
269+
const smokeRegion = script.slice(smokeStart, smokeEnd);
270+
271+
expect(smokeStart).toBeGreaterThan(-1);
272+
expect(smokeEnd).toBeGreaterThan(smokeStart);
273+
expect(script).toMatch(
274+
/reject_post_activation_smoke\(\)[\s\S]*?return\s+"\$\{smoke_status\}"/,
275+
);
276+
expect(smokeRegion).not.toMatch(/\bexit\s+(?:66|67)\b/);
277+
expect(smokeRegion).toMatch(/\breject_post_activation_smoke\s+(?:66|67)\b/);
278+
});
279+
260280
it("arms rollback before the current symlink can switch or the activation SSH can fail", async () => {
261281
const script = await readFile(
262282
join(deploymentRoot, "vps", "deploy.sh"),

0 commit comments

Comments
 (0)