示例#1
0
文件: models.py 项目: loles/fuel-ostf
    def start(cls, session, test_set, metadata, tests):
        '''
        Checks whether system must create new test_run or
        not by calling is_last_running.

        Creates new test_run if needed via
        add_test_run function. Creation of new
        test_run assumes not only adding test_run obj
        but also copying of tests which is in relation
        with test_set of created test_run.

        Run tests from newly created test_run
        via neded testing plugin.
        '''
        plugin = nose_plugin.get_plugin(test_set.driver)
        if cls.is_last_running(session, test_set.id,
                               metadata['cluster_id']):

            with session.begin(subtransactions=True):
                test_run = cls.add_test_run(
                    session, test_set.id,
                    metadata['cluster_id'], tests=tests)

            retvalue = test_run.frontend
            session.close()

            plugin.run(test_run, test_set)

            return retvalue
        return {}
示例#2
0
 def stop(self, session):
     """Stop test run if running
     """
     plugin = nose_plugin.get_plugin(self.test_set.driver)
     killed = plugin.kill(self)
     if killed:
         Test.update_running_tests(session, self.id, status='stopped')
     return self.frontend
示例#3
0
 def stop(self, session):
     """Stop test run if running
     """
     plugin = nose_plugin.get_plugin(self.test_set.driver)
     killed = plugin.kill(self)
     if killed:
         Test.update_running_tests(
             session, self.id, status='stopped')
     return self.frontend
 def start(cls, session, test_set, metadata, tests):
     plugin = nose_plugin.get_plugin(test_set.driver)
     if cls.is_last_running(session, test_set.id,
                            metadata['cluster_id']):
         test_run = cls.add_test_run(
             session, test_set.id,
             metadata['cluster_id'], tests=tests)
         plugin.run(test_run, test_set)
         return test_run.frontend
     return {}
 def start(cls, session, test_set, metadata, tests):
     plugin = nose_plugin.get_plugin(test_set.driver)
     if cls.is_last_running(session, test_set.id, metadata['cluster_id']):
         test_run = cls.add_test_run(session,
                                     test_set.id,
                                     metadata['cluster_id'],
                                     tests=tests)
         plugin.run(test_run, test_set)
         return test_run.frontend
     return {}
 def restart(self, session, tests=None):
     """Restart test run with
         if tests given they will be enabled
     """
     if TestRun.is_last_running(session, self.test_set_id, self.cluster_id):
         plugin = nose_plugin.get_plugin(self.test_set.driver)
         self.update(session, 'running')
         if tests:
             Test.update_test_run_tests(session, self.id, tests)
         plugin.run(self, self.test_set, tests)
         return self.frontend
     return {}
示例#7
0
    def start(cls, session, test_set, metadata, tests, dbpath, token=None):
        plugin = nose_plugin.get_plugin(test_set.driver)
        if cls.is_last_running(session, test_set.id,
                               metadata['cluster_id']):

            test_run = cls.add_test_run(
                session, test_set.id,
                metadata['cluster_id'], tests=tests)

            plugin.run(test_run, test_set, dbpath,
                       metadata.get('ostf_os_access_creds'), token=token)

            return test_run.frontend
        return {}
示例#8
0
    def start(cls, session, test_set, metadata, tests, dbpath, token=None):
        plugin = nose_plugin.get_plugin(test_set.driver)
        if cls.is_last_running(session, test_set.id,
                               metadata['cluster_id']):

            test_run = cls.add_test_run(
                session, test_set.id,
                metadata['cluster_id'], tests=tests)

            plugin.run(test_run, test_set, dbpath,
                       metadata.get('ostf_os_access_creds'), token=token)

            return test_run.frontend
        return {}
 def restart(self, session, tests=None):
     """Restart test run with
         if tests given they will be enabled
     """
     if TestRun.is_last_running(session,
                                self.test_set_id,
                                self.cluster_id):
         plugin = nose_plugin.get_plugin(self.test_set.driver)
         self.update(session, 'running')
         if tests:
             Test.update_test_run_tests(
                 session, self.id, tests)
         plugin.run(self, self.test_set, tests)
         return self.frontend
     return {}
示例#10
0
    def start(cls, session, test_set, metadata, tests, dbpath):
        plugin = nose_plugin.get_plugin(test_set.driver)
        if cls.is_last_running(session, test_set.id,
                               metadata['cluster_id']):

            test_run = cls.add_test_run(
                session, test_set.id,
                metadata['cluster_id'], tests=tests)

            # flush test_run data to db
            session.commit()

            plugin.run(test_run, test_set, dbpath)

            return test_run.frontend
        return {}
示例#11
0
    def restart(self, session, dbpath,
                ostf_os_access_creds, tests=None, token=None):
        """Restart test run with
            if tests given they will be enabled
        """
        if TestRun.is_last_running(session,
                                   self.test_set_id,
                                   self.cluster_id):
            plugin = nose_plugin.get_plugin(self.test_set.driver)

            self.update(consts.TEST_STATUSES.running)
            if tests:
                Test.update_test_run_tests(
                    session, self.id, tests)

            plugin.run(self, self.test_set, dbpath,
                       ostf_os_access_creds, tests, token=token)
            return self.frontend
        return {}
示例#12
0
    def start(cls, session, test_set, metadata, tests):
        '''
        Checks whether system must create new test_run or
        not by calling is_last_running.

        Creates new test_run if needed via
        add_test_run function. Creation of new
        test_run assumes not only adding test_run obj
        but also copying of tests which is in relation
        with test_set of created test_run.

        Run tests from newly created test_run
        via neded testing plugin.
        '''
        plugin = nose_plugin.get_plugin(test_set.driver)
        if cls.is_last_running(session, test_set.id, metadata['cluster_id']):
            test_run = cls.add_test_run(session,
                                        test_set.id,
                                        metadata['cluster_id'],
                                        tests=tests)
            plugin.run(test_run, test_set)
            return test_run.frontend
        return {}
示例#13
0
    def restart(self,
                session,
                dbpath,
                ostf_os_access_creds,
                tests=None,
                token=None):
        """Restart test run with
            if tests given they will be enabled
        """
        if TestRun.is_last_running(session, self.test_set_id, self.cluster_id):
            plugin = nose_plugin.get_plugin(self.test_set.driver)

            self.update(consts.TEST_STATUSES.running)
            if tests:
                Test.update_test_run_tests(session, self.id, tests)

            plugin.run(self,
                       self.test_set,
                       dbpath,
                       ostf_os_access_creds,
                       tests,
                       token=token)
            return self.frontend
        return {}