# diskimage_builder.block_device.tests package

## Subpackages

- diskimage_builder.block_device.tests.plugin package
  - Submodules
  - diskimage_builder.block_device.tests.plugin.test_a module
    - `TestA`
      - `TestA.get_nodes()`
    - `TestANode`
      - `TestANode.create()`
      - `TestANode.do_rollback()`
      - `TestANode.get_edges()`
      - `TestANode.umount()`
  - diskimage_builder.block_device.tests.plugin.test_b module
    - `TestB`
      - `TestB.get_nodes()`
    - `TestBNode`
      - `TestBNode.create()`
      - `TestBNode.do_rollback()`
      - `TestBNode.get_edges()`
      - `TestBNode.umount()`
  - Module contents

## Submodules

## diskimage_builder.block_device.tests.test_base module

class diskimage_builder.block_device.tests.test_base.TestBase(*args, **kwargs)

  Bases: `TestCase`

  Base for all test cases

  get_config_file(f)

    Get the full path to sample config file f

  load_config_file(f)

    Load f and return it after yaml parsing

  setUp()

    Hook method for setting up the test fixture before exercising it.

## diskimage_builder.block_device.tests.test_config module

class diskimage_builder.block_device.tests.test_config.TestConfig(*args, **kwargs)

  Bases: `TestBase`

  Helper for setting up and reading a config

  setUp()

    Hook method for setting up the test fixture before exercising it.

class diskimage_builder.block_device.tests.test_config.TestConfigParsing(*args, **kwargs)

  Bases: `TestConfig`

  Test parsing config file into a graph

  test_config_bad_plugin()
  test_config_multikey_node()
  test_deep_tree()
  test_graph()
  test_multipart_tree()
  test_simple_tree()

class diskimage_builder.block_device.tests.test_config.TestCreateGraph(*args, **kwargs)

  Bases: `TestGraphGeneration`

  test_deep_graph_generator()
  test_duplicate_name()
  test_invalid_missing()
  test_multiple_partitions_graph_generator()

class diskimage_builder.block_device.tests.test_config.TestGraphGeneration(*args, **kwargs)

  Bases: `TestConfig`

  Extra helper class for testing graph generation

  setUp()

    Hook method for setting up the test fixture before exercising it.

## diskimage_builder.block_device.tests.test_gpt module

class diskimage_builder.block_device.tests.test_gpt.TestGPT(*args, **kwargs)

  Bases: `TestGraphGeneration`

  test_gpt_efi(mock_exec_sudo)

## diskimage_builder.block_device.tests.test_lvm module

class diskimage_builder.block_device.tests.test_lvm.TestLVM(*args, **kwargs)

  Bases: `TestGraphGeneration`

  test_lvm_invalid_config()
  test_lvm_multi_pv(mock_exec_sudo)
  test_lvm_multi_pv_vg()
  test_lvm_multiple_partitions()
  test_lvm_spanned_vg()
  test_lvm_thin_provision(mock_exec_sudo)
  test_lvm_tree_to_graph()
  test_validate_lvs_type(mock_exec_sudo)

## diskimage_builder.block_device.tests.test_mbr module

class diskimage_builder.block_device.tests.test_mbr.TestMBR(*args, **kwargs)

  Bases: `TestBase`

  disk_size_10M = 10485760
  disk_size_1G = 1073741824
  setUp()

    Hook method for setting up the test fixture before exercising it.

  test_many_ext_partitions()

    Creates many partition and check correctness with partx.

  test_many_pri_and_ext_partition()

    Creates many primary and extended partitions.

  test_one_ext_partition(mock_os_fsync)

    Creates one partition and check correctness with partx.

  test_one_pri_partition()

    Creates one primary partition and check correctness with partx.

  test_pri_fat32_lba_partition()

    Creates a partition with a non-default ‘type’ and verifies.

  test_three_pri_partition()

    Creates three primary partition and check correctness with partx.

  test_zero_partitions()

    Creates no partition and check correctness with partx.

## diskimage_builder.block_device.tests.test_mkfs module

class diskimage_builder.block_device.tests.test_mkfs.TestMkfs(*args, **kwargs)

  Bases: `TestGraphGeneration`

  test_duplicate_labels()
  test_too_long_labels()

## diskimage_builder.block_device.tests.test_mount_order module

class diskimage_builder.block_device.tests.test_mount_order.TestMountComparator(*args, **kwargs)

  Bases: `TestBase`

  test_mount_comparator()

class diskimage_builder.block_device.tests.test_mount_order.TestMountOrder(*args, **kwargs)

  Bases: `TestGraphGeneration`

  test_mfks_and_mount_order(mock_exec_sudo_mkfs, mock_exec_sudo_mount)
  test_mount_order_unsorted(mock_exec_sudo)

## diskimage_builder.block_device.tests.test_state module

class diskimage_builder.block_device.tests.test_state.TestState(*args, **kwargs)

  Bases: `TestStateBase`

  test_missing_state()
  test_rollback()
  test_state_create()

class diskimage_builder.block_device.tests.test_state.TestStateBase(*args, **kwargs)

  Bases: `TestBase`

  setUp()

    Hook method for setting up the test fixture before exercising it.

## diskimage_builder.block_device.tests.test_utils module

class diskimage_builder.block_device.tests.test_utils.TestBlockDeviceUtils(*args, **kwargs)

  Bases: `TestBase`

  Tests for the utils.py

  This tests mostly the error and failure cases - because the good cases are tested implicitly with the higher level unit tests.

  test_broken_unit_spec()

    Call parse_abs_size_spec with a completely broken unit spec

  test_invalid_unit_spec()

    Call parse_abs_size_spec with invalid unit spec

  test_parse_abs_size_without_spec()

    Call parse_abs_size_spec without spec

  test_parse_rel_size_with_abs()

    Calls parse_rel_size_spec with an absolute number

  test_parse_size_spec()

## Module contents

this page last updated: 2023-06-08 20:53:31

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug