mirror of
https://github.com/containers/podman-compose.git
synced 2025-01-23 06:18:40 +01:00
Merge pull request #945 from p12tic/split-gpu-test
test: Split test_gpu test
This commit is contained in:
commit
3bb305cef4
@ -326,14 +326,13 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def test_gpu(self):
|
async def test_gpu_count_all(self):
|
||||||
c = create_compose_mock()
|
c = create_compose_mock()
|
||||||
|
|
||||||
cnt = get_minimal_container()
|
cnt = get_minimal_container()
|
||||||
cnt["command"] = ["nvidia-smi"]
|
cnt["command"] = ["nvidia-smi"]
|
||||||
cnt["deploy"] = {"resources": {"reservations": {"devices": [{}]}}}
|
cnt["deploy"] = {"resources": {"reservations": {"devices": [{}]}}}
|
||||||
|
|
||||||
# count: all
|
|
||||||
cnt["deploy"]["resources"]["reservations"]["devices"][0] = {
|
cnt["deploy"]["resources"]["reservations"]["devices"][0] = {
|
||||||
"driver": "nvidia",
|
"driver": "nvidia",
|
||||||
"count": "all",
|
"count": "all",
|
||||||
@ -356,11 +355,23 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# count: 2
|
async def test_gpu_count_specific(self):
|
||||||
cnt["deploy"]["resources"]["reservations"]["devices"][0] = {
|
c = create_compose_mock()
|
||||||
"driver": "nvidia",
|
|
||||||
"count": 2,
|
cnt = get_minimal_container()
|
||||||
"capabilities": ["gpu"],
|
cnt["command"] = ["nvidia-smi"]
|
||||||
|
cnt["deploy"] = {
|
||||||
|
"resources": {
|
||||||
|
"reservations": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"driver": "nvidia",
|
||||||
|
"count": 2,
|
||||||
|
"capabilities": ["gpu"],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args = await container_to_args(c, cnt)
|
args = await container_to_args(c, cnt)
|
||||||
@ -381,11 +392,23 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# device_ids: all
|
async def test_gpu_device_ids_all(self):
|
||||||
cnt["deploy"]["resources"]["reservations"]["devices"][0] = {
|
c = create_compose_mock()
|
||||||
"driver": "nvidia",
|
|
||||||
"device_ids": "all",
|
cnt = get_minimal_container()
|
||||||
"capabilities": ["gpu"],
|
cnt["command"] = ["nvidia-smi"]
|
||||||
|
cnt["deploy"] = {
|
||||||
|
"resources": {
|
||||||
|
"reservations": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"driver": "nvidia",
|
||||||
|
"device_ids": "all",
|
||||||
|
"capabilities": ["gpu"],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args = await container_to_args(c, cnt)
|
args = await container_to_args(c, cnt)
|
||||||
@ -404,11 +427,23 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# device_ids: 1,3
|
async def test_gpu_device_ids_specific(self):
|
||||||
cnt["deploy"]["resources"]["reservations"]["devices"][0] = {
|
c = create_compose_mock()
|
||||||
"driver": "nvidia",
|
|
||||||
"device_ids": [1, 3],
|
cnt = get_minimal_container()
|
||||||
"capabilities": ["gpu"],
|
cnt["command"] = ["nvidia-smi"]
|
||||||
|
cnt["deploy"] = {
|
||||||
|
"resources": {
|
||||||
|
"reservations": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"driver": "nvidia",
|
||||||
|
"device_ids": [1, 3],
|
||||||
|
"capabilities": ["gpu"],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args = await container_to_args(c, cnt)
|
args = await container_to_args(c, cnt)
|
||||||
|
Loading…
Reference in New Issue
Block a user