Exemple #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
Exemple #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
Exemple #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
Exemple #4
0
 def test_build_type_not_found(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     XMLState(xml_data, ['vmxFlavour'], 'foo')
Exemple #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'}
Exemple #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'
Exemple #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'
Exemple #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() == []
Exemple #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
Exemple #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'
Exemple #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'
Exemple #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'
Exemple #13
0
 def test_profile_not_found(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     XMLState(xml_data, ['foo'])
Exemple #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
Exemple #15
0
 def test_build_type_not_found(self):
     xml_data = self.description.load()
     with raises(KiwiTypeNotFound):
         XMLState(xml_data, ['vmxFlavour'], 'foo')
Exemple #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"'
     ]
Exemple #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'])
Exemple #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'
Exemple #19
0
 def test_profile_not_found(self):
     xml_data = self.description.load()
     with raises(KiwiProfileNotFound):
         XMLState(xml_data, ['foo'])
Exemple #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'
Exemple #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'
     ]
Exemple #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
Exemple #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'
Exemple #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'
Exemple #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'