@@ -4,8 +4,9 @@ import * as FileSystem from "@effect/platform/FileSystem"
44import * as Path from "@effect/platform/Path"
55import { NodeContext } from "@effect/platform-node"
66import { describe , expect , it } from "@effect/vitest"
7- import { Effect } from "effect"
7+ import { Effect , Logger } from "effect"
88import * as Inspectable from "effect/Inspectable"
9+ import * as Option from "effect/Option"
910import * as Sink from "effect/Sink"
1011import * as Stream from "effect/Stream"
1112
@@ -112,15 +113,15 @@ const makeFakeExecutor = (
112113 recorded . push ( {
113114 command : entry . command ,
114115 args : entry . args ,
115- cwd : entry . cwd . _tag === "Some" ? entry . cwd . value : undefined
116+ cwd : Option . getOrUndefined ( entry . cwd )
116117 } )
117118 }
118119
119120 const last = flattened [ flattened . length - 1 ] !
120121 const invocation : RecordedCommand = {
121122 command : last . command ,
122123 args : last . args ,
123- cwd : last . cwd . _tag === "Some" ? last . cwd . value : undefined
124+ cwd : Option . getOrUndefined ( last . cwd )
124125 }
125126 const stdoutText = decideStdout ( invocation )
126127 const stdout = stdoutText . length === 0 ? Stream . empty : Stream . succeed ( encode ( stdoutText ) )
@@ -263,7 +264,11 @@ describe("runDockerComposeUpWithPortCheck", () => {
263264 gpu : "all"
264265 }
265266 const recorded : Array < RecordedCommand > = [ ]
267+ const logs : Array < string > = [ ]
266268 const executor = makeFakeExecutor ( recorded , { failGpuComposeUp : true } )
269+ const logger = Logger . make ( ( { message } ) => {
270+ logs . push ( String ( message ) )
271+ } )
267272
268273 yield * _ (
269274 prepareProjectFiles ( outDir , root , globalConfig , projectConfig , {
@@ -274,7 +279,8 @@ describe("runDockerComposeUpWithPortCheck", () => {
274279
275280 const started = yield * _ (
276281 runDockerComposeUpWithPortCheck ( outDir ) . pipe (
277- Effect . provideService ( CommandExecutor . CommandExecutor , executor )
282+ Effect . provideService ( CommandExecutor . CommandExecutor , executor ) ,
283+ Effect . provide ( Logger . replace ( Logger . defaultLogger , logger ) )
278284 )
279285 )
280286
@@ -285,7 +291,12 @@ describe("runDockerComposeUpWithPortCheck", () => {
285291
286292 const configAfter = yield * _ ( fs . readFileString ( path . join ( outDir , "docker-git.json" ) ) )
287293 expect ( configAfter ) . toContain ( '"gpu": "none"' )
288- expect ( recorded . filter ( ( entry ) => isDockerComposeUpWithBuild ( entry ) ) . length ) . toBeGreaterThan ( 1 )
294+ expect ( recorded . filter ( ( entry ) => isDockerComposeUpWithBuild ( entry ) ) . length ) . toBe ( 2 )
295+ expect ( logs . some ( ( entry ) =>
296+ entry . includes ( "NVIDIA runtime failed" ) &&
297+ entry . includes ( "libnvidia-ml.so.1" ) &&
298+ entry . includes ( "GPU access disabled" )
299+ ) ) . toBe ( true )
289300 } )
290301 ) . pipe ( Effect . provide ( NodeContext . layer ) ) )
291302
0 commit comments