fix(ci): wait for asynchronous NSIS uninstaller surface cleanup
Windows CI / verify (push) Failing after 3m46s
Windows CI / verify (push) Failing after 3m46s
The installer smoke asserted a clean registry and shortcut surface immediately after the silent uninstall returned and the installation directory disappeared. NSIS uninstallers run detached through a temporary copy, so shortcut and registry removal completes after the invoked process exits, and on current runner images the immediate check raced that cleanup and failed with leftover HKCU keys and shortcuts. The smoke now polls the exact same surface assertions until a bounded deadline, keeping a genuinely dirty uninstall failing, with contract coverage for the tolerated asynchronous cleanup and the persistent failure case.
This commit is contained in:
@@ -223,6 +223,19 @@ function verifyInstalledPhase(phase) {
|
||||
return uninstallerPath;
|
||||
}
|
||||
|
||||
async function waitForInstallerSurfaceClean(phases, { keyExists, pathExists = fs.existsSync, timeoutMs = 30000, pollIntervalMs = 250 }) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
for (;;) {
|
||||
try {
|
||||
assertInstallerSurfaceClean(phases, { keyExists, pathExists });
|
||||
return;
|
||||
} catch (error) {
|
||||
if (Date.now() >= deadline) throw error;
|
||||
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForPathRemoval(targetPath, timeoutMs = 10000) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
while (fs.existsSync(targetPath)) {
|
||||
@@ -274,7 +287,7 @@ async function main() {
|
||||
if (!await waitForPathRemoval(phase.installationDirectory, 30000)) {
|
||||
throw new Error(`Silent uninstall left the installation directory behind: ${phase.installationDirectory}`);
|
||||
}
|
||||
assertCleanInstallerSmokeSurface(phases);
|
||||
await waitForInstallerSurfaceClean(phases, { keyExists: registryKeyExists });
|
||||
results.push({
|
||||
flag: phase.flag,
|
||||
hive: phase.hive,
|
||||
@@ -314,5 +327,6 @@ module.exports = {
|
||||
assertShortcutDetails,
|
||||
createInstallerPhases,
|
||||
readShortcutDetails,
|
||||
registryKeys
|
||||
registryKeys,
|
||||
waitForInstallerSurfaceClean
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user