class WatchdogVirtConsoleLogTest(TestHelper): def setUp(self): with session.begin(): self.watchdog = Watchdog() 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_running(self.recipe, virt=True, lab_controller=self.get_lc()) self.cached_console_log = os.path.join( get_conf().get('CACHEPATH'), 'recipes', str(self.recipe.id // 1000) + '+', str(self.recipe.id), 'console.log') # https://bugzilla.redhat.com/show_bug.cgi?id=950903 @patch.object(ProxyHelper, 'get_console_log') def test_stores_virt_console_logs(self, test_get_console_log): # set return value since we did not configure the OpenStack Identity APIs test_get_console_log.return_value = 'foo' active_watchdogs = self.watchdog.hub.recipes.tasks.watchdogs('active') self.watchdog.active_watchdogs(active_watchdogs) self.watchdog.run() self.assert_(self.check_console_log_registered()) self.assert_(self.check_cached_log_contents('foo')) # https://bugzilla.redhat.com/show_bug.cgi?id=1504527 @patch.object(ProxyHelper, 'get_console_log') def test_handles_non_ascii_characters_in_openstack_console( self, test_get_console_log): # OpenStack converts any non-ASCII bytes to U+FFFD. # Hence this two-byte UTF-8 sequence for U+00AE becomes U+FFFD U+FFFD. log_contents = u'Firmware for Intel\ufffd\ufffd Wireless 5150 A/G/N network adaptors\n' test_get_console_log.return_value = log_contents active_watchdogs = self.watchdog.hub.recipes.tasks.watchdogs('active') self.watchdog.active_watchdogs(active_watchdogs) self.watchdog.run() self.assert_(self.check_console_log_registered()) self.assertEquals( open(self.cached_console_log).read().decode('utf8'), log_contents)
class WatchdogVirtConsoleLogTest(TestHelper): def setUp(self): with session.begin(): self.watchdog = Watchdog() self.recipe = data_setup.create_recipe() data_setup.create_job_for_recipes([self.recipe]) data_setup.mark_recipe_running(self.recipe, virt=True, lab_controller=self.get_lc()) self.cached_console_log = os.path.join(get_conf().get('CACHEPATH'), 'recipes', str(self.recipe.id // 1000) + '+', str(self.recipe.id), 'console.log') # https://bugzilla.redhat.com/show_bug.cgi?id=950903 @patch.object(ProxyHelper, 'get_console_log') def test_stores_virt_console_logs(self, test_get_console_log): # set return value since we did not configure the OpenStack Identity APIs test_get_console_log.return_value = 'foo' active_watchdogs = self.watchdog.hub.recipes.tasks.watchdogs('active') self.watchdog.active_watchdogs(active_watchdogs) self.watchdog.run() self.assert_(self.check_console_log_registered()) self.assert_(self.check_cached_log_contents('foo'))
class WatchdogVirtConsoleLogTest(TestHelper): def setUp(self): with session.begin(): self.watchdog = Watchdog() 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_running(self.recipe, virt=True, lab_controller=self.get_lc()) self.cached_console_log = os.path.join(get_conf().get('CACHEPATH'), 'recipes', str(self.recipe.id // 1000) + '+', str(self.recipe.id), 'console.log') # https://bugzilla.redhat.com/show_bug.cgi?id=950903 @patch.object(ProxyHelper, 'get_console_log') def test_stores_virt_console_logs(self, test_get_console_log): # set return value since we did not configure the OpenStack Identity APIs test_get_console_log.return_value = 'foo' active_watchdogs = self.watchdog.hub.recipes.tasks.watchdogs('active') self.watchdog.active_watchdogs(active_watchdogs) self.watchdog.run() self.assert_(self.check_console_log_registered()) self.assert_(self.check_cached_log_contents('foo'))