def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(['--no-conf', '-r', 'local', '-v']) mr_job.sandbox() try: with no_handlers_for_logger(): mr_job.run_job() except TimeoutException: raise except SystemExit: # we expect the job to throw a StepFailedException, # which causes run_job to call sys.exit() # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() self.assertIn( b"Counters: 1\n\tFoo\n\t\tBar=10000", stderr) self.assertIn(b'Status: 0\n', stderr) self.assertIn(b'Status: 99\n', stderr) self.assertNotIn(b'Status: 100\n', stderr) self.assertIn(b'STDERR: Qux\n', stderr) # exception should appear in exception message self.assertIn(b'BOOM', stderr) else: raise AssertionError()
def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(['--no-conf']) mr_job.sandbox() try: mr_job.run_job() except TimeoutException: raise except Exception, e: # we expect the job to throw an exception # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() assert_in("counters: {'Foo': {'Bar': 10000}}\n", stderr) assert_in('status: 0\n', stderr) assert_in('status: 99\n', stderr) assert_not_in('status: 100\n', stderr) assert_in('STDERR: Qux\n', stderr) # exception should appear in exception message assert_in('BOOM', e.message)
def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(['--no-conf']) mr_job.sandbox() try: with no_handlers_for_logger(): mr_job.run_job() except TimeoutException: raise except Exception, e: # we expect the job to throw an exception # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() assert_in("Counters from step 1:\n Foo:\n Bar: 10000", stderr) assert_in('status: 0\n', stderr) assert_in('status: 99\n', stderr) assert_not_in('status: 100\n', stderr) assert_in('STDERR: Qux\n', stderr) # exception should appear in exception message assert_in('BOOM', repr(e))
def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(["--no-conf", "-r", "local"]) mr_job.sandbox() try: with no_handlers_for_logger(): mr_job.run_job() except TimeoutException: raise except Exception as e: # we expect the job to throw an exception # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() self.assertIn(b"Counters from step 1:\n Foo:\n Bar: 10000", stderr) self.assertIn(b"status: 0\n", stderr) self.assertIn(b"status: 99\n", stderr) self.assertNotIn(b"status: 100\n", stderr) self.assertIn(b"STDERR: Qux\n", stderr) # exception should appear in exception message self.assertIn("BOOM", repr(e)) else: raise AssertionError()
def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(['--no-conf', '-r', 'local', '-v']) mr_job.sandbox() try: with no_handlers_for_logger(): mr_job.run_job() except TimeoutException: raise except SystemExit: # we expect the job to throw a StepFailedException, # which causes run_job to call sys.exit() # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() self.assertIn(b"Counters: 1\n\tFoo\n\t\tBar=10000", stderr) self.assertIn(b'Status: 0\n', stderr) self.assertIn(b'Status: 99\n', stderr) self.assertNotIn(b'Status: 100\n', stderr) self.assertIn(b'STDERR: Qux\n', stderr) # exception should appear in exception message self.assertIn(b'BOOM', stderr) else: raise AssertionError()
def test_large_amounts_of_stderr(self): mr_job = MRVerboseJob(['--no-conf', '-r', 'local']) mr_job.sandbox() try: with no_handlers_for_logger(): mr_job.run_job() except TimeoutException: raise except Exception as e: # we expect the job to throw an exception # look for expected output from MRVerboseJob stderr = mr_job.stderr.getvalue() self.assertIn(b"Counters from step 1:\n\tFoo\n\t\tBar=10000", stderr) self.assertIn(b'status: 0\n', stderr) self.assertIn(b'status: 99\n', stderr) self.assertNotIn(b'status: 100\n', stderr) self.assertIn(b'STDERR: Qux\n', stderr) # exception should appear in exception message self.assertIn('BOOM', repr(e)) else: raise AssertionError()