Skip to content

Renaming regression tests to system tests. #954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
32 changes: 16 additions & 16 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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 <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
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 <https://cloud.google.com/datastore/docs/tools/indexconfig>`__
Expand All @@ -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.
Expand All @@ -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
-------------
Expand Down
2 changes: 1 addition & 1 deletion docs/_components/datastore-quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
Expand Down
2 changes: 1 addition & 1 deletion docs/_components/storage-quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
Expand Down
3 changes: 1 addition & 2 deletions run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion scripts/cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${@}
12 changes: 6 additions & 6 deletions scripts/run_regression.sh → scripts/run_system_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ 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."

# 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."
exit
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion regression/datastore.py → system_tests/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions regression/storage.py → system_tests/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
16 changes: 8 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,7 +30,7 @@ commands =
deps =
{[testenv:cover]deps}
coveralls
passenv = {[testenv:regression]passenv}
passenv = {[testenv:system-tests]passenv}

[testenv:docs]
basepython =
Expand All @@ -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}