test(pipelock): cut low-value tests (naming + entrypoint/cmd inspection)
test / run tests/run_tests.py (pull_request) Successful in 14s
test / run tests/run_tests.py (pull_request) Successful in 14s
Drops 6 tests with no real coverage loss: - tests/test_pipelock_naming.py — 4 tests asserting that f-string format helpers return their f-string. Shape locks, not behavior gates. - tests/test_pipelock_image.py:test_entrypoint_contains_pipelock and :test_cmd_contains_run — Docker image metadata inspection. The remaining test_binary_runs already covers 'does the pinned image actually work,' which is the only scenario these were really guarding against. 31 tests -> 25.
This commit is contained in:
@@ -1,11 +1,7 @@
|
|||||||
"""Integration: verify the pinned pipelock image. Requires docker.
|
"""Integration: the pinned pipelock image's binary actually runs.
|
||||||
- Pinned digest is reachable on the registry.
|
Catches a broken upstream packaging at the pinned digest. Requires
|
||||||
- Image's ENTRYPOINT/CMD match what claude_bottle.pipelock assumes
|
docker."""
|
||||||
(`/pipelock` and `run --listen 0.0.0.0:8888`).
|
|
||||||
- The /pipelock binary actually runs (--version succeeds)."""
|
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -17,7 +13,6 @@ from tests._docker import skip_unless_docker
|
|||||||
class TestPipelockImage(unittest.TestCase):
|
class TestPipelockImage(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
# Pull the pinned image (cheap if cached).
|
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["docker", "pull", PIPELOCK_IMAGE],
|
["docker", "pull", PIPELOCK_IMAGE],
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
@@ -26,22 +21,6 @@ class TestPipelockImage(unittest.TestCase):
|
|||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
raise unittest.SkipTest(f"could not pull {PIPELOCK_IMAGE}")
|
raise unittest.SkipTest(f"could not pull {PIPELOCK_IMAGE}")
|
||||||
|
|
||||||
def test_entrypoint_contains_pipelock(self):
|
|
||||||
result = subprocess.run(
|
|
||||||
["docker", "image", "inspect", PIPELOCK_IMAGE,
|
|
||||||
"--format", "{{json .Config.Entrypoint}}"],
|
|
||||||
capture_output=True, text=True,
|
|
||||||
)
|
|
||||||
self.assertIn("/pipelock", result.stdout)
|
|
||||||
|
|
||||||
def test_cmd_contains_run(self):
|
|
||||||
result = subprocess.run(
|
|
||||||
["docker", "image", "inspect", PIPELOCK_IMAGE,
|
|
||||||
"--format", "{{json .Config.Cmd}}"],
|
|
||||||
capture_output=True, text=True,
|
|
||||||
)
|
|
||||||
self.assertIn("run", result.stdout)
|
|
||||||
|
|
||||||
def test_binary_runs(self):
|
def test_binary_runs(self):
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["docker", "run", "--rm", PIPELOCK_IMAGE, "--version"],
|
["docker", "run", "--rm", PIPELOCK_IMAGE, "--version"],
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
"""Unit: pipelock naming helpers (container_name, proxy_url, proxy_host_port)."""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
from claude_bottle.pipelock import (
|
|
||||||
pipelock_container_name,
|
|
||||||
pipelock_proxy_host_port,
|
|
||||||
pipelock_proxy_url,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestPipelockNaming(unittest.TestCase):
|
|
||||||
def test_container_name_simple(self):
|
|
||||||
self.assertEqual("claude-bottle-pipelock-foo", pipelock_container_name("foo"))
|
|
||||||
|
|
||||||
def test_container_name_with_hyphens(self):
|
|
||||||
self.assertEqual(
|
|
||||||
"claude-bottle-pipelock-some-slug", pipelock_container_name("some-slug")
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_proxy_url_default_port(self):
|
|
||||||
self.assertEqual(
|
|
||||||
"http://claude-bottle-pipelock-foo:8888", pipelock_proxy_url("foo")
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_proxy_host_port_default_port(self):
|
|
||||||
self.assertEqual(
|
|
||||||
"claude-bottle-pipelock-foo:8888", pipelock_proxy_host_port("foo")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
||||||
Reference in New Issue
Block a user