25 lines
2.4 KiB
JavaScript
25 lines
2.4 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { randomUUID, createHash } from 'node:crypto';
|
|
import { buildWindowsInstaller } from '../scripts/build-installer.mjs';
|
|
const release = JSON.parse(fs.readFileSync('releases/latest.json', 'utf8')); assert.equal(release.installer.version, '1.19.0');
|
|
const appId = randomUUID(), destination = '.qa/cache-f-qa-installer.json'; assert.equal(fs.existsSync(destination), false);
|
|
const installer = buildWindowsInstaller({ root: process.cwd(), portableRoot: release.portableRoot, outputRoot: path.resolve('.qa'),
|
|
name: 'cache-installer-qa-' + appId, qaFixture: { appId, fault: 'none' } });
|
|
const source = fs.readFileSync(installer.source, 'utf8'), product = fs.readFileSync(release.installer.source, 'utf8');
|
|
const body = value => value.split('\n').filter(line => !line.startsWith('#define OutputRoot ') && !line.startsWith('#define OutputName ')).join('\n');
|
|
assert.equal(body(source).replaceAll(appId, 'E914E883-46F9-4B82-B27F-BDB2B40DCC90')
|
|
.replace('DefaultGroupName=Agent Workbench QA E914E883-46F9-4B82-B27F-BDB2B40DCC90', 'DefaultGroupName=Agent Workbench'), body(product));
|
|
fs.writeFileSync(destination, JSON.stringify({ ...installer, productSetup: release.installer,
|
|
samePayloadManifestSha256: createHash('sha256').update(fs.readFileSync(path.join(release.portableRoot, 'MANIFEST.json'))).digest('hex'),
|
|
sourceComparison: 'Only isolated QA AppId/group and output destination/name differ; entire product payload and installation behavior are exact. Product setup will separately stage the existing formal installation.' }, null, 2) + '\n', { flag: 'wx' });
|
|
let code = fs.readFileSync('.qa/verify-desktop-f-canonical-storage-guard-install.mjs', 'utf8');
|
|
for (const [before, after] of [['desktop-host-f-canonical-storage-guard-qa-installer.json', 'cache-f-qa-installer.json'],
|
|
['desktop-host-f-canonical-storage-install-location.json', 'cache-f-install-location.json'],
|
|
['ff4e7d22-f233-4021-829a-6f5c71933c46', appId], ['1.15.0', '1.19.0'], ['AWQA15', 'AWQA19'], ['timeout = 300000', 'timeout = 900000']]) {
|
|
assert.ok(code.includes(before), before); code = code.replaceAll(before, after);
|
|
}
|
|
fs.writeFileSync('.qa/verify-cache-install.mjs', code, { flag: 'wx' });
|
|
console.log(JSON.stringify({ success: true, appId, installerSha256: installer.sha256, productSetupSha256: release.installer.sha256, samePayload: true }));
|