Skip to content

Commit 8e7e8bd

Browse files
committed
test(core): harden GPU fallback YAML assertion
1 parent 7929cda commit 8e7e8bd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/lib/tests/usecases/projects-up.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ const nvidiaMissingDeviceDriverFailure =
104104
const arbitraryComposeFailure =
105105
"Error response from daemon: network sandbox setup failed"
106106

107+
const gpuAllComposeYamlPattern = /(^|\s)gpus:\s*["']?all["']?(\s|$)/m
108+
107109
const nvidiaFailureMarkers: ReadonlyArray<string> = [
108110
nvidiaContainerCliMarker,
109111
libNvidiaMlMarker,
@@ -318,7 +320,7 @@ describe("runDockerComposeUpWithPortCheck", () => {
318320
expect(started.gpu).toBe("none")
319321

320322
const composeAfter = yield* _(fs.readFileString(path.join(outDir, "docker-compose.yml")))
321-
expect(composeAfter).not.toMatch(/\bgpus:\s*all\b/)
323+
expect(composeAfter).not.toMatch(gpuAllComposeYamlPattern)
322324

323325
const configAfter = yield* _(fs.readFileString(path.join(outDir, "docker-git.json")))
324326
expect(configAfter).toContain('"gpu": "none"')
@@ -366,7 +368,7 @@ describe("runDockerComposeUpWithPortCheck", () => {
366368
expect(started.gpu).toBe("none")
367369

368370
const composeAfter = yield* _(fs.readFileString(path.join(outDir, "docker-compose.yml")))
369-
expect(composeAfter).not.toMatch(/\bgpus:\s*all\b/)
371+
expect(composeAfter).not.toMatch(gpuAllComposeYamlPattern)
370372

371373
const configAfter = yield* _(fs.readFileString(path.join(outDir, "docker-git.json")))
372374
expect(configAfter).toContain('"gpu": "none"')
@@ -442,7 +444,7 @@ describe("runDockerComposeUpWithPortCheck", () => {
442444
expect(started.gpu).toBe("none")
443445

444446
const composeAfter = yield* _(fs.readFileString(path.join(outDir, "docker-compose.yml")))
445-
expect(composeAfter).not.toMatch(/\bgpus:\s*all\b/)
447+
expect(composeAfter).not.toMatch(gpuAllComposeYamlPattern)
446448

447449
const configAfter = yield* _(fs.readFileString(path.join(outDir, "docker-git.json")))
448450
expect(configAfter).toContain('"gpu": "none"')

0 commit comments

Comments
 (0)