# tests.storage.cases package — Anaconda 25.14 documentation

# tests.storage.cases package

## Submodules

## tests.storage.cases.bz1014545 module

class `tests.storage.cases.bz1014545.``BZ1014545_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'The members of various commands must have the correct format.\nFor instance, raid members must have mdmember, and volgroup members must have\nlvmpv. If they do not have this format, a KickstartParseError should be raised\nduring storage execution time.\n\nNote that this is different from the error condition described in the bug.\nThere, anaconda was letting the invalid format go and then hitting errors\nmuch further in installation - during bootloader installation. The real\nbug is that this condition should be detected when the kickstart storage\ncommands are being converted to actions.\n'
  `name` = '1014545'

## tests.storage.cases.bz1067707 module

class `tests.storage.cases.bz1067707.``BZ1067707_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'Partition lines do not necessarily require a size to be\nspecified. There are plenty of reasons why a user might not do this: putting\na filesystem on a given pre-existing partition, giving a resize or maxsize\noption, or (in this case) asking for the recommended swap size.\n'
  `name` = '1067707'

## tests.storage.cases.reuse module

class `tests.storage.cases.reuse.``PartitionReuse_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'Test that a disk with pre-existing partitioning as a\nresult of a previous installation with partition-based autopart works.\n'
  `name` = 'PartitionReuse'

class `tests.storage.cases.reuse.``LVMReuse_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'Test that a disk with pre-existing LVM partitioning as a\nresult of a previous installation with LVM-based autopart works.\n'
  `name` = 'LVMReuse'

class `tests.storage.cases.reuse.``BTRFSReuse_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'Test that a disk with pre-existing BTRFS partitioning as a\nresult of a previous installation with BTRFS-based autopart works.\n'
  `name` = 'BTRFSReuse'

class `tests.storage.cases.reuse.``ThinpReuse_TestCase`

  Bases: `tests.storage.cases.TestCase`

  `desc` = 'Test that a disk with pre-existing thinp partitioning as a\nresult of a previous installation with thinp autopart works.\n'
  `name` = 'ThinpReuse'

## Module contents

exception `tests.storage.cases.``FailedTest`(got, expected)

  Bases: `Exception`

class `tests.storage.cases.``ReusableTestCaseComponent`

  Bases: `tests.storage.cases.TestCaseComponent`

  A version of TestCaseComponent that does not remove its disk images after use. In this way, a later TestCaseComponent can reuse them. This is handy for test cases that need pre-existing partitioning.

  See further comments in ReusingTestCaseComponent.

  Create a new TestCaseComponent instance. This __init__ method should typically do very little. However, subclasses must be sure to set self.disksToCreate. This attribute is a list of (disk name, blivet.Size) tuples that will be used in this test. Disks given in this list will be automatically created by setupDisks and destroyed by tearDownDisks.

  `tearDownDisks`()

class `tests.storage.cases.``ReusingTestCaseComponent`(reusedComponents=None)

  Bases: `tests.storage.cases.TestCaseComponent`

  A version of TestCaseComponent that reuses existing disk images rather than create its own. It will, however, delete these disk images after use.

  This class knows which disk images to reuse by the reusedComponents parameter passed in at object instantiation. This is a list of other TestCaseComponent instances. This class will reuse all disk images from each instance in that list, in the order given.

  A typical pipeline of components would thus look like this:

  > class ComponentA(ReusableTestCaseComponent):
  >   ...
  > class ComponentB(ReusingTestCaseComponent):
  >   ...

  > ComponentA -> ComponentB

  A component may also derive from both, if it’s in the middle of the pipeline:

  > class ComponentA(ReusableTestCaseComponent):
  >   ...
  > class ComponentB(ReusableTestCaseComponent, ReusingTestCaseComponent):
  >   ...
  > class ComponentC(ReusingTestCaseComponent):
  >   ...

  > ComponentA -> ComponentB -> ComponentC

  Create a new ReusingTestCaseComponent. reusedComponents is a list of other TestCaseComponent objects that this instance should make use of. All disk images in that list will be used by this instance, and all will be cleaned up at the end of the test.

  `setupDisks`(ksdata)

class `tests.storage.cases.``TestCase`

  Bases: `object`

  A TestCase is a way of grouping related TestCaseComponent objects together into a single place. It provides a way of iterating through all these components, running each, and tabulating the results. If any component fails, the entire TestCase fails.

  Class attributes:

  desc – A description of what this test is supposed to be
    testing.

  name – An identifying string given to this TestCase. platforms – A list of blivet.platform.Platform subclasses that this

  > TestCase is valid for. This TestCase will only run on matching platforms. If the list is empty, it is assumed to be valid for all platforms.

  `desc` = ''
  `name` = ''
  `platforms` = []
  `run`()

    Iterate over all components, running each, and collecting the results.

class `tests.storage.cases.``TestCaseComponent`

  Bases: `object`

  A TestCaseComponent is one individual test that runs as part of a TestCase. It consists of a set of disk images provided by self.disksToCreate, a kickstart storage snippet provided by self.ks, and an expected error condition provided by self.expectedExceptionType and self.expectedExceptionText. If the TestCaseComponent is expected to succeed, these latter two should just be set to None.

  A TestCaseComponent succeeds in the following cases:

  - No exception is encountered, and self.expectedExceptionType is None.

  A TestCaseComponent fails in all other cases.

  Class attributes:

  name – An identifying string given to this TestCaseComponent.

  Create a new TestCaseComponent instance. This __init__ method should typically do very little. However, subclasses must be sure to set self.disksToCreate. This attribute is a list of (disk name, blivet.Size) tuples that will be used in this test. Disks given in this list will be automatically created by setupDisks and destroyed by tearDownDisks.

  `expectedExceptionText`

    Should this test component be expected to fail, this property returns a regular expression that the raised exception’s text must match. Otherwise, this property returns None. All components that are expected to fail should override this property.

  `expectedExceptionType`

    Should this test component be expected to fail, this property returns the exception type. If this component is not expected to fail, this property returns None. All components that are expected to fail should override this property.

  `ks`

    Return the storage-specific portion of a kickstart file used for performing this test. The kickstart snippet must be provided as text. Only storage commands will be tested. No bootloader actions will be performed.

  `name` = ''
  `setupDisks`(ksdata)

    Create all disk images given by self.disksToCreate and initialize the storage module. Subclasses may override this method, but they should be sure to call the base method as well.

  `tearDownDisks`()

    Disable any disk images used by this test component and remove their image files from the host system. Subclasses may override this method, but they should call the base method as well to make sure the images get destroyed.