test(studio-server): the Windows workflow fails when the link tests cannot run (#8395)

This commit is contained in:
Miguel Ángel
2026-11-21 23:00:08 +00:00
committed by GitHub
parent 7ec38388bf
commit b008e37b46
4 changed files with 20 additions and 3 deletions
@@ -20,6 +20,8 @@ permissions:
jobs:
held-file:
runs-on: windows-latest
env:
HF_LINKS_REQUIRED: "1"
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+6 -1
View File
@@ -39,7 +39,8 @@ it("still resolves paths on a volume whose native realpath refuses with EISDIR",
// fails without the fix: off the event loop a link on such a volume never resolved, so the private-file check read it
// under its innocuous spelling.
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up.
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up,
// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping.
const canLink = (() => {
const dir = mkdtempSync(join(tmpdir(), "link-probe-"));
try {
@@ -51,6 +52,10 @@ const canLink = (() => {
rmSync(dir, { recursive: true, force: true });
}
})();
if (!canLink && process.env.HF_LINKS_REQUIRED)
throw new Error(
"this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)",
);
it.skipIf(!canLink)(
"resolves a link off the event loop on a volume whose native realpath refuses with EISDIR",
@@ -19,7 +19,8 @@ afterEach(() => {
for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });
});
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up.
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up,
// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping.
const canLink = (() => {
const dir = mkdtempSync(join(tmpdir(), "link-probe-"));
try {
@@ -31,6 +32,10 @@ const canLink = (() => {
rmSync(dir, { recursive: true, force: true });
}
})();
if (!canLink && process.env.HF_LINKS_REQUIRED)
throw new Error(
"this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)",
);
describe.skipIf(!canLink)("the off-loop private-file check", () => {
// fails without the fix: native realpath failed at every level, so the check compared the link's own spelling and
@@ -16,7 +16,8 @@ function project(): string {
return dir;
}
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up.
// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up,
// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping.
const canLink = (() => {
const dir = mkdtempSync(join(tmpdir(), "link-probe-"));
try {
@@ -28,6 +29,10 @@ const canLink = (() => {
rmSync(dir, { recursive: true, force: true });
}
})();
if (!canLink && process.env.HF_LINKS_REQUIRED)
throw new Error(
"this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)",
);
describe.skipIf(!canLink)("the off-loop private-file check", () => {
// fails without the fix: a path that is there but will not resolve (a link loop) was judged by its own spelling.