toil.test.provisioners.gceProvisionerTest

Attributes

exactPython

log

Classes

ToilTest

A common base class for Toil tests.

AbstractGCEAutoscaleTest

A common base class for Toil tests.

GCEAutoscaleTest

A common base class for Toil tests.

GCEStaticAutoscaleTest

Runs the tests on a statically provisioned cluster with autoscaling enabled.

GCEAutoscaleTestMultipleNodeTypes

A common base class for Toil tests.

GCERestartTest

This test insures autoscaling works on a restarted Toil run

Functions

integrative(test_item)

Use this to decorate integration tests so as to skip them during regular builds.

needs_fetchable_appliance(test_item)

Use as a decorator before test classes or methods to only run them if

needs_google_project(test_item)

Use as a decorator before test classes or methods to run only if we have a Google Cloud project set.

needs_google_storage(test_item)

Use as a decorator before test classes or methods to run only if Google

slow(test_item)

Use this decorator to identify tests that are slow and not critical.

timeLimit(seconds)

Use to limit the execution time of a function.

Module Contents

class toil.test.provisioners.gceProvisionerTest.ToilTest(methodName='runTest')[source]

Bases: unittest.TestCase

A common base class for Toil tests.

Please have every test case directly or indirectly inherit this one.

When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.

setup_method(method)[source]
Parameters:

method (Any)

Return type:

None

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

Return type:

None

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

Return type:

None

setUp()[source]

Hook method for setting up the test fixture before exercising it.

Return type:

None

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

Return type:

None

classmethod awsRegion()[source]

Pick an appropriate AWS region.

Use us-west-2 unless running on EC2, in which case use the region in which the instance is located

Return type:

str

toil.test.provisioners.gceProvisionerTest.integrative(test_item)[source]

Use this to decorate integration tests so as to skip them during regular builds.

We define integration tests as A) involving other, non-Toil software components that we develop and/or B) having a higher cost (time or money).

Parameters:

test_item (MT)

Return type:

MT

toil.test.provisioners.gceProvisionerTest.needs_fetchable_appliance(test_item)[source]

Use as a decorator before test classes or methods to only run them if the Toil appliance Docker image is able to be downloaded from the Internet.

Parameters:

test_item (MT)

Return type:

MT

toil.test.provisioners.gceProvisionerTest.needs_google_project(test_item)[source]

Use as a decorator before test classes or methods to run only if we have a Google Cloud project set.

Parameters:

test_item (MT)

Return type:

MT

toil.test.provisioners.gceProvisionerTest.needs_google_storage(test_item)[source]

Use as a decorator before test classes or methods to run only if Google Cloud is installed and we ought to be able to access public Google Storage URIs.

Parameters:

test_item (MT)

Return type:

MT

toil.test.provisioners.gceProvisionerTest.slow(test_item)[source]

Use this decorator to identify tests that are slow and not critical. Skip if TOIL_TEST_QUICK is true.

Parameters:

test_item (MT)

Return type:

MT

toil.test.provisioners.gceProvisionerTest.timeLimit(seconds)[source]

Use to limit the execution time of a function.

Raises an exception if the execution of the function takes more than the specified amount of time. See <http://stackoverflow.com/a/601168>.

Parameters:

seconds (int) – maximum allowable time, in seconds

Return type:

Generator[None, None, None]

>>> import time
>>> with timeLimit(2):
...    time.sleep(1)
>>> import time
>>> with timeLimit(1):
...    time.sleep(2)
Traceback (most recent call last):
    ...
RuntimeError: Timed out
toil.test.provisioners.gceProvisionerTest.exactPython = 'python3.9'
toil.test.provisioners.gceProvisionerTest.log[source]
class toil.test.provisioners.gceProvisionerTest.AbstractGCEAutoscaleTest(methodName)[source]

Bases: toil.test.ToilTest

A common base class for Toil tests.

Please have every test case directly or indirectly inherit this one.

When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.

projectID
sshUtil(command)[source]
rsyncUtil(src, dest)[source]
destroyClusterUtil()[source]
createClusterUtil(args=None)[source]
cleanJobStoreUtil()[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

launchCluster()[source]
class toil.test.provisioners.gceProvisionerTest.GCEAutoscaleTest(name)[source]

Bases: AbstractGCEAutoscaleTest

A common base class for Toil tests.

Please have every test case directly or indirectly inherit this one.

When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

launchCluster()[source]
testAutoScale()[source]
testSpotAutoScale()[source]
class toil.test.provisioners.gceProvisionerTest.GCEStaticAutoscaleTest(name)[source]

Bases: GCEAutoscaleTest

Runs the tests on a statically provisioned cluster with autoscaling enabled.

launchCluster()[source]
class toil.test.provisioners.gceProvisionerTest.GCEAutoscaleTestMultipleNodeTypes(name)[source]

Bases: AbstractGCEAutoscaleTest

A common base class for Toil tests.

Please have every test case directly or indirectly inherit this one.

When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testAutoScale()[source]
class toil.test.provisioners.gceProvisionerTest.GCERestartTest(name)[source]

Bases: AbstractGCEAutoscaleTest

This test insures autoscaling works on a restarted Toil run

setUp()[source]

Hook method for setting up the test fixture before exercising it.

testAutoScaledCluster()[source]