(alpine_image: str)
| 227 | |
| 228 | |
| 229 | async def test_service_start_stop(alpine_image: str): |
| 230 | svc = ( |
| 231 | dag.host() |
| 232 | .directory("runtime/images/base", include=["Dockerfile"]) |
| 233 | .docker_build() |
| 234 | .with_workdir("/work") |
| 235 | .with_new_file("index.html", "foobar") |
| 236 | .with_exposed_port(8080) |
| 237 | .as_service(args=["python", "-m", "http.server", "8080"]) |
| 238 | ) |
| 239 | try: |
| 240 | svc = await svc.start() |
| 241 | out = await ( |
| 242 | dag.container() |
| 243 | .from_(alpine_image) |
| 244 | .with_service_binding("www", svc) |
| 245 | .with_exec(["wget", "-O-", "http://www:8080"]) |
| 246 | .stdout() |
| 247 | ) |
| 248 | finally: |
| 249 | await svc.stop() |
| 250 | |
| 251 | assert out == "foobar" |
nothing calls this directly
no test coverage detected