diff --git a/tests/routes/health_test.py b/tests/routes/health_test.py index da2758371..0fe254ba2 100644 --- a/tests/routes/health_test.py +++ b/tests/routes/health_test.py @@ -70,6 +70,10 @@ def test_containers(skale_bp, dutils): ) } assert data == expected + for container_info in data['payload']: + field_map = {'cpu_shares': 0, 'mem_limit': 0, 'swap_limit': 0, 'swappiness': None} + for field, value in field_map.items(): + assert container_info[field] == value def test_containers_all(skale_bp, dutils, schain_db, cleanup_schain_containers): @@ -85,6 +89,10 @@ def test_containers_all(skale_bp, dutils, schain_db, cleanup_schain_containers): ) } assert data == expected + for container_info in data['payload']: + field_map = {'cpu_shares': 0, 'mem_limit': 0, 'swap_limit': 0, 'swappiness': None} + for field, value in field_map.items(): + assert container_info[field] == value def test_schains_checks(skale_bp, skale, schain_on_contracts, schain_db, dutils): diff --git a/tools/docker_utils.py b/tools/docker_utils.py index 1b13d062e..b60d00459 100644 --- a/tools/docker_utils.py +++ b/tools/docker_utils.py @@ -69,7 +69,11 @@ def inner(*args, **kwargs) -> list: res.append({ 'image': container.attrs['Config']['Image'], 'name': re.sub('/', '', container.attrs['Name']), - 'state': container.attrs['State'] + 'state': container.attrs['State'], + 'cpu_shares': container.attrs['HostConfig']['CpuShares'], + 'mem_limit': container.attrs['HostConfig']['Memory'], + 'swap_limit': container.attrs['HostConfig']['MemorySwap'], + 'swappiness': container.attrs['HostConfig']['MemorySwappiness'] }) return res