Esempio n. 1
0
def test_get_volume(vg):
    create(FIRST_VOLUME_NAME, '250m')

    name = get_volume(FIRST_VOLUME_NAME)
    assert name == FIRST_VOLUME_NAME
    assert get_volume('Not-existing-volume') is None

    remove(FIRST_VOLUME_NAME)
Esempio n. 2
0
def test_mount_unmount(vg):
    create(FIRST_VOLUME_NAME, '250m')

    mount(FIRST_VOLUME_NAME)

    mountpoint = path(FIRST_VOLUME_NAME)
    assert mountpoint == '/dev/mapper/schains-vol--a'

    unmount(FIRST_VOLUME_NAME)
    with pytest.raises(LvmPyError):
        path(FIRST_VOLUME_NAME)

    remove(FIRST_VOLUME_NAME)
Esempio n. 3
0
def test_create_remove(vg):
    create(FIRST_VOLUME_NAME, '250m')
    create(SECOND_VOLUME_NAME, '300m')

    lvs = volumes()
    assert FIRST_VOLUME_NAME in lvs
    assert SECOND_VOLUME_NAME in lvs

    with pytest.raises(LvmPyError):
        create(FIRST_VOLUME_NAME, '250m')

    remove(FIRST_VOLUME_NAME)
    remove(SECOND_VOLUME_NAME)

    lvs = volumes()
    assert FIRST_VOLUME_NAME not in lvs
    assert SECOND_VOLUME_NAME not in lvs
Esempio n. 4
0
def test_remove_not_existing(vg):
    with pytest.raises(LvmPyError):
        remove('Not-existing-volume')
Esempio n. 5
0
def remove(path, name):
    ''' Remove a repository. '''
    core.remove(path, name)