From ac54e2c4876ff54f28ddf96f02ac98a16f94dc2e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 25 Sep 2026 14:53:50 +0200 Subject: [PATCH] test(compose): pin the GPU count the file list now depends on Both modules pin every environment variable compose_file_args() reads. Adding Profile.gpu_reservable() in 4d09286d8b added INFINITO_GPU_COUNT as a reader without pinning it, so the expectation silently followed the ambient environment: green on a shell that has no such variable, red in the test container where BASH_ENV injects .env and this host reads 'all'. That was eight of the unit failures in the gate. Pin it to 0 in the three affected fixtures and add the two cases the gate never had: no GPU means no override, a non-zero count adds it. Co-Authored-By: Claude Opus 5 (1M context) --- .../deploy/development/test_compose.py | 2 ++ .../development/test_env_compose_file_args.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/unit/python/cli/administration/deploy/development/test_compose.py b/tests/unit/python/cli/administration/deploy/development/test_compose.py index 37ddf77306..0c0edca26a 100644 --- a/tests/unit/python/cli/administration/deploy/development/test_compose.py +++ b/tests/unit/python/cli/administration/deploy/development/test_compose.py @@ -95,6 +95,7 @@ class TestComposeUpRetries(unittest.TestCase): "INFINITO_GIT_COMMON_DIR": "", "INFINITO_CACHE_NETWORK": "", "INFINITO_CACHE_STACK": "", + "INFINITO_GPU_COUNT": "0", }, clear=False, ) @@ -146,6 +147,7 @@ class TestComposeUpRetries(unittest.TestCase): "INFINITO_GIT_COMMON_DIR": "", "INFINITO_CACHE_NETWORK": "", "INFINITO_CACHE_STACK": "", + "INFINITO_GPU_COUNT": "0", }, clear=False, ) diff --git a/tests/unit/python/cli/administration/deploy/development/test_env_compose_file_args.py b/tests/unit/python/cli/administration/deploy/development/test_env_compose_file_args.py index ee079c74ba..52599cb7ba 100644 --- a/tests/unit/python/cli/administration/deploy/development/test_env_compose_file_args.py +++ b/tests/unit/python/cli/administration/deploy/development/test_env_compose_file_args.py @@ -22,6 +22,7 @@ _LOCAL_PRIMARY = { "INFINITO_CACHE_NETWORK": "", "INFINITO_CACHE_STACK": "", "INFINITO_PUBLISH_PORTS": "", + "INFINITO_GPU_COUNT": "0", } _WORKTREE = { @@ -124,6 +125,18 @@ class TestComposeFileArgs(unittest.TestCase): def test_unpublished_ports_add_the_noports_override(self) -> None: self.assertIn("compose/noports.override.yml", compose_file_args()) + @patch.dict(os.environ, _LOCAL_PRIMARY, clear=False) + def test_a_host_without_a_gpu_reserves_none(self) -> None: + self.assertNotIn("compose/gpu.override.yml", compose_file_args()) + + @patch.dict( + os.environ, + {**_LOCAL_PRIMARY, "INFINITO_GPU_COUNT": "all"}, + clear=False, + ) + def test_a_host_with_a_gpu_adds_the_reservation(self) -> None: + self.assertIn("compose/gpu.override.yml", compose_file_args()) + if __name__ == "__main__": # pragma: no cover unittest.main()