Пример #1
0
 def setUp(self):
     with session.begin():
         self.recipe = data_setup.create_recipe(
                 distro_name=u'PurpleUmbrellaLinux5.11-20160428',
                 variant=u'Server', arch=u'x86_64')
         data_setup.create_job_for_recipes([self.recipe])
         data_setup.mark_recipe_installing(self.recipe)
     self.browser = self.get_browser()
     go_to_recipe_view(self.browser, self.recipe, tab='Installation')
Пример #2
0
 def setUp(self):
     with session.begin():
         self.recipe = data_setup.create_recipe(
                 distro_name=u'PurpleUmbrellaLinux5.11-20160428',
                 variant=u'Server', arch=u'x86_64')
         data_setup.create_job_for_recipes([self.recipe])
         data_setup.mark_recipe_installing(self.recipe)
     self.browser = self.get_browser()
     go_to_recipe_view(self.browser, self.recipe, tab='Installation')
Пример #3
0
 def setUp(self):
     with session.begin():
         self.system = data_setup.create_system(lab_controller=self.get_lc())
         self.recipe = data_setup.create_recipe()
         data_setup.create_job_for_recipes([self.recipe])
         data_setup.mark_recipe_installing(self.recipe, system=self.system)
     self.console_log = os.path.join(get_conf().get('CONSOLE_LOGS'), self.system.fqdn)
     self.cached_console_log = os.path.join(get_conf().get('CACHEPATH'), 'recipes',
             str(self.recipe.id // 1000) + '+', str(self.recipe.id), 'console.log')
Пример #4
0
 def test_unrecognised_anchor_is_replaced_with_default(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_installing(recipe)
     b = self.browser
     b.get(get_server_base() + 'recipes/%s#no-such-anchor-exists' % recipe.id)
     b.find_element_by_css_selector('#installation.active')
     _, fragment = urlparse.urldefrag(b.current_url)
     self.assertEquals(fragment, 'installation')
Пример #5
0
 def test_shows_installation_tab_while_installing(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_installing(recipe)
     b = self.browser
     go_to_recipe_view(b, recipe)
     b.find_element_by_css_selector('#installation.active')
     _, fragment = urlparse.urldefrag(b.current_url)
     self.assertEquals(fragment, 'installation')
Пример #6
0
 def test_unrecognised_anchor_is_replaced_with_default(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_installing(recipe)
     b = self.browser
     b.get(get_server_base() + 'recipes/%s#no-such-anchor-exists' % recipe.id)
     b.find_element_by_css_selector('#installation.active')
     _, fragment = urlparse.urldefrag(b.current_url)
     self.assertEquals(fragment, 'installation')
Пример #7
0
 def test_shows_installation_tab_while_installing(self):
     with session.begin():
         recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([recipe])
         data_setup.mark_recipe_installing(recipe)
     b = self.browser
     go_to_recipe_view(b, recipe)
     b.find_element_by_css_selector('#installation.active')
     _, fragment = urlparse.urldefrag(b.current_url)
     self.assertEquals(fragment, 'installation')
Пример #8
0
    def test_recipe_installing_then_aborted(self):
        """Like the previous case, but aborts during installation."""
        data_setup.mark_recipe_installing(self.recipe)
        self.recipe.abort(msg=u'Installation failed')
        self.job.update_status()
        self.assertEqual(self.recipe.status, TaskStatus.reserved)

        self.recipe.return_reservation()
        self.job.update_status()
        self.assertEqual(self.recipe.status, TaskStatus.aborted)
Пример #9
0
 def setUp(self):
     with session.begin():
         self.system = data_setup.create_system(lab_controller=self.get_lc())
         self.recipe = data_setup.create_recipe()
         job = data_setup.create_job_for_recipes([self.recipe])
         self.addCleanup(self.cleanup_job, job)
         data_setup.mark_recipe_installing(self.recipe, system=self.system)
     self.console_log = os.path.join(get_conf().get('CONSOLE_LOGS'), self.system.fqdn)
     self.cached_console_log = os.path.join(get_conf().get('CACHEPATH'), 'recipes',
             str(self.recipe.id // 1000) + '+', str(self.recipe.id), 'console.log')
Пример #10
0
    def test_recipe_installing_then_aborted(self):
        """Like the previous case, but aborts during installation."""
        data_setup.mark_recipe_installing(self.recipe)
        self.recipe.abort(msg=u'Installation failed')
        self.job.update_status()
        self.assertEqual(self.recipe.status, TaskStatus.reserved)

        self.recipe.return_reservation()
        self.job.update_status()
        self.assertEqual(self.recipe.status, TaskStatus.aborted)
Пример #11
0
 def test_recipe_installing_then_aborted(self):
     """Like the previous case, but aborts during installation."""
     recipe = data_setup.create_recipe(reservesys=True)
     job = data_setup.create_job_for_recipes([recipe])
     data_setup.mark_recipe_installing(recipe)
     recipe.abort(msg=u'Installation failed')
     job.update_status()
     self.assertEqual(recipe.status, TaskStatus.reserved)
     recipe.return_reservation()
     job.update_status()
     self.assertEqual(recipe.status, TaskStatus.aborted)
Пример #12
0
 def test_status_is_Waiting_when_installation_is_finished_but_tasks_have_not_started(self):
     # Beah <= 0.7.9 will consider 'Installing' to mean that the recipe is 
     # finished, so we want the status to go back to 'Waiting' once the 
     # installation is finished.
     job = data_setup.create_job()
     recipe = job.recipesets[0].recipes[0]
     data_setup.mark_recipe_installing(recipe)
     data_setup.mark_recipe_installation_finished(recipe)
     self.assertEqual(recipe.tasks[0].status, TaskStatus.waiting)
     self.assertIsNone(recipe.tasks[0].start_time)
     self.assertEqual(recipe.status, TaskStatus.waiting)
Пример #13
0
 def test_recipe_installing_then_aborted(self):
     """Like the previous case, but aborts during installation."""
     recipe = data_setup.create_recipe(reservesys=True)
     job = data_setup.create_job_for_recipes([recipe])
     data_setup.mark_recipe_installing(recipe)
     recipe.abort(msg=u"Installation failed")
     job.update_status()
     self.assertEqual(recipe.status, TaskStatus.reserved)
     recipe.return_reservation()
     job.update_status()
     self.assertEqual(recipe.status, TaskStatus.aborted)
Пример #14
0
    def setUp(self):
        with session.begin():
            self.system = data_setup.create_system(
                lab_controller=self.get_lc())
            self.recipe = data_setup.create_recipe()
            self.guest_recipe = data_setup.create_guestrecipe(self.recipe)
            job = data_setup.create_job_for_recipes(
                [self.recipe, self.guest_recipe])
            self.addCleanup(self.cleanup_job, job)

            data_setup.mark_recipe_running(self.recipe, system=self.system)
            data_setup.mark_recipe_installing(self.guest_recipe,
                                              system=self.system)

            self.console_log = os.path.join(get_conf().get('CONSOLE_LOGS'),
                                            self.system.fqdn)
            self.cached_console_log = os.path.join(
                get_conf().get('CACHEPATH'), 'recipes',
                str(self.recipe.id // 1000) + '+', str(self.recipe.id),
                'console.log')
        self.first_line = 'Here is the first line of the log file.\n'
        open(self.console_log, 'w').write(self.first_line)

        self.watchdog = Watchdog()

        self.monitor = Monitor(
            {
                'recipe_id': self.recipe.id,
                'is_virt_recipe': False,
                'system': self.system.fqdn
            }, self.watchdog)
        self.monitor_guest = Monitor(
            {
                'recipe_id': self.guest_recipe.id,
                'is_virt_recipe': False,
                'system': None
            }, self.watchdog)
    def test_resource_install_failures(self):

        # Get existing state to later compare against
        rows = self.execute_reporting_query('install-failure-count-by-resource')
        all_rows = [row for row in rows]
        guest_rows = [row for row in all_rows if row.fqdn == 'All Guest']
        virt_rows = [row for row in all_rows if row.fqdn == 'All OpenStack']
        existing_failed_guests = guest_rows[0].failed_recipes
        existing_failed_virt = virt_rows[0].failed_recipes

        system_recipe = data_setup.create_recipe()
        guest_recipe = data_setup.create_guestrecipe(host=system_recipe)
        virt_recipe = data_setup.create_recipe()
        job = data_setup.create_job_for_recipes([guest_recipe, virt_recipe, system_recipe])

        data_setup.mark_recipe_installing(virt_recipe, virt=True)
        data_setup.mark_recipe_installing(system_recipe)
        data_setup.mark_recipe_installing(guest_recipe)
        session.flush()

        # Test we don't count runinng recipes
        rows = self.execute_reporting_query('install-failure-count-by-resource')
        all_rows = [row for row in rows]
        system_rows = [row for row in all_rows if row.fqdn == system_recipe.resource.fqdn]

        self.assertEquals(len(virt_rows), 1, virt_rows)
        self.assertEquals(existing_failed_virt, virt_rows[0].failed_recipes)

        self.assertEquals(len(guest_rows), 1, guest_rows)
        self.assertEquals(existing_failed_guests, guest_rows[0].failed_recipes)

        self.assertEquals(len(system_rows), 1, system_rows)
        self.assertEquals(system_rows[0].failed_recipes, 0)

        # Test completed recipes
        job.abort()
        job.update_status()
        session.flush()
        rows = self.execute_reporting_query('install-failure-count-by-resource')
        all_rows = [row for row in rows]
        guest_rows = [row for row in all_rows if row.fqdn == 'All Guest']
        virt_rows = [row for row in all_rows if row.fqdn == 'All OpenStack']
        system_rows = [row for row in all_rows if row.fqdn == system_recipe.resource.fqdn]

        self.assertEquals(len(virt_rows), 1, virt_rows)
        self.assertEquals(virt_rows[0].failed_recipes, existing_failed_virt + 1)

        self.assertEquals(len(guest_rows), 1, guest_rows)
        self.assertEquals(guest_rows[0].failed_recipes, existing_failed_guests + 1)

        self.assertEquals(len(system_rows), 1, system_rows)
        self.assertEquals(system_rows[0].failed_recipes, 1)
Пример #16
0
    def test_resource_install_failures(self):

        # Get existing state to later compare against
        rows = self.execute_reporting_query(
            'install-failure-count-by-resource')
        all_rows = [row for row in rows]
        guest_rows = [row for row in all_rows if row.fqdn == 'All Guest']
        virt_rows = [row for row in all_rows if row.fqdn == 'All OpenStack']
        existing_failed_guests = guest_rows[0].failed_recipes
        existing_failed_virt = virt_rows[0].failed_recipes

        system_recipe = data_setup.create_recipe()
        guest_recipe = data_setup.create_guestrecipe(host=system_recipe)
        virt_recipe = data_setup.create_recipe()
        job = data_setup.create_job_for_recipes(
            [guest_recipe, virt_recipe, system_recipe])

        data_setup.mark_recipe_installing(virt_recipe, virt=True)
        data_setup.mark_recipe_installing(system_recipe)
        data_setup.mark_recipe_installing(guest_recipe)
        session.flush()

        # Test we don't count runinng recipes
        rows = self.execute_reporting_query(
            'install-failure-count-by-resource')
        all_rows = [row for row in rows]
        system_rows = [
            row for row in all_rows if row.fqdn == system_recipe.resource.fqdn
        ]

        self.assertEquals(len(virt_rows), 1, virt_rows)
        self.assertEquals(existing_failed_virt, virt_rows[0].failed_recipes)

        self.assertEquals(len(guest_rows), 1, guest_rows)
        self.assertEquals(existing_failed_guests, guest_rows[0].failed_recipes)

        self.assertEquals(len(system_rows), 1, system_rows)
        self.assertEquals(system_rows[0].failed_recipes, 0)

        # Test completed recipes
        job.abort()
        job.update_status()
        session.flush()
        rows = self.execute_reporting_query(
            'install-failure-count-by-resource')
        all_rows = [row for row in rows]
        guest_rows = [row for row in all_rows if row.fqdn == 'All Guest']
        virt_rows = [row for row in all_rows if row.fqdn == 'All OpenStack']
        system_rows = [
            row for row in all_rows if row.fqdn == system_recipe.resource.fqdn
        ]

        self.assertEquals(len(virt_rows), 1, virt_rows)
        self.assertEquals(virt_rows[0].failed_recipes,
                          existing_failed_virt + 1)

        self.assertEquals(len(guest_rows), 1, guest_rows)
        self.assertEquals(guest_rows[0].failed_recipes,
                          existing_failed_guests + 1)

        self.assertEquals(len(system_rows), 1, system_rows)
        self.assertEquals(system_rows[0].failed_recipes, 1)