Exemplo n.º 1
0
 def test_client_logger_process_line_log_copy_collection_failure(self):
     collector = autotest_remote.log_collector.expect_new(self.host, '', '')
     logger = autotest_remote.client_logger(self.host, '', '')
     collector.collect_client_job_results.expect_call().and_raises(
         Exception('log copy failure'))
     logging.exception.expect_call(mock.is_string_comparator())
     logger._process_line('AUTOTEST_TEST_COMPLETE:/autotest/fifo1')
Exemplo n.º 2
0
    def _setup_post_record_init(self, cont, resultdir, my_harness):
        # now some specific stubs
        self.god.stub_function(self.job, 'config_get')
        self.god.stub_function(self.job, 'config_set')
        self.god.stub_function(self.job, 'record')

        # other setup
        results = os.path.join(self.autodir, 'results')
        pkgdir = os.path.join(self.autodir, 'packages')

        utils_memory.drop_caches.expect_call()
        job_sysinfo = sysinfo.sysinfo.expect_new(resultdir)
        if not cont:
            shutil.copyfile.expect_call(mock.is_string_comparator(),
                                        os.path.join(resultdir, 'control'))

        self.config = config.config.expect_new(self.job)
        self.job.config_get.expect_call(
            'boottool.executable').and_return(None)
        bootloader = boottool.boottool.expect_new(None)
        job.local_host.LocalHost.expect_new(hostname='localhost',
                                            bootloader=bootloader)
        job_sysinfo.log_per_reboot_data.expect_call()
        if not cont:
            self.job.record.expect_call('START', None, None)

        my_harness.run_start.expect_call()

        self.god.stub_function(utils, 'read_one_line')
        utils.read_one_line.expect_call('/proc/cmdline').and_return(
            'blah more-blah root=lala IDENT=81234567 blah-again console=tty1')
        self.job.config_set.expect_call('boot.default_args',
                                        'more-blah console=tty1')
 def test_client_logger_process_line_log_copy_collection_failure(self):
     collector = autotest_remote.log_collector.expect_new(self.host, '', '')
     logger = autotest_remote.client_logger(self.host, '', '')
     collector.collect_client_job_results.expect_call().and_raises(
             Exception('log copy failure'))
     logging.exception.expect_call(mock.is_string_comparator())
     logger._process_line('AUTOTEST_TEST_COMPLETE:/autotest/fifo1')
Exemplo n.º 4
0
    def _setup_post_record_init(self, cont, resultdir, my_harness):
        # now some specific stubs
        self.god.stub_function(self.job, 'config_get')
        self.god.stub_function(self.job, 'config_set')
        self.god.stub_function(self.job, 'record')

        # other setup
        results = os.path.join(self.autodir, 'results')
        pkgdir = os.path.join(self.autodir, 'packages')

        utils_memory.drop_caches.expect_call()
        job_sysinfo = sysinfo.sysinfo.expect_new(resultdir)
        if not cont:
            shutil.copyfile.expect_call(mock.is_string_comparator(),
                                        os.path.join(resultdir, 'control'))

        self.config = config.config.expect_new(self.job)
        self.job.config_get.expect_call(
            'boottool.executable').and_return(None)
        bootloader = boottool.boottool.expect_new(None)
        job.local_host.LocalHost.expect_new(hostname='localhost',
                                            bootloader=bootloader)
        job_sysinfo.log_per_reboot_data.expect_call()
        if not cont:
            self.job.record.expect_call('START', None, None)

        my_harness.run_start.expect_call()

        self.god.stub_function(utils, 'read_one_line')
        utils.read_one_line.expect_call('/proc/cmdline').and_return(
            'blah more-blah root=lala IDENT=81234567 blah-again console=tty1')
        self.job.config_set.expect_call('boot.default_args',
                                        'more-blah console=tty1')
Exemplo n.º 5
0
    def _setup_post_record_init(self, cont, resultdir, my_harness):
        # now some specific stubs
        self.god.stub_function(self.job, "config_get")
        self.god.stub_function(self.job, "config_set")
        self.god.stub_function(self.job, "record")

        # other setup
        results = os.path.join(self.autodir, "results")
        download = os.path.join(self.autodir, "tests", "download")
        pkgdir = os.path.join(self.autodir, "packages")

        utils.drop_caches.expect_call()
        job_sysinfo = sysinfo.sysinfo.expect_new(resultdir)
        if not cont:
            os.path.exists.expect_call(download).and_return(False)
            os.mkdir.expect_call(download)
            shutil.copyfile.expect_call(mock.is_string_comparator(), os.path.join(resultdir, "control"))

        self.config = config.config.expect_new(self.job)
        self.job.config_get.expect_call("boottool.executable").and_return(None)
        bootloader = boottool.boottool.expect_new(None)
        job.local_host.LocalHost.expect_new(hostname="localhost", bootloader=bootloader)
        job_sysinfo.log_per_reboot_data.expect_call()
        if not cont:
            self.job.record.expect_call("START", None, None)

        my_harness.run_start.expect_call()

        self.god.stub_function(utils, "read_one_line")
        utils.read_one_line.expect_call("/proc/cmdline").and_return(
            "blah more-blah root=lala IDENT=81234567 blah-again console=tty1"
        )
        self.job.config_set.expect_call("boot.default_args", "more-blah console=tty1")
Exemplo n.º 6
0
    def test_client_logger_process_line_package_install_fifo_failure(self):
        collector = autotest_remote.log_collector.expect_new(self.host, '', '')
        logger = autotest_remote.client_logger(self.host, '', '')
        self.god.stub_function(logger, '_send_tarball')

        autotest_remote.settings.get_value.expect_call(
            'PACKAGES', 'serve_packages_from_autoserv',
            type=bool).and_return(True)
        logger._send_tarball.expect_call('pkgname.tar.bz2', '/autotest/dest/')

        self.host.run.expect_call('echo B > /autotest/fifo3').and_raises(
            Exception('fifo failure'))
        logging.exception.expect_call(mock.is_string_comparator())
        logger._process_line('AUTOTEST_FETCH_PACKAGE:pkgname.tar.bz2:'
                             '/autotest/dest/:/autotest/fifo3')
Exemplo n.º 7
0
    def test_client_logger_process_line_package_install_fifo_failure(self):
        collector = autotest_remote.log_collector.expect_new(self.host, '', '')
        logger = autotest_remote.client_logger(self.host, '', '')
        self.god.stub_function(logger, '_send_tarball')

        autotest_remote.settings.get_value.expect_call('PACKAGES',
                                                       'serve_packages_from_autoserv',
                                                       type=bool).and_return(True)
        logger._send_tarball.expect_call('pkgname.tar.bz2', '/autotest/dest/')

        self.host.run.expect_call('echo B > /autotest/fifo3').and_raises(
            Exception('fifo failure'))
        logging.exception.expect_call(mock.is_string_comparator())
        logger._process_line('AUTOTEST_FETCH_PACKAGE:pkgname.tar.bz2:'
                             '/autotest/dest/:/autotest/fifo3')