예제 #1
0
    def test_git_repo_param_helper(self):
        config = """git_repo_foo_uri = git://git.foo.org/foo.git
git_repo_foo_branch = next
git_repo_foo_lbranch = local
git_repo_foo_commit = bc732ad8b2ed8be52160b893735417b43a1e91a8
"""
        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        h = virt_utils.GitRepoParamHelper(params, 'foo', '/tmp/foo')
        self.assertEqual(h.name, 'foo')
        self.assertEqual(h.branch, 'next')
        self.assertEqual(h.lbranch, 'local')
        self.assertEqual(h.commit, 'bc732ad8b2ed8be52160b893735417b43a1e91a8')
예제 #2
0
    def get_koji_qemu_kvm_tag_pkgs(self, config_file):
        tag = None
        pkgs = None
        parser = cartesian_config.Parser(config_file)
        for d in parser.get_dicts():
            if tag is not None and pkgs is not None:
                break

            if d.has_key('koji_qemu_kvm_tag'):
                if tag is None:
                    tag = d.get('koji_qemu_kvm_tag')
            if d.has_key('koji_qemu_kvm_pkgs'):
                if pkgs is None:
                    pkgs = d.get('koji_qemu_kvm_pkgs')
        return (tag, pkgs)
예제 #3
0
    def test_make_installer(self):
        config = """install_mode = test_install_mode
vm_type = test"""

        class Installer:
            def __init__(self, mode, name, test, params):
                pass

        installer.INSTALLER_REGISTRY.register('test_install_mode', Installer,
                                              'test')

        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        instance = installer.make_installer("test_install_mode_test", params)
        self.assertTrue(isinstance(instance, Installer))
예제 #4
0
 def setUp(self):
     """
     Runs before every test
     """
     # MAC generator produces from incrementing byte list
     # at random starting point (class property).
     # make sure it starts counting at zero before every test
     virt_utils.VirtIface.LASTBYTE = -1
     # These warnings are annoying during testing
     virt_utils.VMNet.DISCARD_WARNINGS - 1
     parser = cartesian_config.Parser()
     parser.parse_string(self.nettests_cartesian)
     self.CartesianResult = []
     for d in parser.get_dicts():
         params = virt_utils.Params(d)
         self.CartesianResult.append(params)
         for vm_name in params.objects('vms'):
             vm = params.object_params(vm_name)
             nics = vm.get('nics')
             if nics and len(nics.split()) > 0:
                 self.db_item_count += 1