@@ -82,61 +82,61 @@ struct IntegrationTests {
8282 print ( " " )
8383 }
8484
85- @Test ( " Test three-tier web application with multiple networks " )
86- func testThreeTierWebAppWithNetworks( ) async throws {
87- let yaml = DockerComposeParsingTests . dockerComposeYaml2
88-
89- let tempLocation = URL . temporaryDirectory. appending ( path: " Container-Compose_Tests_ \( UUID ( ) . uuidString) /docker-compose.yaml " )
90- try ? FileManager . default. createDirectory ( at: tempLocation. deletingLastPathComponent ( ) , withIntermediateDirectories: true )
91- try yaml. write ( to: tempLocation, atomically: false , encoding: . utf8)
92- let folderName = tempLocation. deletingLastPathComponent ( ) . lastPathComponent
93-
94- var composeUp = try ComposeUp . parse ( [ " -d " , " --cwd " , tempLocation. deletingLastPathComponent ( ) . path ( percentEncoded: false ) ] )
95- try await composeUp. run ( )
96-
97- // Get the containers created by this compose file
98- let containers = try await ClientContainer . list ( )
99- . filter ( {
100- $0. configuration. id. contains ( folderName)
101- } )
102-
103- guard let nginxContainer = containers. first ( where: { $0. configuration. id == " \( folderName) -nginx " } ) ,
104- let appContainer = containers. first ( where: { $0. configuration. id == " \( folderName) -app " } ) ,
105- let dbContainer = containers. first ( where: { $0. configuration. id == " \( folderName) -db " } ) ,
106- let redisContainer = containers. first ( where: { $0. configuration. id == " \( folderName) -redis " } )
107- else {
108- throw Errors . containerNotFound
109- }
110-
111- // --- NGINX Container ---
112- #expect( nginxContainer. configuration. image. reference == " docker.io/library/nginx:alpine " )
113- #expect( nginxContainer. configuration. publishedPorts. map ( { " \( $0. hostAddress) : \( $0. hostPort) : \( $0. containerPort) " } ) == [ " 0.0.0.0:80:80 " ] )
114- #expect( nginxContainer. networks. map ( \. hostname) . contains ( " frontend " ) )
115-
116- // --- APP Container ---
117- #expect( appContainer. configuration. image. reference == " docker.io/library/node:18-alpine " )
118-
119- let appEnv = parseEnvToDict ( appContainer. configuration. initProcess. environment)
120- #expect( appEnv [ " NODE_ENV " ] == " production " )
121- #expect( appEnv [ " DATABASE_URL " ] == " postgres:// \( dbContainer. networks. first!. address. split ( separator: " / " ) [ 0 ] ) :5432/myapp " )
122-
123- #expect( appContainer. networks. map ( \. hostname) . sorted ( ) == [ " backend " , " frontend " ] )
124-
125- // --- DB Container ---
126- #expect( dbContainer. configuration. image. reference == " docker.io/library/postgres:14-alpine " )
127- let dbEnv = parseEnvToDict ( dbContainer. configuration. initProcess. environment)
128- #expect( dbEnv [ " POSTGRES_DB " ] == " myapp " )
129- #expect( dbEnv [ " POSTGRES_USER " ] == " user " )
130- #expect( dbEnv [ " POSTGRES_PASSWORD " ] == " password " )
131-
132- // Verify volume mount
133- #expect( dbContainer. configuration. mounts. map ( \. destination) == [ " /var/lib/postgresql/ " ] )
134- #expect( dbContainer. networks. map ( \. hostname) == [ " backend " ] )
135-
136- // --- Redis Container ---
137- #expect( redisContainer. configuration. image. reference == " docker.io/library/redis:alpine " )
138- #expect( redisContainer. networks. map ( \. hostname) == [ " backend " ] )
139- }
85+ // @Test("Test three-tier web application with multiple networks")
86+ // func testThreeTierWebAppWithNetworks() async throws {
87+ // let yaml = DockerComposeParsingTests.dockerComposeYaml2
88+ //
89+ // let tempLocation = URL.temporaryDirectory.appending(path: "Container-Compose_Tests_\(UUID().uuidString)/docker-compose.yaml")
90+ // try? FileManager.default.createDirectory(at: tempLocation.deletingLastPathComponent(), withIntermediateDirectories: true)
91+ // try yaml.write(to: tempLocation, atomically: false, encoding: .utf8)
92+ // let folderName = tempLocation.deletingLastPathComponent().lastPathComponent
93+ //
94+ // var composeUp = try ComposeUp.parse(["-d", "--cwd", tempLocation.deletingLastPathComponent().path(percentEncoded: false)])
95+ // try await composeUp.run()
96+ //
97+ // // Get the containers created by this compose file
98+ // let containers = try await ClientContainer.list()
99+ // .filter({
100+ // $0.configuration.id.contains(folderName)
101+ // })
102+ //
103+ // guard let nginxContainer = containers.first(where: { $0.configuration.id == "\(folderName)-nginx" }),
104+ // let appContainer = containers.first(where: { $0.configuration.id == "\(folderName)-app" }),
105+ // let dbContainer = containers.first(where: { $0.configuration.id == "\(folderName)-db" }),
106+ // let redisContainer = containers.first(where: { $0.configuration.id == "\(folderName)-redis" })
107+ // else {
108+ // throw Errors.containerNotFound
109+ // }
110+ //
111+ // // --- NGINX Container ---
112+ // #expect(nginxContainer.configuration.image.reference == "docker.io/library/nginx:alpine")
113+ // #expect(nginxContainer.configuration.publishedPorts.map({ "\($0.hostAddress):\($0.hostPort):\($0.containerPort)" }) == ["0.0.0.0:80:80"])
114+ // #expect(nginxContainer.networks.map(\.hostname).contains("frontend"))
115+ //
116+ // // --- APP Container ---
117+ // #expect(appContainer.configuration.image.reference == "docker.io/library/node:18-alpine")
118+ //
119+ // let appEnv = parseEnvToDict(appContainer.configuration.initProcess.environment)
120+ // #expect(appEnv["NODE_ENV"] == "production")
121+ // #expect(appEnv["DATABASE_URL"] == "postgres://\(dbContainer.networks.first!.address.split(separator: "/")[0]):5432/myapp")
122+ //
123+ // #expect(appContainer.networks.map(\.hostname).sorted() == ["backend", "frontend"])
124+ //
125+ // // --- DB Container ---
126+ // #expect(dbContainer.configuration.image.reference == "docker.io/library/postgres:14-alpine")
127+ // let dbEnv = parseEnvToDict(dbContainer.configuration.initProcess.environment)
128+ // #expect(dbEnv["POSTGRES_DB"] == "myapp")
129+ // #expect(dbEnv["POSTGRES_USER"] == "user")
130+ // #expect(dbEnv["POSTGRES_PASSWORD"] == "password")
131+ //
132+ // // Verify volume mount
133+ // #expect(dbContainer.configuration.mounts.map(\.destination) == ["/var/lib/postgresql/"])
134+ // #expect(dbContainer.networks.map(\.hostname) == ["backend"])
135+ //
136+ // // --- Redis Container ---
137+ // #expect(redisContainer.configuration.image.reference == "docker.io/library/redis:alpine")
138+ // #expect(redisContainer.networks.map(\.hostname) == ["backend"])
139+ // }
140140
141141// @Test("Parse development environment with build")
142142// func parseDevelopmentEnvironment() throws {
0 commit comments