Skip to content

Commit 1dee469

Browse files
committed
fix(e2e): drop bogus differential-CID check in re-deploy test
The previous version mutated `dist/index.html` between the two deploys and asserted the second deploy produced a different metadata CID. That assumption was wrong: `buildMetadata()` in src/utils/deploy/playground.ts only puts `{repository, readme}` into the metadata JSON — the deployed content's CID is NOT included. Mutating dist therefore had no effect on the metadata CID, both deploys produced the same value, and the test failed in CI's pr-deploy-frontend cell. Worse, the regression I was guarding against ("second deploy silently no-ops") isn't actually a regression: a same-CID re-publish is correct behaviour — the registry already has what the user wants. Keep the meaningful checks: exit 0, "Deploy complete", and an independent registry query that verifies the on-chain entry contains the CID the CLI claimed it published. That alone rules out the only real failure mode (CLI prints success but never sent the extrinsic).
1 parent c145af5 commit 1dee469

1 file changed

Lines changed: 30 additions & 45 deletions

File tree

e2e/cli/deploy.test.ts

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
import { describe, test, expect } from "vitest";
17-
import { readFileSync, writeFileSync } from "node:fs";
1817
import { resolve } from "node:path";
1918
import { dot } from "./helpers/dot.js";
2019
import { SIGNER, BOB, E2E_DOMAINS } from "./fixtures/accounts.js";
@@ -316,50 +315,36 @@ describe("dot deploy --playground — full pipeline (requires Paseo + IPFS)", ()
316315
const firstCid = extractMetadataCid(first.stdout);
317316
expect(firstCid, "first deploy did not print Metadata CID").not.toBeNull();
318317

319-
// Mutate the build output between the two deploys so the second
320-
// deploy must produce a DIFFERENT metadata CID. Without this, a
321-
// regression where the second deploy silently no-ops (returns the
322-
// previous result without re-publishing) would still print
323-
// "Deploy complete" with the old CID and the test would pass.
324-
const indexHtml = resolve(absBuildDir(frontendOnly), "index.html");
325-
const original = readFileSync(indexHtml, "utf8");
326-
writeFileSync(
327-
indexHtml,
328-
`${original}\n<!-- redeploy marker ${Date.now()} -->\n`,
329-
);
330-
331-
try {
332-
const second = await dot([
333-
"deploy",
334-
"--signer", "dev",
335-
"--domain", domain,
336-
"--buildDir", absBuildDir(frontendOnly),
337-
"--no-build",
338-
"--playground",
339-
"--suri", SIGNER.suri,
340-
"--dir", frontendOnly,
341-
], { timeout: 400_000 });
342-
expect(
343-
second.exitCode,
344-
`re-deploy failed: ${second.stdout}\n${second.stderr}`,
345-
).toBe(0);
346-
expect(second.stdout).toContain("Deploy complete");
347-
const secondCid = extractMetadataCid(second.stdout);
348-
expect(secondCid, "re-deploy did not print Metadata CID").not.toBeNull();
349-
// Different content → different metadata CID. If these match,
350-
// the second deploy didn't actually re-publish.
351-
expect(
352-
secondCid,
353-
`re-deploy produced same CID as first — content didn't change on chain`,
354-
).not.toBe(firstCid);
355-
// And the registry should reflect the latest publish.
356-
const entry = await getApp(`${domain}.dot`);
357-
expect(entry).not.toBeNull();
358-
expect(entry!.metadataUri).toContain(secondCid!);
359-
} finally {
360-
// Restore so subsequent tests see the original fixture content.
361-
writeFileSync(indexHtml, original);
362-
}
318+
const second = await dot([
319+
"deploy",
320+
"--signer", "dev",
321+
"--domain", domain,
322+
"--buildDir", absBuildDir(frontendOnly),
323+
"--no-build",
324+
"--playground",
325+
"--suri", SIGNER.suri,
326+
"--dir", frontendOnly,
327+
], { timeout: 400_000 });
328+
expect(
329+
second.exitCode,
330+
`re-deploy failed: ${second.stdout}\n${second.stderr}`,
331+
).toBe(0);
332+
expect(second.stdout).toContain("Deploy complete");
333+
const secondCid = extractMetadataCid(second.stdout);
334+
expect(secondCid, "re-deploy did not print Metadata CID").not.toBeNull();
335+
// NOTE: do NOT assert `secondCid !== firstCid`. The metadata JSON only
336+
// includes `{repository, readme}` (see buildMetadata in src/utils/
337+
// deploy/playground.ts) — neither changes on a same-fixture redeploy,
338+
// so the CID is content-addressed to the same value both times. That's
339+
// correct behaviour: a same-CID re-publish means the registry already
340+
// has what the user wants.
341+
//
342+
// Independent registry check: the on-chain entry must contain the CID
343+
// the CLI claims it published. This catches regressions where the CLI
344+
// prints "Deploy complete" but never sent the registry extrinsic.
345+
const entry = await getApp(`${domain}.dot`);
346+
expect(entry).not.toBeNull();
347+
expect(entry!.metadataUri).toContain(secondCid!);
363348
});
364349

365350
test("domain taken by another account shows unavailable", { timeout: 900_000 }, async () => {

0 commit comments

Comments
 (0)