def setupClass(cls):
        data_setup.create_labcontroller()
        cls.distro_one_name = data_setup.unique_name(u'nametest%s')
        cls.distro_one_osmajor = u'osmajortest1'
        cls.distro_one_osminor = u'1'
        cls.distro_one_variant = u'myvariant'
        cls.distro_one_tag = [u'MYTAG']

        cls.distro_one = data_setup.create_distro(name=cls.distro_one_name,
            osmajor=cls.distro_one_osmajor, osminor = cls.distro_one_osminor,
            tags =cls.distro_one_tag)
        cls.distro_tree_one = data_setup.create_distro_tree(distro=cls.distro_one,
            variant=cls.distro_one_variant)
        # Two days in the future
        cls.distro_two_name = data_setup.unique_name(u'nametest%s')
        cls.distro_two_osmajor = u'osmajortest2'
        cls.distro_two_osminor = u'2'

        cls.distro_two = data_setup.create_distro(name=cls.distro_two_name,
            osmajor=cls.distro_two_osmajor, osminor = cls.distro_two_osminor,)
        cls.distro_tree_two = data_setup.create_distro_tree(distro=cls.distro_two)
        cls.distro_tree_two.date_created = datetime.utcnow() + timedelta(days=2)

        cls.distro_three_name = data_setup.unique_name(u'nametest%s')
        cls.distro_three_osmajor = u'osmajortest3'
        cls.distro_three_osminor = u'3'

        cls.distro_three = data_setup.create_distro(name=cls.distro_three_name,
            osmajor=cls.distro_three_osmajor, osminor = cls.distro_three_osminor,)
        cls.distro_tree_three = data_setup.create_distro_tree(distro=cls.distro_three)
Example #2
0
    def test_search_by_tag(self):
        with session.begin():
            released_distro = data_setup.create_distro(
                tags=[u'STABLE', u'RELEASED'])
            data_setup.create_distro_tree(distro=released_distro)
            unreleased_distro = data_setup.create_distro(tags=[u'STABLE'])
            data_setup.create_distro_tree(distro=unreleased_distro)

        b = self.browser
        b.get(get_server_base() + 'distros')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name(
            'distrosearch-0.table')).select_by_visible_text('Tag')
        Select(b.find_element_by_name(
            'distrosearch-0.operation')).select_by_visible_text('is')
        Select(b.find_element_by_name(
            'distrosearch-0.value')).select_by_visible_text('RELEASED')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b,
                                    present=[released_distro],
                                    absent=[unreleased_distro])

        Select(b.find_element_by_name(
            'distrosearch-0.operation')).select_by_visible_text('is not')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b,
                                    present=[unreleased_distro],
                                    absent=[released_distro])
Example #3
0
 def test_displayalphaos(self):
     with session.begin():
         data_setup.create_distro(osmajor=u'LinuxLinux1.1')
     b = self.browser
     b.get(get_server_base() + 'osversions')
     b.find_element_by_link_text('L').click()
     self.assert_(b.find_elements_by_link_text('LinuxLinux1.1'))
Example #4
0
    def setupClass(cls):
        data_setup.create_labcontroller()
        cls.distro_one_name = data_setup.unique_name(u"nametest%s")
        cls.distro_one_osmajor = u"osmajortest1"
        cls.distro_one_osminor = u"1"
        cls.distro_one_variant = u"myvariant"
        cls.distro_one_tag = [u"MYTAG"]

        cls.distro_one = data_setup.create_distro(
            name=cls.distro_one_name,
            osmajor=cls.distro_one_osmajor,
            osminor=cls.distro_one_osminor,
            tags=cls.distro_one_tag,
        )
        cls.distro_tree_one = data_setup.create_distro_tree(distro=cls.distro_one, variant=cls.distro_one_variant)
        # Two days in the future
        cls.distro_two_name = data_setup.unique_name(u"nametest%s")
        cls.distro_two_osmajor = u"osmajortest2"
        cls.distro_two_osminor = u"2"

        cls.distro_two = data_setup.create_distro(
            name=cls.distro_two_name, osmajor=cls.distro_two_osmajor, osminor=cls.distro_two_osminor
        )
        cls.distro_tree_two = data_setup.create_distro_tree(distro=cls.distro_two)
        cls.distro_tree_two.date_created = datetime.utcnow() + timedelta(days=2)

        cls.distro_three_name = data_setup.unique_name(u"nametest%s")
        cls.distro_three_osmajor = u"osmajortest3"
        cls.distro_three_osminor = u"3"

        cls.distro_three = data_setup.create_distro(
            name=cls.distro_three_name, osmajor=cls.distro_three_osmajor, osminor=cls.distro_three_osminor
        )
        cls.distro_tree_three = data_setup.create_distro_tree(distro=cls.distro_three)
Example #5
0
 def test_displayalphaos(self):
     with session.begin():
         data_setup.create_distro(osmajor=u'LinuxLinux1.1')
     b = self.browser
     b.get(get_server_base() + 'osversions')
     b.find_element_by_link_text('L').click()
     self.assert_(b.find_elements_by_link_text('LinuxLinux1.1'))
    def setupClass(cls):
        data_setup.create_labcontroller()
        cls.distro_one_name = data_setup.unique_name(u'nametest%s')
        cls.distro_one_osmajor = u'osmajortest1'
        cls.distro_one_osminor = u'1'
        cls.distro_one_variant = u'myvariant'
        cls.distro_one_tag = [u'MYTAG']

        cls.distro_one = data_setup.create_distro(name=cls.distro_one_name,
            osmajor=cls.distro_one_osmajor, osminor = cls.distro_one_osminor,
            tags =cls.distro_one_tag)
        cls.distro_tree_one = data_setup.create_distro_tree(distro=cls.distro_one,
            variant=cls.distro_one_variant)
        # Two days in the future
        cls.distro_two_name = data_setup.unique_name(u'nametest%s')
        cls.distro_two_osmajor = u'osmajortest2'
        cls.distro_two_osminor = u'2'

        cls.distro_two = data_setup.create_distro(name=cls.distro_two_name,
            osmajor=cls.distro_two_osmajor, osminor = cls.distro_two_osminor,)
        cls.distro_tree_two = data_setup.create_distro_tree(distro=cls.distro_two)
        cls.distro_tree_two.date_created = datetime.utcnow() + timedelta(days=2)

        cls.distro_three_name = data_setup.unique_name(u'nametest%s')
        cls.distro_three_osmajor = u'osmajortest3'
        cls.distro_three_osminor = u'3'

        cls.distro_three = data_setup.create_distro(name=cls.distro_three_name,
            osmajor=cls.distro_three_osmajor, osminor = cls.distro_three_osminor,)
        cls.distro_tree_three = data_setup.create_distro_tree(distro=cls.distro_three)
Example #7
0
    def setupClass(cls):
        # Each distro needs to have a tree in some lab controller, otherwise it 
        # won't show up in search results.
        data_setup.create_labcontroller()

        cls.distro_one_name = data_setup.unique_name(u'nametest%s')
        cls.distro_one_osmajor = u'osmajortest1'
        cls.distro_one_osminor = u'1'
        cls.distro_one_tags = None

        cls.distro_one = data_setup.create_distro(name=cls.distro_one_name,
            osmajor=cls.distro_one_osmajor, osminor = cls.distro_one_osminor,
            tags =cls.distro_one_tags)
        data_setup.create_distro_tree(distro=cls.distro_one)
        # Two days in the future
        cls.distro_one.date_created = datetime.utcnow() + timedelta(days=2)
        cls.distro_two_name = data_setup.unique_name(u'nametest%s')
        cls.distro_two_osmajor = u'osmajortest2'
        cls.distro_two_osminor = u'2'
        cls.distro_two_tags = None

        cls.distro_two = data_setup.create_distro(name=cls.distro_two_name,
            osmajor=cls.distro_two_osmajor, osminor = cls.distro_two_osminor,
            tags =cls.distro_two_tags)
        data_setup.create_distro_tree(distro=cls.distro_two)

        cls.distro_three_name = data_setup.unique_name(u'nametest%s')
        cls.distro_three_osmajor = u'osmajortest3'
        cls.distro_three_osminor = u'3'
        cls.distro_three_tags = None

        cls.distro_three = data_setup.create_distro(name=cls.distro_three_name,
            osmajor=cls.distro_three_osmajor, osminor = cls.distro_three_osminor,
            tags =cls.distro_three_tags)
        data_setup.create_distro_tree(distro=cls.distro_three)
Example #8
0
    def setUpClass(cls):
        # Each distro needs to have a tree in some lab controller, otherwise it 
        # won't show up in search results.
        data_setup.create_labcontroller()

        cls.distro_one_name = data_setup.unique_name(u'nametest%s')
        cls.distro_one_osmajor = u'osmajortest1'
        cls.distro_one_osminor = u'1'
        cls.distro_one_tags = None

        cls.distro_one = data_setup.create_distro(name=cls.distro_one_name,
            osmajor=cls.distro_one_osmajor, osminor = cls.distro_one_osminor,
            tags =cls.distro_one_tags)
        data_setup.create_distro_tree(distro=cls.distro_one)
        # Two days in the future
        cls.distro_one.date_created = datetime.utcnow() + timedelta(days=2)
        cls.distro_two_name = data_setup.unique_name(u'nametest%s')
        cls.distro_two_osmajor = u'osmajortest2'
        cls.distro_two_osminor = u'2'
        cls.distro_two_tags = None

        cls.distro_two = data_setup.create_distro(name=cls.distro_two_name,
            osmajor=cls.distro_two_osmajor, osminor = cls.distro_two_osminor,
            tags =cls.distro_two_tags)
        data_setup.create_distro_tree(distro=cls.distro_two)

        cls.distro_three_name = data_setup.unique_name(u'nametest%s')
        cls.distro_three_osmajor = u'osmajortest3'
        cls.distro_three_osminor = u'3'
        cls.distro_three_tags = None

        cls.distro_three = data_setup.create_distro(name=cls.distro_three_name,
            osmajor=cls.distro_three_osmajor, osminor = cls.distro_three_osminor,
            tags =cls.distro_three_tags)
        data_setup.create_distro_tree(distro=cls.distro_three)
Example #9
0
 def setUp(self):
     self.browser = self.get_browser()
     data_setup.create_device(device_class="IDE") #needed for device page
     data_setup.create_distro() # needed for distro page
     data_setup.create_job() # needed for job page
     data_setup.create_task() #create task
     system = data_setup.create_system(shared=True)
     system.activity.append(data_setup.create_system_activity())
Example #10
0
 def setUp(self):
     self.browser = self.get_browser()
     data_setup.create_device(device_class="IDE")  #needed for device page
     data_setup.create_distro()  # needed for distro page
     data_setup.create_job()  # needed for job page
     data_setup.create_task()  #create task
     system = data_setup.create_system(shared=True)
     system.activity.append(data_setup.create_system_activity())
Example #11
0
 def setUp(self):
     self.verificationErrors = []
     self.selenium = self.get_selenium()
     self.selenium.start()
     data_setup.create_device(device_class="IDE") #needed for device page
     data_setup.create_distro() # needed for distro page
     data_setup.create_job() # needed for job page
     data_setup.create_task() #create task
     system = data_setup.create_system()
     system.shared = True
     system.activity.append(data_setup.create_system_activity())
Example #12
0
def setup_package():
    assert os.path.exists(CONFIG_FILE), 'Config file %s must exist' % CONFIG_FILE
    load_config(configfile=CONFIG_FILE)
    log_to_stream(sys.stdout, level=logging.DEBUG)

    from bkr.inttest import data_setup
    if not 'BEAKER_SKIP_INIT_DB' in os.environ:
        data_setup.setup_model()
    with session.begin():
        data_setup.create_labcontroller() #always need a labcontroller
        data_setup.create_task(name=u'/distribution/install', requires=
                u'make gcc nfs-utils wget procmail redhat-lsb ntp '
                u'@development-tools @development-libs @development '
                u'@desktop-platform-devel @server-platform-devel '
                u'libxml2-python expect pyOpenSSL'.split())
        data_setup.create_task(name=u'/distribution/reservesys',
                requires=u'emacs vim-enhanced unifdef sendmail'.split())
        data_setup.create_distro()

    if not os.path.exists(turbogears.config.get('basepath.rpms')):
        os.mkdir(turbogears.config.get('basepath.rpms'))

    setup_slapd()

    turbogears.testutil.make_app(Root)
    turbogears.testutil.start_server()

    if 'BEAKER_SERVER_BASE_URL' not in os.environ:
        # need to start the server ourselves
        # Usual pkg_resources ugliness is needed to ensure gunicorn doesn't
        # import pkg_resources before we get a chance to specify our
        # requirements in bkr.server.wsgi
        processes.extend([
            Process('gunicorn', args=[sys.executable, '-c',
                '__requires__ = ["CherryPy < 3.0"]; import pkg_resources; ' \
                'from gunicorn.app.wsgiapp import run; run()',
                '--bind', ':%s' % turbogears.config.get('server.socket_port'),
                '--workers', '8', '--access-logfile', '-', '--preload',
                'bkr.server.wsgi:application'],
                listen_port=turbogears.config.get('server.socket_port')),
        ])
    processes.extend([
        Process('slapd', args=['slapd', '-d0', '-F/tmp/beaker-tests-slapd-config',
                '-hldap://127.0.0.1:3899/'],
                listen_port=3899, stop_signal=signal.SIGINT),
    ])
    try:
        for process in processes:
            process.start()
    except:
        for process in processes:
            process.stop()
        raise
Example #13
0
def setup_package():
    log.info('Loading test configuration from %s', CONFIG_FILE)
    assert os.path.exists(CONFIG_FILE), 'Config file %s must exist' % CONFIG_FILE
    update_config(configfile=CONFIG_FILE, modulename='bkr.server.config')

    # Override loaded logging config, in case we are using the server's config file
    # (we really always want our tests' logs to go to stdout, not /var/log/beaker/)
    log_to_stream(sys.stdout, level=logging.NOTSET)

    from bkr.inttest import data_setup
    if not 'BEAKER_SKIP_INIT_DB' in os.environ:
        data_setup.setup_model()
    with session.begin():
        data_setup.create_labcontroller() #always need a labcontroller
        data_setup.create_task(name=u'/distribution/install', requires=
                u'make gcc nfs-utils wget procmail redhat-lsb ntp '
                u'@development-tools @development-libs @development '
                u'@desktop-platform-devel @server-platform-devel '
                u'libxml2-python expect pyOpenSSL'.split())
        data_setup.create_task(name=u'/distribution/reservesys',
                requires=u'emacs vim-enhanced unifdef sendmail'.split())
        data_setup.create_distro()

    if not os.path.exists(turbogears.config.get('basepath.rpms')):
        os.mkdir(turbogears.config.get('basepath.rpms'))

    setup_slapd()

    turbogears.testutil.make_app(Root)
    turbogears.testutil.start_server()

    if 'BEAKER_SERVER_BASE_URL' not in os.environ:
        # need to start the server ourselves
        # (this only works from the IntegrationTests dir of a Beaker checkout)
        processes.extend([
            Process('beaker', args=['../Server/start-server.py', CONFIG_FILE],
                    listen_port=turbogears.config.get('server.socket_port'),
                    stop_signal=signal.SIGINT)
        ])
    processes.extend([
        Process('slapd', args=['slapd', '-d0', '-F/tmp/beaker-tests-slapd-config',
                '-hldap://127.0.0.1:3899/'],
                listen_port=3899, stop_signal=signal.SIGINT),
    ])
    try:
        for process in processes:
            process.start()
    except:
        for process in processes:
            process.stop()
        raise
Example #14
0
 def test_existing_distro_row_with_incorrect_osversion(self):
     # We want to add 'RHEL6-bz825913' with osversion
     # 'RedHatEnterpriseLinux6.1'. But that distro already exists
     # with osversion 'RedHatEnterpriseLinux6.0'.
     name = "RHEL6-bz825913"
     with session.begin():
         data_setup.create_distro(name=name, osmajor=u"RedHatEnterpriseLinux6", osminor=u"0")
     distro_data = dict(self.distro_data)
     distro_data.update({"name": name, "osmajor": "RedHatEnterpriseLinux6", "osminor": "1"})
     self.server.auth.login_password(self.lc.user.user_name, u"logmein")
     self.server.labcontrollers.add_distro_tree(distro_data)
     with session.begin():
         distro = Distro.by_name(name)
         self.assertEquals(distro.osversion.osmajor.osmajor, u"RedHatEnterpriseLinux6")
         self.assertEquals(distro.osversion.osminor, u"1")
Example #15
0
 def test_tag_distro(self):
     with session.begin():
         self.distro = data_setup.create_distro()
     run_client(["bkr", "distros-tag", "--name", self.distro.name, "LOL"])
     with session.begin():
         session.refresh(self.distro)
         self.assert_(u"LOL" in self.distro.tags)
Example #16
0
 def test_tag_distro(self):
     with session.begin():
         self.distro = data_setup.create_distro()
     run_client(['bkr', 'distros-tag', '--name', self.distro.name, 'LOL'])
     with session.begin():
         session.refresh(self.distro)
         self.assert_(u'LOL' in self.distro.tags)
Example #17
0
    def setUp(self):
        self.distro = data_setup.create_distro()
        self.distro_tree1 = data_setup.create_distro_tree(distro=self.distro,
            arch='x86_64')
        self.distro_tree2 = data_setup.create_distro_tree(distro=self.distro,
            arch='i386')

        self.distro_tree1.activity.append(DistroTreeActivity(
            user=User.by_user_name(data_setup.ADMIN_USER),
            service=u'testdata', field_name=u'Nonesente',
            old_value=u'sdfas', new_value=u'sdfa', action='Added'))
        self.distro_tree2.activity.append(DistroTreeActivity(
            user=User.by_user_name(data_setup.ADMIN_USER), 
            service=u'testdata', field_name=u'Noneseonce',
            old_value=u'bsdf', new_value=u'sdfas', action='Added'))

        self.distro.activity.append(DistroActivity(
                user=User.by_user_name(data_setup.ADMIN_USER), service=u'testdata',
                action=u'Nothing', field_name=u'Nonsense',
                old_value=u'asdf', new_value=u'omgwtfbbq'))
        self.system = data_setup.create_system()
        self.system.activity.append(SystemActivity(
                user=User.by_user_name(data_setup.ADMIN_USER), service=u'testdata',
                action=u'Nothing', field_name=u'Nonsense',
                old_value=u'asdf', new_value=u'omgwtfbbq'))
        self.group2 = data_setup.create_group()
        self.group = data_setup.create_group()
        self.group.activity.append(GroupActivity(
                user=User.by_user_name(data_setup.ADMIN_USER), service=u'testdata',
                action=u'Nothing', field_name=u'Nonsense',
                old_value=u'asdf', new_value=u'omgwtfbbq'))
        self.browser = self.get_browser()
def create_rhel62():
    try:
        return Distro.by_name(u'RHEL-6.2')
    except DatabaseLookupError:
        rhel62 = data_setup.create_distro(name=u'RHEL-6.2',
                osmajor=u'RedHatEnterpriseLinux6', osminor=u'2')
        return rhel62
Example #19
0
 def test_untag_distro(self):
     with session.begin():
         self.distro = data_setup.create_distro(tags=[u'RELEASED', u'STABLE'])
     run_client(['bkr', 'distros-untag', '--name', self.distro.name, 'RELEASED'])
     with session.begin():
         session.refresh(self.distro)
         self.assertEquals(self.distro.tags, [u'STABLE'])
Example #20
0
 def test_tag_distro(self):
     with session.begin():
         self.distro = data_setup.create_distro()
     run_client(['bkr', 'distros-tag', '--name', self.distro.name, 'LOL'])
     with session.begin():
         session.refresh(self.distro)
         self.assert_(u'LOL' in self.distro.tags)
Example #21
0
 def test_successful_add_tag_for_all_distros(self):
     with session.begin():
         self.distro = data_setup.create_distro()
     out = run_client(['bkr', 'distros-tag', '--name=%', 'addAll'])
     with session.begin():
         session.expire_all()
         for distro in Distro.query:
             self.assertIn(u'addAll', distro.tags)
 def test_edit_distro_version(self):
     with session.begin():
         distro = data_setup.create_distro()
     run_client(["bkr", "distros-edit-version", "--name", distro.name, "SillyVersion2.1"])
     with session.begin():
         session.refresh(distro)
         self.assertEquals(distro.osversion.osmajor.osmajor, u"SillyVersion2")
         self.assertEquals(distro.osversion.osminor, u"1")
Example #23
0
def create_rhel62():
    try:
        return Distro.by_name(u'RHEL-6.2')
    except DatabaseLookupError:
        rhel62 = data_setup.create_distro(name=u'RHEL-6.2',
                                          osmajor=u'RedHatEnterpriseLinux6',
                                          osminor=u'2')
        return rhel62
Example #24
0
 def test_successful_add_tag_for_all_distros(self):
     with session.begin():
         self.distro = data_setup.create_distro()
     out = run_client(['bkr', 'distros-tag', '--name=%', 'addAll'])
     with session.begin():
         session.expire_all()
         for distro in Distro.query:
             self.assertIn(u'addAll', distro.tags)
Example #25
0
 def setUp(self):
     self.lc = data_setup.create_labcontroller()
     self.distro = data_setup.create_distro()
     self.distro_tree = data_setup.create_distro_tree(distro=self.distro,
         arch='x86_64', lab_controllers=[self.lc])
     self.server = self.get_server()
     user = User.by_user_name(data_setup.ADMIN_USER)
     user.groups[0].permissions[:] = user.groups[0].permissions + [ Permission.by_name('distro_expire')]
Example #26
0
 def setUp(self):
     i386 = Arch.by_name(u'i386')
     x86_64 = Arch.by_name(u'x86_64')
     self.distro = data_setup.create_distro(osmajor=u'MyAwesomeLinux',
                                            tags=[u'STABLE'],
                                            arches=[i386, x86_64])
     data_setup.create_distro_tree(distro=self.distro, arch=u'i386')
     data_setup.create_distro_tree(distro=self.distro, arch=u'x86_64')
 def test_edit_distro_version(self):
     with session.begin():
         distro = data_setup.create_distro()
     run_client(['bkr', 'distros-edit-version', '--name', distro.name,
             'SillyVersion2.1'])
     with session.begin():
         session.refresh(distro)
         self.assertEquals(distro.osversion.osmajor.osmajor, u'SillyVersion2')
         self.assertEquals(distro.osversion.osminor, u'1')
Example #28
0
 def test_untag_distro(self):
     with session.begin():
         self.distro = data_setup.create_distro(
             tags=[u'RELEASED', u'STABLE'])
     run_client(
         ['bkr', 'distros-untag', '--name', self.distro.name, 'RELEASED'])
     with session.begin():
         session.refresh(self.distro)
         self.assertEquals(self.distro.tags, [u'STABLE'])
Example #29
0
 def _create_i386_distro(self, lc):
     i386_distro = data_setup.create_distro(
         osmajor=u'RedHatEnterpriseLinux6', arches=[Arch.by_name('i386')])
     i386_distro_tree = data_setup.create_distro_tree(distro=i386_distro,
         lab_controllers=[lc],
         urls=[u'http://lab.test-kickstart.example.com/distros/RHEL-6.3/'
             'Workstation/i386/os/'],
         variant='Workstation')
     return i386_distro
Example #30
0
 def test_can_search_by_distro_name(self):
     with session.begin():
         distro1 = data_setup.create_distro()
         act1 = distro1.record_activity(service=u'testdata',
                 user=User.by_user_name(data_setup.ADMIN_USER),
                 action=u'Nothing', field=u'Nonsense',
                 old=u'asdf', new=u'omgwtfbbq')
         distro2 = data_setup.create_distro()
         act2 = distro2.record_activity(service=u'testdata',
                 user=User.by_user_name(data_setup.ADMIN_USER),
                 action=u'Nothing', field=u'Nonsense',
                 old=u'asdf', new=u'lollercopter')
     b = self.browser
     b.get(get_server_base() + 'activity/distro')
     b.find_element_by_class_name('search-query').send_keys(
             'distro.name:%s' % distro1.name)
     b.find_element_by_class_name('grid-filter').submit()
     check_activity_search_results(b, present=[act1], absent=[act2])
 def _create_i386_distro(self, lc):
     i386_distro = data_setup.create_distro(
         osmajor=u'RedHatEnterpriseLinux6', arches=[Arch.by_name(u'i386')])
     i386_distro_tree = data_setup.create_distro_tree(distro=i386_distro,
         lab_controllers=[lc],
         urls=[u'http://lab.test-kickstart.example.com/distros/RHEL-6.3/'
             u'Workstation/i386/os/'],
         variant=u'Workstation')
     return i386_distro
Example #32
0
 def test_looks_up_arches_for_suitable_osminor(self):
     # RHEL7 is the first time we have had differing arches across a single
     # OS major. We want the workflow command to use the set of arches for
     # the OS version which will actually match whatever distro filtering
     # options we are using, e.g. latest RedHatEnterpriseLinux7 should be
     # using RHEL7.2 arches, not RHEL7.0.
     with session.begin():
         older_arches = [u'x86_64', u's390x']
         older_distro = data_setup.create_distro(
             osmajor=u'DansAwesomeLinux8',
             osminor=u'0',
             arches=older_arches,
             date_created=datetime.datetime(2010, 1, 1, 0, 0),
             tags=[u'STABLE'])
         for arch in older_arches:
             data_setup.create_distro_tree(distro=older_distro, arch=arch)
         newer_arches = [u'x86_64', u's390x', u'ppc64le']
         newer_distro = data_setup.create_distro(
             osmajor=u'DansAwesomeLinux8',
             osminor=u'1',
             arches=newer_arches,
             date_created=datetime.datetime(2012, 1, 1, 0, 0),
             tags=[])
         for arch in newer_arches:
             data_setup.create_distro_tree(distro=newer_distro, arch=arch)
     # Naming a specific distro should always use the corresponding OS minor arches.
     self.submit_job_and_check_arches(['--distro', older_distro.name],
                                      older_arches)
     self.submit_job_and_check_arches(['--distro', newer_distro.name],
                                      newer_arches)
     # Giving a family in addition to a specific distro is redundant, but it
     # shouldn't break the arch lookup.
     self.submit_job_and_check_arches(
         ['--distro', older_distro.name, '--family', 'DansAwesomeLinux8'],
         older_arches)
     self.submit_job_and_check_arches(
         ['--distro', newer_distro.name, '--family', 'DansAwesomeLinux8'],
         newer_arches)
     # Naming just a family will use the latest distro in that family.
     self.submit_job_and_check_arches(['--family', 'DansAwesomeLinux8'],
                                      newer_arches)
     # Family filtered by tag can restrict it to an older release though.
     self.submit_job_and_check_arches(
         ['--family', 'DansAwesomeLinux8', '--tag', 'STABLE'], older_arches)
Example #33
0
 def test_by_distro(self):
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'RedHatEnterpriseLinux6')
         included = data_setup.create_task()
         excluded = data_setup.create_task(
                 exclude_osmajor=[u'RedHatEnterpriseLinux6'])
     out = run_client(['bkr', 'task-list', '--distro', distro.name])
     task_names = out.splitlines()
     self.assertIn(included.name, task_names)
     self.assertNotIn(excluded.name, task_names)
Example #34
0
 def test_by_distro(self):
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'RedHatEnterpriseLinux6')
         included = data_setup.create_task()
         excluded = data_setup.create_task(
                 exclude_osmajors=[u'RedHatEnterpriseLinux6'])
     out = run_client(['bkr', 'task-list', '--distro', distro.name])
     task_names = out.splitlines()
     self.assertIn(included.name, task_names)
     self.assertNotIn(excluded.name, task_names)
 def setUp(self):
     i386 = Arch.by_name(u'i386')
     x86_64 = Arch.by_name(u'x86_64')
     self.distro = data_setup.create_distro(osmajor=u'MyAwesomeLinux',
                                            tags=[u'STABLE'],
                                            arches=[i386, x86_64])
     data_setup.create_distro_tree(distro=self.distro,
                                   arch=u'i386')
     data_setup.create_distro_tree(distro=self.distro,
                                   arch=u'x86_64')
 def test_output_is_ordered_by_date_created(self):
     with session.begin():
         # Insert them in reverse order (oldest last), just because the most 
         # likely regression here is that we aren't sorting at all and thus 
         # the output is in database insertion order. So this proves that's 
         # not happening.
         new_distro = data_setup.create_distro(date_created=datetime.datetime(2021, 1, 1, 0, 0))
         data_setup.create_distro_tree(distro=new_distro)
         old_distro = data_setup.create_distro(date_created=datetime.datetime(2004, 1, 1, 0, 0))
         data_setup.create_distro_tree(distro=old_distro)
     output = run_client(['bkr', 'distros-list', '--format=json'])
     with session.begin():
         session.expire_all()
         returned_distros = [Distro.query.get(entry['distro_id'])
                 for entry in json.loads(output)]
         for i in range(1, len(returned_distros)):
             self.assertGreaterEqual(
                     returned_distros[i - 1].date_created,
                     returned_distros[i].date_created)
Example #37
0
 def test_filter_by_distro(self):
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'MagentaGloveLinux5')
         included = data_setup.create_task()
         excluded = data_setup.create_task(
             exclude_osmajors=[u'MagentaGloveLinux5'])
     result = self.server.tasks.filter(dict(distro_name=distro.name))
     task_names = [task['name'] for task in result]
     self.assertIn(included.name, task_names)
     self.assertNotIn(excluded.name, task_names)
Example #38
0
 def test_filter_by_distro(self):
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'MagentaGloveLinux5')
         included = data_setup.create_task()
         excluded = data_setup.create_task(
                 exclude_osmajors=[u'MagentaGloveLinux5'])
     result = self.server.tasks.filter(dict(distro_name=distro.name))
     task_names = [task['name'] for task in result]
     self.assertIn(included.name, task_names)
     self.assertNotIn(excluded.name, task_names)
Example #39
0
 def setUp(self):
     self.lc = data_setup.create_labcontroller()
     self.distro = data_setup.create_distro()
     self.distro_tree = data_setup.create_distro_tree(
         distro=self.distro, arch='x86_64', lab_controllers=[self.lc])
     self.server = self.get_server()
     user = User.by_user_name(data_setup.ADMIN_USER)
     user.groups[0].permissions[:] = user.groups[0].permissions + [
         Permission.by_name('distro_expire')
     ]
    def test_search_by_tag(self):
        with session.begin():
            released_distro = data_setup.create_distro(tags=[u'STABLE', u'RELEASED'])
            data_setup.create_distro_tree(distro=released_distro)
            unreleased_distro = data_setup.create_distro(tags=[u'STABLE'])
            data_setup.create_distro_tree(distro=unreleased_distro)

        b = self.browser
        b.get(get_server_base() + 'distros')
        b.find_element_by_link_text('Show Search Options').click()
        wait_for_animation(b, '#searchform')
        Select(b.find_element_by_name('distrosearch-0.table')).select_by_visible_text('Tag')
        Select(b.find_element_by_name('distrosearch-0.operation')).select_by_visible_text('is')
        Select(b.find_element_by_name('distrosearch-0.value')).select_by_visible_text('RELEASED')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b, present=[released_distro], absent=[unreleased_distro])

        Select(b.find_element_by_name('distrosearch-0.operation')).select_by_visible_text('is not')
        b.find_element_by_name('distrosearch').submit()
        check_distro_search_results(b, present=[unreleased_distro], absent=[released_distro])
Example #41
0
 def test_dryrun(self):
     with session.begin():
         distro = data_setup.create_distro(tags=[u'STABLE'])
         distro_tree = data_setup.create_distro_tree(distro=distro)
     out = run_client([
         'bkr', 'workflow-installer-test', '--family',
         distro.osversion.osmajor.osmajor, '--arch', distro_tree.arch.arch,
         '--template', self.template_file_name, '--task', self.task.name,
         '--dryrun'
     ])
     self.assertEquals('', out)
Example #42
0
 def setUp(self):
     self.group = data_setup.create_group()
     # grant the group distro_expire permission
     self.group.permissions.append(Permission.by_name('distro_expire'))
     self.user = data_setup.create_user(password=u'password')
     self.group.add_member(self.user)
     self.lc = data_setup.create_labcontroller(user=self.user)
     self.distro = data_setup.create_distro()
     self.distro_tree = data_setup.create_distro_tree(
         distro=self.distro, arch='x86_64', lab_controllers=[self.lc])
     self.server = self.get_server()
Example #43
0
 def setUp(self):
     self.group = data_setup.create_group()
     # grant the group distro_expire permission
     self.group.permissions.append(Permission.by_name('distro_expire'))
     self.user = data_setup.create_user(password=u'password')
     self.group.add_member(self.user)
     self.lc = data_setup.create_labcontroller(user=self.user)
     self.distro = data_setup.create_distro()
     self.distro_tree = data_setup.create_distro_tree(distro=self.distro,
         arch='x86_64', lab_controllers=[self.lc])
     self.server = self.get_server()
Example #44
0
 def test_existing_distro_row_with_incorrect_osversion(self):
     # We want to add 'RHEL6-bz825913' with osversion
     # 'RedHatEnterpriseLinux6.1'. But that distro already exists
     # with osversion 'RedHatEnterpriseLinux6.0'.
     name = 'RHEL6-bz825913'
     with session.begin():
         data_setup.create_distro(name=name,
                 osmajor=u'RedHatEnterpriseLinux6', osminor=u'0')
     distro_data = dict(self.distro_data)
     distro_data.update({
         'name': name,
         'osmajor': 'RedHatEnterpriseLinux6',
         'osminor': '1',
     })
     self.server.auth.login_password(self.lc.user.user_name, u'logmein')
     self.server.labcontrollers.add_distro_tree(distro_data)
     with session.begin():
         distro = Distro.by_name(name)
         self.assertEquals(distro.osversion.osmajor.osmajor,
                 u'RedHatEnterpriseLinux6')
         self.assertEquals(distro.osversion.osminor, u'1')
 def test_edit_distro_version(self):
     with session.begin():
         distro = data_setup.create_distro()
     run_client([
         'bkr', 'distros-edit-version', '--name', distro.name,
         'SillyVersion2.1'
     ])
     with session.begin():
         session.refresh(distro)
         self.assertEquals(distro.osversion.osmajor.osmajor,
                           u'SillyVersion2')
         self.assertEquals(distro.osversion.osminor, u'1')
Example #46
0
 def setUpClass(cls):
     # create a bunch of jobs
     with session.begin():
         cls.user = user = data_setup.create_user(password='******')
         arches = [u'i386', u'x86_64', u'ia64']
         distros = [data_setup.create_distro(name=name) for name in
                 [u'DAN5-Server-U5', u'DAN5-Client-U5', u'DAN6-U1', u'DAN6-RC3']]
         for arch in arches:
             for distro in distros:
                 distro_tree = data_setup.create_distro_tree(distro=distro, arch=arch)
                 data_setup.create_job(owner=user, distro_tree=distro_tree)
                 data_setup.create_completed_job(owner=user, distro_tree=distro_tree)
 def test_dryrun(self):
     with session.begin():
         distro = data_setup.create_distro(tags=[u'STABLE'])
         distro_tree = data_setup.create_distro_tree(distro=distro)
     out = run_client(['bkr', 'workflow-installer-test',
                       '--family', distro.osversion.osmajor.osmajor,
                       '--arch', distro_tree.arch.arch,
                       '--template', self.template_file_name,
                       '--task',
                       self.task.name,
                       '--dryrun'])
     self.assertEquals('', out)
Example #48
0
 def test_lookup_arches_by_family(self):
     # When a family is given but no arches, the workflow commands are 
     # supposed to look up all applicable arches and create a recipe set for 
     # each one.
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'DansAwesomeLinux7',
                 tags=[u'STABLE'])
         data_setup.create_distro_tree(distro=distro, arch=u'x86_64')
         data_setup.create_distro_tree(distro=distro, arch=u's390x')
     self.submit_job_and_check_arches(
             ['--family', distro.osversion.osmajor.osmajor],
             [u'x86_64', u's390x'])
Example #49
0
 def test_existing_distro_row_with_incorrect_osversion(self):
     # We want to add 'RHEL6-bz825913' with osversion
     # 'RedHatEnterpriseLinux6.1'. But that distro already exists
     # with osversion 'RedHatEnterpriseLinux6.0'.
     name = 'RHEL6-bz825913'
     with session.begin():
         data_setup.create_distro(name=name,
                 osmajor=u'RedHatEnterpriseLinux6', osminor=u'0')
     distro_data = dict(self.distro_data)
     distro_data.update({
         'name': name,
         'osmajor': 'RedHatEnterpriseLinux6',
         'osminor': '1',
     })
     self.server.auth.login_password(self.lc.user.user_name, u'logmein')
     self.server.labcontrollers.add_distro_tree(distro_data)
     with session.begin():
         distro = Distro.by_name(name)
         self.assertEquals(distro.osversion.osmajor.osmajor,
                 u'RedHatEnterpriseLinux6')
         self.assertEquals(distro.osversion.osminor, u'1')
Example #50
0
 def test_lookup_arches_by_family(self):
     # When a family is given but no arches, the workflow commands are
     # supposed to look up all applicable arches and create a recipe set for
     # each one.
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'DansAwesomeLinux7',
                                           tags=[u'STABLE'])
         data_setup.create_distro_tree(distro=distro, arch=u'x86_64')
         data_setup.create_distro_tree(distro=distro, arch=u's390x')
     self.submit_job_and_check_arches(
         ['--family', distro.osversion.osmajor.osmajor],
         [u'x86_64', u's390x'])
Example #51
0
 def setUpClass(cls):
     # create a bunch of jobs
     with session.begin():
         cls.user = user = data_setup.create_user(password='******')
         arches = [u'i386', u'x86_64', u'ia64']
         distros = [data_setup.create_distro(name=name) for name in
                 [u'DAN5-Server-U5', u'DAN5-Client-U5', u'DAN6-U1', u'DAN6-RC3']]
         for arch in arches:
             for distro in distros:
                 distro_tree = data_setup.create_distro_tree(distro=distro, arch=arch)
                 data_setup.create_job(owner=user, distro_tree=distro_tree)
                 data_setup.create_completed_job(owner=user, distro_tree=distro_tree)
Example #52
0
 def test_sanity(self):
     with session.begin():
         distro = data_setup.create_distro(tags=[u'STABLE'])
         distro_tree = data_setup.create_distro_tree(distro=distro)
     out = run_client([
         'bkr', 'workflow-installer-test', '--family',
         distro.osversion.osmajor.osmajor, '--arch', distro_tree.arch.arch,
         '--template', self.template_file_name, '--debug', '--task',
         self.task.name
     ])
     self.assertIn('key --skip', out)
     self.assertIn('Submitted:', out)
Example #53
0
 def test_output_is_ordered_by_date_created(self):
     with session.begin():
         # Insert them in reverse order (oldest last), just because the most
         # likely regression here is that we aren't sorting at all and thus
         # the output is in database insertion order. So this proves that's
         # not happening.
         new_distro = data_setup.create_distro(
             date_created=datetime.datetime(2021, 1, 1, 0, 0))
         data_setup.create_distro_tree(distro=new_distro)
         old_distro = data_setup.create_distro(
             date_created=datetime.datetime(2004, 1, 1, 0, 0))
         data_setup.create_distro_tree(distro=old_distro)
     output = run_client(['bkr', 'distros-list', '--format=json'])
     with session.begin():
         session.expire_all()
         returned_distros = [
             Distro.query.get(entry['distro_id'])
             for entry in json.loads(output)
         ]
         for i in range(1, len(returned_distros)):
             self.assertGreaterEqual(returned_distros[i - 1].date_created,
                                     returned_distros[i].date_created)
Example #54
0
 def test_can_search_by_distro_name(self):
     with session.begin():
         distro1 = data_setup.create_distro()
         act1 = distro1.record_activity(service=u'testdata',
                                        user=User.by_user_name(
                                            data_setup.ADMIN_USER),
                                        action=u'Nothing',
                                        field=u'Nonsense',
                                        old=u'asdf',
                                        new=u'omgwtfbbq')
         distro2 = data_setup.create_distro()
         act2 = distro2.record_activity(service=u'testdata',
                                        user=User.by_user_name(
                                            data_setup.ADMIN_USER),
                                        action=u'Nothing',
                                        field=u'Nonsense',
                                        old=u'asdf',
                                        new=u'lollercopter')
     b = self.browser
     b.get(get_server_base() + 'activity/distro')
     b.find_element_by_class_name('search-query').send_keys(
         'distro.name:%s' % distro1.name)
     b.find_element_by_class_name('grid-filter').submit()
     check_activity_search_results(b, present=[act1], absent=[act2])
    def setUp(self):
        self.lc = data_setup.create_labcontroller()
        self.system = data_setup.create_system(arch=u'i386', shared=True)
        self.system2 = data_setup.create_system(arch=u'x86_64', shared=True)
        self.unique_distro_name = data_setup.unique_name('distro%s')
        self.distro = data_setup.create_distro(name=self.unique_distro_name)
        self.distro_tree_i386 = data_setup.create_distro_tree(
                variant=u'Server', arch=u'i386', distro=self.distro)
        self.distro_tree_x86_64= data_setup.create_distro_tree(
                variant=u'Server', arch=u'x86_64', distro=self.distro)

        self.system.lab_controller = self.lc
        self.system2.lab_controller = self.lc

        self.browser = self.get_browser()
Example #56
0
    def setUp(self):
        self.distro = data_setup.create_distro()
        self.distro_tree1 = data_setup.create_distro_tree(distro=self.distro,
                                                          arch='x86_64')
        self.distro_tree2 = data_setup.create_distro_tree(distro=self.distro,
                                                          arch='i386')

        self.distro_tree1.activity.append(
            DistroTreeActivity(user=User.by_user_name(data_setup.ADMIN_USER),
                               service=u'testdata',
                               field_name=u'Nonesente',
                               old_value=u'sdfas',
                               new_value=u'sdfa',
                               action='Added'))
        self.distro_tree2.activity.append(
            DistroTreeActivity(user=User.by_user_name(data_setup.ADMIN_USER),
                               service=u'testdata',
                               field_name=u'Noneseonce',
                               old_value=u'bsdf',
                               new_value=u'sdfas',
                               action='Added'))

        self.distro.activity.append(
            DistroActivity(user=User.by_user_name(data_setup.ADMIN_USER),
                           service=u'testdata',
                           action=u'Nothing',
                           field_name=u'Nonsense',
                           old_value=u'asdf',
                           new_value=u'omgwtfbbq'))
        self.system = data_setup.create_system()
        self.system.activity.append(
            SystemActivity(user=User.by_user_name(data_setup.ADMIN_USER),
                           service=u'testdata',
                           action=u'Nothing',
                           field_name=u'Nonsense',
                           old_value=u'asdf',
                           new_value=u'omgwtfbbq'))
        self.group2 = data_setup.create_group()
        self.group = data_setup.create_group()
        self.group.activity.append(
            GroupActivity(user=User.by_user_name(data_setup.ADMIN_USER),
                          service=u'testdata',
                          action=u'Nothing',
                          field_name=u'Nonsense',
                          old_value=u'asdf',
                          new_value=u'omgwtfbbq'))
        self.browser = self.get_browser()
Example #57
0
 def test_uses_new_check_install_task_by_default(self):
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'Fedora29')
         data_setup.create_distro_tree(distro=distro)
     out = run_client([
         'bkr', 'workflow-simple', '--distro', distro.name, '--task',
         self.task.name
     ])
     self.assertIn('Submitted:', out)
     m = re.search('J:(\d+)', out)
     job_id = m.group(1)
     with session.begin():
         job = Job.by_id(job_id)
         tasks = job.recipesets[0].recipes[0].tasks
         self.assertEqual(len(tasks), 2)
         self.assertEqual(tasks[0].name, '/distribution/check-install')
         self.assertEqual(tasks[1].name, self.task.name)
Example #58
0
 def test_uses_original_install_task_on_older_distros(self):
     with session.begin():
         distro = data_setup.create_distro(
             osmajor=u'RedHatEnterpriseLinux7')
         data_setup.create_distro_tree(distro=distro)
     out = run_client([
         'bkr', 'workflow-simple', '--distro', distro.name, '--task',
         self.task.name
     ])
     self.assertIn('Submitted:', out)
     m = re.search('J:(\d+)', out)
     job_id = m.group(1)
     with session.begin():
         job = Job.by_id(job_id)
         tasks = job.recipesets[0].recipes[0].tasks
         self.assertEqual(len(tasks), 2)
         self.assertEqual(tasks[0].name, '/distribution/install')
         self.assertEqual(tasks[1].name, self.task.name)
Example #59
0
    def test_correct_items_count(self):
        with session.begin():
            lc_1 = data_setup.create_labcontroller()
            lc_2 = data_setup.create_labcontroller()
            distro_name = data_setup.unique_name(u'distroname%s')
            distro_osmajor = data_setup.unique_name(u'osmajor%s')
            distro_osminor = u'2'
            distro_tags = None

            distro = data_setup.create_distro(name=distro_name,
                osmajor=distro_osmajor, osminor=distro_osminor,
                tags=distro_tags)
            data_setup.create_distro_tree(distro=distro)

        b = self.browser
        b.get(get_server_base() + 'distros')
        b.find_element_by_name('simplesearch').send_keys(distro.name)
        b.find_element_by_id('simpleform').submit()
        self.assert_(is_text_present(b, 'Items found: 1'))
Example #60
0
 def test_lookup_arches_by_family(self):
     # When a family is given but no arches, the workflow commands are
     # supposed to look up all applicable arches and create a recipe set for
     # each one.
     with session.begin():
         distro = data_setup.create_distro(osmajor=u'DansAwesomeLinux7',
                                           tags=[u'STABLE'])
         data_setup.create_distro_tree(distro=distro, arch=u'x86_64')
         data_setup.create_distro_tree(distro=distro, arch=u's390x')
     out = run_client([
         'bkr', 'workflow-simple', '--family',
         distro.osversion.osmajor.osmajor, '--task', self.task.name
     ])
     self.assertTrue(out.startswith('Submitted:'), out)
     m = re.search('J:(\d+)', out)
     job_id = m.group(1)
     with session.begin():
         job = Job.by_id(job_id)
         self.assertEquals(len(job.recipesets), 2)
         self.assertEquals(job.recipesets[0].recipes[0].distro_tree.arch,
                           Arch.by_name(u'x86_64'))
         self.assertEquals(job.recipesets[1].recipes[0].distro_tree.arch,
                           Arch.by_name(u's390x'))