l.s.j.t.t.TestJobRunner(TestCaseWithFactory) : class documentation

Part of lp.services.job.tests.test_runner View In Hierarchy

Ensure JobRunner behaves as expected.
Method makeTwoJobs Test fixture. Create two jobs.
Method test_runJob Ensure status is set to completed when a job runs to completion.
Method test_runAll Ensure runAll works in the normal case.
Method test_runAll_skips_lease_failures Ensure runAll skips jobs whose leases can't be acquired.
Method test_runAll_reports_oopses When an error is encountered, report an oops and continue.
Method test_oops_messages_used_when_handling Oops messages should appear even when exceptions are handled.
Method test_runAll_aborts_transaction_on_error runAll should abort the transaction on oops.
Method test_runAll_mails_oopses Email interested parties about OOPses.
Method test_runAll_mails_user_errors User errors should be mailed out without oopsing.
Method test_runAll_requires_IRunnable Supplied classes must implement IRunnableJob.
Method test_runJob_records_failure When a job fails, the failure needs to be recorded.
Method test_runJobHandleErrors_oops_generated The handle errors method records an oops for raised errors.
Method test_runJobHandleErrors_oops_timeline The oops timeline only covers the job itself.
Method test_runJobHandleErrors_oops_timeline_detail_filter A job can choose to filter oops timeline details.
Method test_runJobHandleErrors_user_error_no_oops If the job raises a user error, there is no oops.
Method test_runJob_raising_retry_error If a job raises a retry_error, it should be re-queued.
Method test_runJob_exceeding_max_retries If a job exceeds maximum retries, it should raise normally.
Method test_runJob_sets_default_timeout_function runJob sets a default timeout function for urlfetch.
Method test_runJobHandleErrors_oops_generated_notify_fails A second oops is logged if the notification of the oops fails.
Method test_runJobHandleErrors_oops_generated_user_notify_fails A second oops is logged if the notification of the oops fails.
Method test_runJob_with_SuspendJobException Undocumented
Method test_taskId Undocumented

Inherited from TestCaseWithFactory:

Method setUp Undocumented
Method getUserBrowser Return a Browser logged in as a fresh user, maybe opened at url.
Method getNonRedirectingBrowser Undocumented
Method createBranchAtURL Create a branch at the supplied URL.
Method create_branch_and_tree Create a database branch, bzr branch and bzr checkout.
Method createBzrBranch Create a bzr branch for a database branch.
Static Method getBranchPath Return the path of the branch in the mirrored area.
Method useTempBzrHome Undocumented
Method useBzrBranches Prepare for using bzr branches.

Inherited from TestCase (via TestCaseWithFactory):

Method becomeDbUser Commit, then log into the database as dbuser.
Method __str__ The string representation of a test is its id.
Method useContext Use the supplied context in this test.
Method makeTemporaryDirectory Create a temporary directory, and return its path.
Method installKarmaRecorder Set up and return a KarmaRecorder.
Method assertProvides Assert 'obj' correctly provides 'interface'.
Method assertNotifies Assert that a callable performs a given notification.
Method assertNoNotification Assert that no notifications are generated by the callable.
Method assertSqlAttributeEqualsDate Fail unless the value of the attribute is equal to the date.
Method assertTextMatchesExpressionIgnoreWhitespace Undocumented
Method assertIsInstance Assert that an instance is an instance of assert_class.
Method assertIsNot Assert that expected is not the same object as observed.
Method assertContentEqual Assert that 'iter1' has the same content as 'iter2'.
Method assertRaisesWithContent Check if the given exception is raised with given content.
Method assertBetween Assert that 'variable' is strictly between two boundaries.
Method assertVectorEqual Apply assertEqual to all given pairs in one go.
Method expectedLog Expect a log to be written that matches the regex.
Method pushConfig Push some key-value pairs into a section of the config.
Method attachOopses Undocumented
Method attachLibrarianLog Include the logChunks from fixture in the test details.
Method assertStatementCount Assert that the expected number of SQL statements occurred.
Method useTempDir Use a temporary directory for this test.
Method assertEmailHeadersEqual Assert that two email headers are equal.
Method assertStartsWith Undocumented
Method assertEndsWith Asserts that s ends with suffix.
Method checkPermissions Check if the used_permissions match expected_permissions.
Method assertEmailQueueLength Pop the email queue, assert its length, and return it.
Method _unfoldEmailHeader Unfold a multiline email header.
def makeTwoJobs(self):
Test fixture. Create two jobs.
def test_runJob(self):
Ensure status is set to completed when a job runs to completion.
def test_runAll(self):
Ensure runAll works in the normal case.
def test_runAll_skips_lease_failures(self):
Ensure runAll skips jobs whose leases can't be acquired.
def test_runAll_reports_oopses(self):
When an error is encountered, report an oops and continue.
def test_oops_messages_used_when_handling(self):
Oops messages should appear even when exceptions are handled.
def test_runAll_aborts_transaction_on_error(self):
runAll should abort the transaction on oops.
def test_runAll_mails_oopses(self):
Email interested parties about OOPses.
def test_runAll_mails_user_errors(self):
User errors should be mailed out without oopsing.

User errors are identified by the RunnableJob.user_error_types attribute. They do not cause an oops to be recorded, and their error messages are mailed to interested parties verbatim.

def test_runAll_requires_IRunnable(self):
Supplied classes must implement IRunnableJob.

If they don't, we get a TypeError. If they do, then we get an AttributeError, because we don't actually implement the interface.

def test_runJob_records_failure(self):
When a job fails, the failure needs to be recorded.
def test_runJobHandleErrors_oops_generated(self):
The handle errors method records an oops for raised errors.
def test_runJobHandleErrors_oops_timeline(self):
The oops timeline only covers the job itself.
def test_runJobHandleErrors_oops_timeline_detail_filter(self):
A job can choose to filter oops timeline details.
def test_runJobHandleErrors_user_error_no_oops(self):
If the job raises a user error, there is no oops.
def test_runJob_raising_retry_error(self):
If a job raises a retry_error, it should be re-queued.
def test_runJob_exceeding_max_retries(self):
If a job exceeds maximum retries, it should raise normally.
def test_runJob_sets_default_timeout_function(self):
runJob sets a default timeout function for urlfetch.
def test_runJobHandleErrors_oops_generated_notify_fails(self):
A second oops is logged if the notification of the oops fails.
def test_runJobHandleErrors_oops_generated_user_notify_fails(self):
A second oops is logged if the notification of the oops fails.

In this test case the error is a user expected error, so the notifyUserError is called, and in this case the notify raises too.

def test_runJob_with_SuspendJobException(self):
Undocumented
def test_taskId(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.