test - Run gsutil tests
Synopsis
gsutil test [-l] [-u] [-f] [command command...]
Description
The gsutil test command runs the gsutil unit tests and integration tests. The unit tests use an in-memory mock storage service implementation, while the integration tests send requests to the production service using the preferred API set in the boto configuration file (see gsutil help apis for details).
To run both the unit tests and integration tests, run the command with no arguments:
gsutil test
To run the unit tests only (which run quickly):
gsutil test -u
To run integration tests in parallel (CPU-intensive but much faster):
gsutil -m test
To limit the number of tests run in parallel to 10 at a time:
gsutil -m test -p 10
To see additional details for test failures:
gsutil -d test
To have the tests stop running immediately when an error occurs:
gsutil test -f
To run tests for one or more individual commands add those commands as arguments. For example, the following command will run the cp and mv command tests:
gsutil test cp mv
To list available tests, run the test command with the -l argument:
gsutil test -l
The tests are defined in the code under the gslib/tests module. Each test file is of the format test_[name].py where [name] is the test name you can pass to this command. For example, running “gsutil test ls” would run the tests in “gslib/tests/test_ls.py”.
You can also run an individual test class or function name by passing the test module followed by the class name and optionally a test name. For example, to run the an entire test class by name:
gsutil test naming.GsutilNamingTests
or an individual test function:
gsutil test cp.TestCp.test_streaming
You can list the available tests under a module or class by passing arguments with the -l option. For example, to list all available test functions in the cp module:
gsutil test -l cp
Options
-f | Exit on first test failure. |
-l | List available tests. |
-p | Run at most N tests in parallel. The default value is 15. |
-s | Run tests against S3 instead of GS. |
-u | Only run unit tests. |