コード例 #1
0
    def test_update_status_can_be_roundtripped_40214(self):
        complete_job_xml = pkg_resources.resource_string(
            'bkr.inttest', 'job_40214.xml')
        xmljob = XmlJob(xmltramp.parse(complete_job_xml))

        data_setup.create_tasks(xmljob)
        session.flush()

        # Import the job xml
        job = self.controller.process_xmljob(xmljob, self.user)
        session.flush()

        # Mark job waiting
        data_setup.mark_job_waiting(job)
        session.flush()

        # watchdog's should exist
        self.assertNotEqual(len(watchdogs_for_job(job)), 0)

        # Play back the original jobs results and status
        data_setup.playback_job_results(job, xmljob)
        session.flush()

        # Verify that the original status and results match
        self.assertEquals(TaskStatus.from_string(xmljob.wrappedEl('status')),
                          job.status)
        self.assertEquals(TaskResult.from_string(xmljob.wrappedEl('result')),
                          job.result)
        for i, recipeset in enumerate(xmljob.iter_recipeSets()):
            for j, recipe in enumerate(recipeset.iter_recipes()):
                self.assertEquals(
                    TaskStatus.from_string(recipe.wrappedEl('status')),
                    job.recipesets[i].recipes[j].status)
                self.assertEquals(
                    TaskResult.from_string(recipe.wrappedEl('result')),
                    job.recipesets[i].recipes[j].result)
                for k, task in enumerate(recipe.iter_tasks()):
                    self.assertEquals(
                        TaskStatus.from_string(task.status),
                        job.recipesets[i].recipes[j].tasks[k].status)
                    self.assertEquals(
                        TaskResult.from_string(task.result),
                        job.recipesets[i].recipes[j].tasks[k].result)

        # No watchdog's should exist when the job is complete
        self.assertEquals(len(watchdogs_for_job(job)), 0)
コード例 #2
0
ファイル: data_setup.py プロジェクト: cezidev/beaker
def playback_task_results(task, xmltask):
    # Start task
    task.start()
    # Record Result
    task._result(TaskResult.from_string(xmltask.get('result')), u'/', 0, u'(%s)' % xmltask.get('result'))
    # Stop task
    if xmltask.get('status') == u'Aborted':
        task.abort()
    elif xmltask.get('status') == u'Cancelled':
        task._abort_cancel(TaskStatus.cancelled)
    else:
        task.stop()
コード例 #3
0
ファイル: data_setup.py プロジェクト: sujithshankar/beaker
def playback_task_results(task, xmltask):
    # Start task
    task.start()
    # Record Result
    task._result(TaskResult.from_string(xmltask.result), u'/', 0, u'(%s)' % xmltask.result)
    # Stop task
    if xmltask.status == u'Aborted':
        task.abort()
    elif xmltask.status == u'Cancelled':
        task._abort_cancel(TaskStatus.cancelled)
    else:
        task.stop()
コード例 #4
0
    def test_update_status_can_be_roundtripped_40214(self):
        complete_job_xml = pkg_resources.resource_string('bkr.inttest', 'job_40214.xml')
        xmljob = XmlJob(xmltramp.parse(complete_job_xml))

        data_setup.create_tasks(xmljob)
        session.flush()
        
        # Import the job xml
        job = self.controller.process_xmljob(xmljob, self.user)
        session.flush()

        # Mark job waiting
        data_setup.mark_job_waiting(job)
        session.flush()

        # watchdog's should exist 
        self.assertNotEqual(len(watchdogs_for_job(job)), 0)

        # Play back the original jobs results and status
        data_setup.playback_job_results(job, xmljob)
        session.flush()
        
        # Verify that the original status and results match
        self.assertEquals(TaskStatus.from_string(xmljob.wrappedEl('status')), job.status)
        self.assertEquals(TaskResult.from_string(xmljob.wrappedEl('result')), job.result)
        for i, recipeset in enumerate(xmljob.iter_recipeSets()):
            for j, recipe in enumerate(recipeset.iter_recipes()):
                self.assertEquals(TaskStatus.from_string(recipe.wrappedEl('status')),
                        job.recipesets[i].recipes[j].status)
                self.assertEquals(TaskResult.from_string(recipe.wrappedEl('result')),
                        job.recipesets[i].recipes[j].result)
                for k, task in enumerate(recipe.iter_tasks()):
                    self.assertEquals(TaskStatus.from_string(task.status),
                            job.recipesets[i].recipes[j].tasks[k].status)
                    self.assertEquals(TaskResult.from_string(task.result),
                            job.recipesets[i].recipes[j].tasks[k].result)

        # No watchdog's should exist when the job is complete
        self.assertEquals(len(watchdogs_for_job(job)), 0)
コード例 #5
0
    def test_update_status_can_be_roundtripped_40214(self):
        complete_job_xml = pkg_resources.resource_string("bkr.inttest", "job_40214.xml")
        xmljob = lxml.etree.fromstring(complete_job_xml)

        data_setup.create_tasks(xmljob)
        session.flush()

        # Import the job xml
        job = self.controller.process_xmljob(xmljob, self.user)
        session.flush()

        # Mark job waiting
        data_setup.mark_job_waiting(job)
        session.flush()

        # watchdog's should exist
        self.assertNotEqual(len(watchdogs_for_job(job)), 0)

        # Play back the original jobs results and status
        data_setup.playback_job_results(job, xmljob)
        session.flush()

        # Verify that the original status and results match
        self.assertEquals(TaskStatus.from_string(xmljob.get("status")), job.status)
        self.assertEquals(TaskResult.from_string(xmljob.get("result")), job.result)
        for i, recipeset in enumerate(xmljob.xpath("recipeSet")):
            for j, recipe in enumerate(recipeset.xpath("recipes")):
                self.assertEquals(TaskStatus.from_string(recipe.get("status")), job.recipesets[i].recipes[j].status)
                self.assertEquals(TaskResult.from_string(recipe.get("result")), job.recipesets[i].recipes[j].result)
                for k, task in enumerate(recipe.xpath("task")):
                    self.assertEquals(
                        TaskStatus.from_string(task.get("status")), job.recipesets[i].recipes[j].tasks[k].status
                    )
                    self.assertEquals(
                        TaskResult.from_string(task.get("result")), job.recipesets[i].recipes[j].tasks[k].result
                    )

        # No watchdog's should exist when the job is complete
        self.assertEquals(len(watchdogs_for_job(job)), 0)