test(e2e): restore the seeded executor's pinned fingerprint after R5

The fingerprint-change-warning spec pinned a deliberately bogus
fingerprint on the worker's seeded SSH executor to exercise the
mismatch UI, then exited without resetting it. Later specs in the
same worker that launched real tasks against the same executor
(workdir-per-profile R1/R2 in alphabetical order) failed at SSH dial
time with host-key-changed, since the executor was still pinned to
the bad value.

Wrap the assertion in a try/finally that restores the original
fingerprint from seedData when the test ends, so the worker leaves
the executor in the same state it inherited.
This commit is contained in:
José Almeida
2026-05-17 19:46:32 +01:00
parent 2ccd59dec4
commit c2a9781f65
+24 -8
View File
@@ -73,7 +73,10 @@ test.describe("ssh trust gate", () => {
apiClient,
seedData,
}) => {
// Set a wrong fingerprint on the seeded executor.
// Set a wrong fingerprint on the seeded executor. Restore it after the
// test so any later spec in the worker that exercises a real launch
// doesn't trip over host-key-changed against the still-bad pin.
const originalFingerprint = seedData.sshTarget.hostFingerprint;
await apiClient.updateExecutor(seedData.sshExecutorId, {
config: {
ssh_host: seedData.sshTarget.host,
@@ -85,13 +88,26 @@ test.describe("ssh trust gate", () => {
},
});
const page = new SSHSettingsPage(testPage);
await page.gotoExisting(seedData.sshExecutorId);
await expect(page.pinnedFingerprint()).toHaveText("SHA256:wrong-fingerprint-on-purpose");
try {
const page = new SSHSettingsPage(testPage);
await page.gotoExisting(seedData.sshExecutorId);
await expect(page.pinnedFingerprint()).toHaveText("SHA256:wrong-fingerprint-on-purpose");
await page.clickTest();
await page.waitForTestResult();
await expect(page.fingerprintChangeWarning()).toBeVisible();
await expect(page.observedFingerprint()).toHaveText(seedData.sshTarget.hostFingerprint);
await page.clickTest();
await page.waitForTestResult();
await expect(page.fingerprintChangeWarning()).toBeVisible();
await expect(page.observedFingerprint()).toHaveText(seedData.sshTarget.hostFingerprint);
} finally {
await apiClient.updateExecutor(seedData.sshExecutorId, {
config: {
ssh_host: seedData.sshTarget.host,
ssh_port: String(seedData.sshTarget.port),
ssh_user: seedData.sshTarget.user,
ssh_identity_source: "file",
ssh_identity_file: seedData.sshTarget.identityFile,
ssh_host_fingerprint: originalFingerprint,
},
});
}
});
});