MCPcopy Create free account
hub / github.com/dagger/dagger / test_service_start_stop

Function test_service_start_stop

sdk/python/tests/client/test_integration.py:229–251  ·  view source on GitHub ↗
(alpine_image: str)

Source from the content-addressed store, hash-verified

227
228
229async 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"

Callers

nothing calls this directly

Calls 14

with_exposed_portMethod · 0.80
with_workdirMethod · 0.80
docker_buildMethod · 0.80
hostMethod · 0.80
with_service_bindingMethod · 0.80
from_Method · 0.80
as_serviceMethod · 0.45
with_new_fileMethod · 0.45
directoryMethod · 0.45
startMethod · 0.45
stdoutMethod · 0.45
with_execMethod · 0.45

Tested by

no test coverage detected