示例#1
0
 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
示例#2
0
 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
示例#3
0
 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
示例#4
0
 def test_build_type_not_found(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     XMLState(xml_data, ['vmxFlavour'], 'foo')
示例#5
0
 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'}
示例#6
0
 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'
示例#7
0
 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'
示例#8
0
 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() == []
示例#9
0
 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
示例#10
0
 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'
示例#11
0
 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'
示例#12
0
 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'
示例#13
0
 def test_profile_not_found(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     XMLState(xml_data, ['foo'])
示例#14
0
 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
示例#15
0
 def test_build_type_not_found(self):
     xml_data = self.description.load()
     with raises(KiwiTypeNotFound):
         XMLState(xml_data, ['vmxFlavour'], 'foo')
示例#16
0
 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"'
     ]
示例#17
0
 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'])
示例#18
0
 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'
示例#19
0
 def test_profile_not_found(self):
     xml_data = self.description.load()
     with raises(KiwiProfileNotFound):
         XMLState(xml_data, ['foo'])
示例#20
0
 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'
示例#21
0
 def test_profile_requires(self):
     xml_data = self.description.load()
     xml_state = XMLState(xml_data, ['composedProfile'])
     assert xml_state.profiles == [
         'composedProfile', 'vmxSimpleFlavour', 'xenDomUFlavour'
     ]
示例#22
0
 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
示例#23
0
 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'
示例#24
0
 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'
示例#25
0
 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'