MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / e2e_container

Function e2e_container

tests/e2e/conftest.py:38–82  ·  view source on GitHub ↗
(docker_image: str, api_key: str)

Source from the content-addressed store, hash-verified

36
37@pytest.fixture
38def e2e_container(docker_image: str, api_key: str):
39 name = f"codeplain-e2e-{uuid.uuid4().hex[:12]}"
40 run = subprocess.run(
41 [
42 "docker",
43 "run",
44 "-d",
45 "--rm",
46 "--name",
47 name,
48 "-e",
49 f"CODEPLAIN_API_KEY={api_key}",
50 "-e",
51 "CODEPLAIN_INSTALL_NONINTERACTIVE=1",
52 docker_image,
53 ],
54 capture_output=True,
55 text=True,
56 check=False,
57 )
58 if run.returncode != 0:
59 pytest.fail(f"docker run failed: {run.stderr}")
60 container_id = run.stdout.strip()
61
62 try:
63 install = subprocess.run(
64 ["docker", "exec", container_id, "bash", "/home/e2e/install.sh"],
65 capture_output=True,
66 text=True,
67 timeout=600,
68 check=False,
69 )
70 assert install.returncode == 0, (
71 f"install.sh failed inside container (rc={install.returncode})\n"
72 f"stdout:\n{install.stdout}\nstderr:\n{install.stderr}"
73 )
74
75 yield container_id
76 finally:
77 subprocess.run(
78 ["docker", "stop", container_id],
79 capture_output=True,
80 text=True,
81 check=False,
82 )
83
84
85@pytest.fixture

Callers

nothing calls this directly

Calls 1

runMethod · 0.80

Tested by

no test coverage detected