Ejemplo n.º 1
0
def test_drive_selection():
    devs = DeviceSelection(paths=['/dev/sda'])
    spec = DriveGroupSpec('node_name', data_devices=devs)
    assert spec.data_devices.paths == ['/dev/sda']

    with pytest.raises(DriveGroupValidationError, match='exclusive'):
        DeviceSelection(paths=['/dev/sda'], rotates=False)
Ejemplo n.º 2
0
def test_DriveGroup():
    dg_json = {
        'host_pattern': 'hostname',
        'data_devices': {'paths': ['/dev/sda']}
    }

    dg = DriveGroupSpec.from_json(dg_json)
    assert dg.hosts(['hostname']) == ['hostname']
    assert dg.data_devices.paths == ['/dev/sda']
Ejemplo n.º 3
0
def test_DriveGroup():
    dg_json = {
        'host_pattern': 'hostname',
        'data_devices': {'paths': ['/dev/sda']}
    }

    dg = DriveGroupSpec.from_json(dg_json)
    assert dg.hosts(['hostname']) == ['hostname']
    assert dg.data_devices.paths == ['/dev/sda']
Ejemplo n.º 4
0
def test_drivegroup_pattern():
    dg = DriveGroupSpec('node[1-3]', DeviceSelection())
    assert dg.hosts(['node{}'.format(i)
                     for i in range(10)]) == ['node1', 'node2', 'node3']
Ejemplo n.º 5
0
def test_DriveGroup_fail():
    with pytest.raises(TypeError):
        DriveGroupSpec.from_json({})
Ejemplo n.º 6
0
def test_drivegroup_pattern():
    dg = DriveGroupSpec('node[1-3]', DeviceSelection())
    assert dg.hosts(['node{}'.format(i) for i in range(10)]) == ['node1', 'node2', 'node3']
Ejemplo n.º 7
0
def test_DriveGroup_fail():
    with pytest.raises(TypeError):
        DriveGroupSpec.from_json({})