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) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-25 14:53:50 +02:00
1 parent edc7b576ae
commit ac54e2c487
2 files changed
+15

No files matched your search

@@ -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,
)
@@ -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()