summaryrefslogtreecommitdiff
path: root/tests/vmtests/test_preserve_raid.py
blob: e4dc350d98cecd5b15fa94f7c8f28d233893e7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This file is part of curtin. See LICENSE file for copyright and license info.

from . import VMBaseClass
from .releases import base_vm_classes as relbase

import textwrap


class TestPreserveRAID(VMBaseClass):
    """ Test that curtin can reuse a RAID. """
    conf_file = "examples/tests/preserve-raid.yaml"
    extra_disks = ['10G', '10G', '10G']
    uefi = True
    extra_collect_scripts = [textwrap.dedent("""
        cd OUTPUT_COLLECT_D
        ls /srv > ls-srv
        exit 0
        """)]

    def test_existing_exists(self):
        self.assertIn('existing', self.load_collect_file('ls-srv'))


class BionicTestPreserveRAID(relbase.bionic, TestPreserveRAID):
    __test__ = True


class FocalTestPreserveRAID(relbase.focal, TestPreserveRAID):
    __test__ = True


class TestPartitionExistingRAID(VMBaseClass):
    """ Test that curtin can repartition an existing RAID. """
    conf_file = "examples/tests/partition-existing-raid.yaml"
    extra_disks = ['10G', '10G', '10G']
    uefi = True
    extra_collect_scripts = [textwrap.dedent("""
        cd OUTPUT_COLLECT_D
        lsblk --nodeps --noheading --raw --output PTTYPE /dev/md1 > md1-pttype
        exit 0
        """)]

    def test_correct_ptype(self):
        self.assertEqual('gpt', self.load_collect_file('md1-pttype').strip())


class BionicTestPartitionExistingRAID(
        relbase.bionic, TestPartitionExistingRAID):
    __test__ = True

    def test_correct_ptype(self):
        self.skipTest("lsblk on bionic does not support PTTYPE")


class FocalTestPartitionExistingRAID(
        relbase.focal, TestPartitionExistingRAID):
    __test__ = True


# vi: ts=4 expandtab syntax=python