def test_get_build_type_oemconfig_section(self): xml_data = self.description.load() state = XMLState(xml_data, None, 'oem') assert state.get_build_type_oemconfig_section().get_oem_swap()[0] is \ True
def test_get_oemconfig_swap_mbytes(self): xml_data = self.description.load() state = XMLState(xml_data, ['containerFlavour'], 'docker') assert state.get_oemconfig_swap_mbytes() is None state = XMLState(xml_data, ['vmxFlavour'], 'oem') assert state.get_oemconfig_swap_mbytes() == 42
def test_is_xen_guest_by_architecture(self, mock_platform_machine): mock_platform_machine.return_value = 'unsupported' xml_data = self.description.load() state = XMLState(xml_data, ['ec2Flavour'], 'oem') assert state.is_xen_guest() is False
def test_build_type_not_found(self): description = XMLDescription('../data/example_config.xml') xml_data = description.load() XMLState(xml_data, ['vmxFlavour'], 'foo')
def test_add_container_label_without_contianerconfig(self): xml_data = self.description.load() state = XMLState(xml_data, ['xenDom0Flavour'], 'docker') state.add_container_config_label('somelabel', 'newlabelvalue') config = state.get_container_config() assert config['labels'] == {'somelabel': 'newlabelvalue'}
def test_set_derived_from_image_uri(self): xml_data = self.description.load() state = XMLState(xml_data, ['derivedContainer'], 'docker') state.set_derived_from_image_uri('file:///new_uri') assert state.get_derived_from_image_uri().translate() == '/new_uri'
def test_build_type_explicitly_selected(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxFlavour'], 'oem') assert state.get_build_type_name() == 'oem'
def test_get_build_type_vmconfig_entries_no_machine_section(self): description = XMLDescription('../data/example_disk_config.xml') xml_data = description.load() state = XMLState(xml_data) assert state.get_build_type_vmconfig_entries() == []
def test_get_build_type_oemconfig_section(self): description = XMLDescription('../data/example_config.xml') xml_data = description.load() state = XMLState(xml_data, None, 'oem') assert state.get_build_type_oemconfig_section().get_oem_swap()[0] is \ True
def test_get_volume_management_lvm_default(self): description = XMLDescription('../data/example_lvm_default_config.xml') xml_data = description.load() state = XMLState(xml_data) assert state.get_volume_management() == 'lvm'
def test_get_build_type_pxedeploy_section(self): description = XMLDescription('../data/example_pxe_config.xml') xml_data = description.load() state = XMLState(xml_data, None, 'pxe') assert state.get_build_type_pxedeploy_section().get_server() == \ '192.168.100.2'
def test_get_build_type_machine_section(self): description = XMLDescription('../data/example_config.xml') xml_data = description.load() state = XMLState(xml_data, None, 'vmx') assert state.get_build_type_machine_section().get_guestOS() == 'suse'
def test_profile_not_found(self): description = XMLDescription('../data/example_config.xml') xml_data = description.load() XMLState(xml_data, ['foo'])
def test_get_oemconfig_swap_mbytes_default(self): description = XMLDescription('../data/example_btrfs_config.xml') xml_data = description.load() state = XMLState(xml_data) assert state.get_oemconfig_swap_mbytes() == 128
def test_build_type_not_found(self): xml_data = self.description.load() with raises(KiwiTypeNotFound): XMLState(xml_data, ['vmxFlavour'], 'foo')
def test_get_build_type_vmconfig_entries_for_simple_disk(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxSimpleFlavour'], 'oem') assert state.get_build_type_vmconfig_entries() == [ 'numvcpus = "4"', 'cpuid.coresPerSocket = "2"' ]
def test_build_type_not_found_no_default_type(self): description = XMLDescription('../data/example_no_default_type.xml') xml_data = description.load() with raises(KiwiTypeNotFound): XMLState(xml_data, ['minimal'])
def test_set_container_tag(self): xml_data = self.description.load() state = XMLState(xml_data, ['containerFlavour'], 'docker') state.set_container_config_tag('new_tag') config = state.get_container_config() assert config['container_tag'] == 'new_tag'
def test_profile_not_found(self): xml_data = self.description.load() with raises(KiwiProfileNotFound): XMLState(xml_data, ['foo'])
def test_get_derived_from_image_uri(self): xml_data = self.description.load() state = XMLState(xml_data, ['derivedContainer'], 'docker') assert state.get_derived_from_image_uri().uri == \ 'obs://project/repo/image#mytag'
def test_profile_requires(self): xml_data = self.description.load() xml_state = XMLState(xml_data, ['composedProfile']) assert xml_state.profiles == [ 'composedProfile', 'vmxSimpleFlavour', 'xenDomUFlavour' ]
def test_is_xen_guest_by_firmware_setup(self, mock_platform_machine): mock_platform_machine.return_value = 'x86_64' xml_data = self.description.load() state = XMLState(xml_data, ['ec2Flavour'], 'oem') assert state.is_xen_guest() is True
def test_get_build_type_machine_section(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxSimpleFlavour'], 'oem') assert state.get_build_type_machine_section().get_guestOS() == 'suse'
def test_setup_ix86(self, mock_machine): mock_machine.return_value = 'i686' description = XMLDescription('../data/example_disk_config.xml') disk_builder = DiskBuilder(XMLState(description.load()), 'target_dir', 'root_dir') assert disk_builder.arch == 'ix86'
def test_build_type_explicitly_selected(self): description = XMLDescription('../data/example_config.xml') xml_data = description.load() state = XMLState(xml_data, ['vmxFlavour'], 'vmx') assert state.get_build_type_name() == 'vmx'