diff --git a/.gitignore b/.gitignore index b2e19788405a..75e7215a7878 100644 --- a/.gitignore +++ b/.gitignore @@ -43,8 +43,8 @@ docs/_build env/ coverage.xml -# Regression test environment variables. -regression/local_test_setup +# System test environment variables. +system_tests/local_test_setup # Make sure a generated file isn't accidentally committed. pylintrc_reduced diff --git a/.travis.yml b/.travis.yml index adfe973fe50a..cb75b751908d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,8 @@ script: - tox -e py27 - tox -e py34 - tox -e lint - - tox -e regression - - tox -e regression3 + - tox -e system-tests + - tox -e system-tests3 - scripts/merge.sh after_success: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c7ff6f8e2240..58ad74409b4b 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -141,22 +141,22 @@ Running Tests $ cd ~/hack-on-gcloud/ $ /usr/bin/tox -Running Regression Tests ------------------------- +Running System Tests +-------------------- -- To run regression tests you can execute:: +- To run system tests you can execute:: - $ tox -e regression + $ tox -e system-tests - or run only regression tests for a particular package via:: + or run only system tests for a particular package via:: - $ python regression/run_regression.py --package {package} + $ python system_tests/run_system_test.py --package {package} This alone will not run the tests. You'll need to change some local auth settings and change some configuration in your project to run all the tests. -- Regression tests will be run against an actual project and +- System tests will be run against an actual project and so you'll need to provide some environment variables to facilitate authentication to your project: @@ -165,17 +165,17 @@ Running Regression Tests - ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to. This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``. - ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file; - see ``regression/app_credentials.json.sample`` as an example. Such a file + see ``system_tests/app_credentials.json.sample`` as an example. Such a file can be downloaded directly from the developer's console by clicking "Generate new JSON key". See private key `docs `__ for more details. -- Examples of these can be found in ``regression/local_test_setup.sample``. We - recommend copying this to ``regression/local_test_setup``, editing the values - and sourcing them into your environment:: +- Examples of these can be found in ``system_tests/local_test_setup.sample``. We + recommend copying this to ``system_tests/local_test_setup``, editing the + values and sourcing them into your environment:: - $ source regression/local_test_setup + $ source system_tests/local_test_setup - For datastore tests, you'll need to create composite `indexes `__ @@ -196,7 +196,7 @@ Running Regression Tests > --key-file=$P12_CREDENTIALS_FILE # Create the indexes - $ gcloud preview datastore create-indexes regression/data/ \ + $ gcloud preview datastore create-indexes system_tests/data/ \ > --project=$GCLOUD_TESTS_DATASET_ID # Restore your environment to its previous state. @@ -205,13 +205,13 @@ Running Regression Tests - For datastore query tests, you'll need stored data in your dataset. To populate this data, run:: - $ python regression/populate_datastore.py + $ python system_tests/populate_datastore.py - If you make a mistake during development (i.e. a failing test that - prevents clean-up) you can clear all regression data from your + prevents clean-up) you can clear all system test data from your datastore instance via:: - $ python regression/clear_datastore.py + $ python system_tests/clear_datastore.py Test Coverage ------------- diff --git a/docs/_components/datastore-quickstart.rst b/docs/_components/datastore-quickstart.rst index b9a098aa335d..8a5d8ef51720 100644 --- a/docs/_components/datastore-quickstart.rst +++ b/docs/_components/datastore-quickstart.rst @@ -23,7 +23,7 @@ authentication to your project: - ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to. This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``. - ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file; - see ``regression/app_credentials.json.sample`` as an example. Such a file + see ``system_tests/app_credentials.json.sample`` as an example. Such a file can be downloaded directly from the developer's console by clicking "Generate new JSON key". See private key `docs `__ diff --git a/docs/_components/storage-quickstart.rst b/docs/_components/storage-quickstart.rst index a103a8a73380..64c300778031 100644 --- a/docs/_components/storage-quickstart.rst +++ b/docs/_components/storage-quickstart.rst @@ -23,7 +23,7 @@ authentication to your project: - ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to. This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``. - ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file; - see ``regression/app_credentials.json.sample`` as an example. Such a file + see ``system_tests/app_credentials.json.sample`` as an example. Such a file can be downloaded directly from the developer's console by clicking "Generate new JSON key". See private key `docs `__ diff --git a/run_pylint.py b/run_pylint.py index 4cdb0435a735..4c1d1e1df3dc 100644 --- a/run_pylint.py +++ b/run_pylint.py @@ -103,8 +103,7 @@ def is_production_filename(filename): :rtype: boolean :returns: Boolean indicating production status. """ - return not ('demo' in filename or 'test' in filename or - filename.startswith('regression')) + return not ('demo' in filename or 'test' in filename) def get_files_for_linting(allow_limited=True): diff --git a/scripts/cover.sh b/scripts/cover.sh index 2fd8ec4be36a..e40fc38a64f3 100755 --- a/scripts/cover.sh +++ b/scripts/cover.sh @@ -16,5 +16,6 @@ set -ev -nosetests --with-xunit --with-xcoverage --cover-package=gcloud \ +nosetests --ignore-files=run_system_test\.py \ +--with-xunit --with-xcoverage --cover-package=gcloud \ --nocapture --cover-erase --cover-tests --cover-branches ${@} diff --git a/scripts/run_regression.sh b/scripts/run_system_tests.sh similarity index 78% rename from scripts/run_regression.sh rename to scripts/run_system_tests.sh index c8690bb40608..3b625066208b 100755 --- a/scripts/run_regression.sh +++ b/scripts/run_system_tests.sh @@ -18,7 +18,7 @@ set -ev # If we're on Travis, we need to set up the environment. if [[ "${TRAVIS}" == "true" ]]; then - # If merging to master and not a pull request, run regression test. + # If merging to master and not a pull request, run system test. if [[ "${TRAVIS_BRANCH}" == "master" ]] && \ [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then echo "Running in Travis during merge, decrypting stored key file." @@ -26,7 +26,7 @@ if [[ "${TRAVIS}" == "true" ]]; then # Convert encrypted key file into decrypted file to be used. openssl aes-256-cbc -K $encrypted_a1b222e8c14d_key \ -iv $encrypted_a1b222e8c14d_iv \ - -in regression/key.json.enc \ + -in system_tests/key.json.enc \ -out $GOOGLE_APPLICATION_CREDENTIALS -d else echo "Running in Travis during non-merge to master, doing nothing." @@ -34,7 +34,7 @@ if [[ "${TRAVIS}" == "true" ]]; then fi fi -# Run the regression tests for each tested package. -python regression/run_regression.py --package datastore -python regression/run_regression.py --package storage -python regression/run_regression.py --package pubsub +# Run the system tests for each tested package. +python system_tests/run_system_test.py --package datastore +python system_tests/run_system_test.py --package storage +python system_tests/run_system_test.py --package pubsub diff --git a/regression/__init__.py b/system_tests/__init__.py similarity index 100% rename from regression/__init__.py rename to system_tests/__init__.py diff --git a/regression/app_credentials.json.sample b/system_tests/app_credentials.json.sample similarity index 100% rename from regression/app_credentials.json.sample rename to system_tests/app_credentials.json.sample diff --git a/regression/clear_datastore.py b/system_tests/clear_datastore.py similarity index 97% rename from regression/clear_datastore.py rename to system_tests/clear_datastore.py index 6c388d4dd2c6..07bcafd8d060 100644 --- a/regression/clear_datastore.py +++ b/system_tests/clear_datastore.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Script to populate datastore with regression test data.""" +"""Script to populate datastore with system test data.""" from six.moves import input diff --git a/regression/data/CloudPlatform_128px_Retina.png b/system_tests/data/CloudPlatform_128px_Retina.png similarity index 100% rename from regression/data/CloudPlatform_128px_Retina.png rename to system_tests/data/CloudPlatform_128px_Retina.png diff --git a/regression/data/five-point-one-mb-file.zip b/system_tests/data/five-point-one-mb-file.zip similarity index 100% rename from regression/data/five-point-one-mb-file.zip rename to system_tests/data/five-point-one-mb-file.zip diff --git a/regression/data/index.yaml b/system_tests/data/index.yaml similarity index 100% rename from regression/data/index.yaml rename to system_tests/data/index.yaml diff --git a/regression/data/simple.txt b/system_tests/data/simple.txt similarity index 100% rename from regression/data/simple.txt rename to system_tests/data/simple.txt diff --git a/regression/datastore.py b/system_tests/datastore.py similarity index 99% rename from regression/datastore.py rename to system_tests/datastore.py index 6c54b5a36a0a..4ee3dcb0bd0a 100644 --- a/regression/datastore.py +++ b/system_tests/datastore.py @@ -20,7 +20,7 @@ from gcloud.datastore import _implicit_environ # This assumes the command is being run via tox hence the # repository root is the current directory. -from regression import populate_datastore +from system_tests import populate_datastore _implicit_environ._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID' diff --git a/regression/key.json.enc b/system_tests/key.json.enc similarity index 100% rename from regression/key.json.enc rename to system_tests/key.json.enc diff --git a/regression/local_test_setup.sample b/system_tests/local_test_setup.sample similarity index 100% rename from regression/local_test_setup.sample rename to system_tests/local_test_setup.sample diff --git a/regression/populate_datastore.py b/system_tests/populate_datastore.py similarity index 97% rename from regression/populate_datastore.py rename to system_tests/populate_datastore.py index 68dbc4e79516..7456cf997a13 100644 --- a/regression/populate_datastore.py +++ b/system_tests/populate_datastore.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Script to populate datastore with regression test data.""" +"""Script to populate datastore with system test data.""" from six.moves import zip diff --git a/regression/pubsub.py b/system_tests/pubsub.py similarity index 100% rename from regression/pubsub.py rename to system_tests/pubsub.py diff --git a/regression/run_regression.py b/system_tests/run_system_test.py similarity index 90% rename from regression/run_regression.py rename to system_tests/run_system_test.py index 9a1545056a0b..4667023eb16f 100644 --- a/regression/run_regression.py +++ b/system_tests/run_system_test.py @@ -18,7 +18,7 @@ # This assumes the command is being run via tox hence the # repository root is the current directory. -from regression import regression_utils +from system_tests import system_test_utils def get_parser(): @@ -42,9 +42,9 @@ def main(): args = parser.parse_args() # Make sure environ is set before running test. if args.package == 'datastore': - regression_utils.check_environ(require_datastore=True) + system_test_utils.check_environ(require_datastore=True) elif args.package == 'storage': - regression_utils.check_environ(require_storage=True) + system_test_utils.check_environ(require_storage=True) test_result = run_module_tests(args.package) if not test_result.wasSuccessful(): sys.exit(1) diff --git a/regression/storage.py b/system_tests/storage.py similarity index 98% rename from regression/storage.py rename to system_tests/storage.py index 17d578a639ec..7ee7b3f3a217 100644 --- a/regression/storage.py +++ b/system_tests/storage.py @@ -84,13 +84,13 @@ class TestStorageFiles(unittest2.TestCase): FILES = { 'logo': { - 'path': 'regression/data/CloudPlatform_128px_Retina.png', + 'path': 'system_tests/data/CloudPlatform_128px_Retina.png', }, 'big': { - 'path': 'regression/data/five-point-one-mb-file.zip', + 'path': 'system_tests/data/five-point-one-mb-file.zip', }, 'simple': { - 'path': 'regression/data/simple.txt', + 'path': 'system_tests/data/simple.txt', } } diff --git a/regression/regression_utils.py b/system_tests/system_test_utils.py similarity index 94% rename from regression/regression_utils.py rename to system_tests/system_test_utils.py index 3ac52dc4ce4e..cada1c1298a8 100644 --- a/regression/regression_utils.py +++ b/system_tests/system_test_utils.py @@ -23,7 +23,7 @@ CREDENTIALS = os.getenv('GOOGLE_APPLICATION_CREDENTIALS') ENVIRON_ERROR_MSG = """\ -To run the regression tests, you need to set some environment variables. +To run the system tests, you need to set some environment variables. Please check the Contributing guide for instructions. """ diff --git a/tox.ini b/tox.ini index 38f020bf8ee9..8f99b4eba030 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ envlist = install_command = {toxinidir}/scripts/custom_pip_install.sh {opts} {packages} commands = - nosetests + nosetests --ignore-files=run_system_test\.py deps = nose unittest2 @@ -30,7 +30,7 @@ commands = deps = {[testenv:cover]deps} coveralls -passenv = {[testenv:regression]passenv} +passenv = {[testenv:system-tests]passenv} [testenv:docs] basepython = @@ -56,18 +56,18 @@ deps = -ehg+https://bitbucket.org/logilab/pylint#egg=pylint unittest2 protobuf==3.0.0-alpha-1 -passenv = {[testenv:regression]passenv} +passenv = {[testenv:system-tests]passenv} -[testenv:regression] +[testenv:system-tests] basepython = python2.7 commands = - {toxinidir}/scripts/run_regression.sh + {toxinidir}/scripts/run_system_tests.sh passenv = GOOGLE_* GCLOUD_* TRAVIS* encrypted_* -[testenv:regression3] +[testenv:system-tests3] basepython = python3.4 commands = - {toxinidir}/scripts/run_regression.sh -passenv = {[testenv:regression]passenv} + {toxinidir}/scripts/run_system_tests.sh +passenv = {[testenv:system-tests]passenv}