HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ns3133907 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64
User: cssnetorguk (1024)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //proc/self/root/snap/lxd/32662/lib/python3/dist-packages/ceph/tests/test_inventory.py
import json
import os
import pytest

from ceph.deployment.inventory import Devices


@pytest.mark.parametrize("filename",
                         [
                             os.path.dirname(__file__) + '/c-v-inventory.json',
                             os.path.dirname(__file__) + '/../../../pybind/mgr/test_orchestrator/du'
                                                         'mmy_data.json',
                         ])
def test_from_json(filename):
    with open(filename) as f:
        data = json.load(f)
    if 'inventory' in data:
        data = data['inventory']
    ds = Devices.from_json(data)
    assert len(ds.devices) == len(data)
    assert Devices.from_json(ds.to_json()) == ds