test(cms): run-unique markers so a crashed run cannot poison the next
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
The versions integration test asserted against fixed marker strings; if a run crashed before restoring contact.json, the next run read the polluted file as its baseline and its expectations collapsed. Markers now carry a per-run timestamp.
This commit is contained in:
@@ -75,10 +75,11 @@ async function main() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Create two saves → two backups of intermediate states
|
// Create two saves → two backups of intermediate states
|
||||||
|
const runId = Date.now();
|
||||||
const v1 = JSON.parse(original);
|
const v1 = JSON.parse(original);
|
||||||
v1.hero.subtitle = 'Verzió teszt #1';
|
v1.hero.subtitle = 'Verzió teszt #1 ' + runId;
|
||||||
const v2 = JSON.parse(original);
|
const v2 = JSON.parse(original);
|
||||||
v2.hero.subtitle = 'Verzió teszt #2';
|
v2.hero.subtitle = 'Verzió teszt #2 ' + runId;
|
||||||
|
|
||||||
for (const variant of [v1, v2]) {
|
for (const variant of [v1, v2]) {
|
||||||
const res = await fetch(`${BASE}/save?file=contact`, {
|
const res = await fetch(`${BASE}/save?file=contact`, {
|
||||||
@@ -120,7 +121,7 @@ async function main() {
|
|||||||
const backupHoldingV1 = fs.readdirSync(backupDir)
|
const backupHoldingV1 = fs.readdirSync(backupDir)
|
||||||
.filter(name => name.startsWith('contact.'))
|
.filter(name => name.startsWith('contact.'))
|
||||||
.filter(name => fs.statSync(path.join(backupDir, name)).mtimeMs >= testStartedAt)
|
.filter(name => fs.statSync(path.join(backupDir, name)).mtimeMs >= testStartedAt)
|
||||||
.find(name => fs.readFileSync(path.join(backupDir, name), 'utf8').includes('Verzió teszt #1'));
|
.find(name => fs.readFileSync(path.join(backupDir, name), 'utf8').includes('Verzió teszt #1 ' + runId));
|
||||||
assert.ok(backupHoldingV1, 'seeded backup holding v1 must exist');
|
assert.ok(backupHoldingV1, 'seeded backup holding v1 must exist');
|
||||||
|
|
||||||
const diffPage = await (await fetch(`${BASE}/versions?file=contact&show=${backupHoldingV1}`, { headers: { Cookie: cookie } })).text();
|
const diffPage = await (await fetch(`${BASE}/versions?file=contact&show=${backupHoldingV1}`, { headers: { Cookie: cookie } })).text();
|
||||||
@@ -134,7 +135,7 @@ async function main() {
|
|||||||
headers: { Cookie: cookie, 'X-CSRF-Token': csrf },
|
headers: { Cookie: cookie, 'X-CSRF-Token': csrf },
|
||||||
});
|
});
|
||||||
assert.equal(restore.status, 200);
|
assert.equal(restore.status, 200);
|
||||||
assert.ok(fs.readFileSync(contentFile, 'utf8').includes('Verzió teszt #1'));
|
assert.ok(fs.readFileSync(contentFile, 'utf8').includes('Verzió teszt #1 ' + runId));
|
||||||
|
|
||||||
// restore created a new backup of the pre-restore state (reversibility)
|
// restore created a new backup of the pre-restore state (reversibility)
|
||||||
const afterPage = await (await fetch(`${BASE}/versions?file=contact`, { headers: { Cookie: cookie } })).text();
|
const afterPage = await (await fetch(`${BASE}/versions?file=contact`, { headers: { Cookie: cookie } })).text();
|
||||||
|
|||||||
Reference in New Issue
Block a user