Skip to content
New issue

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

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

Already on GitHub? # to your account

Nox system test refactor #60

Merged
merged 12 commits into from
Oct 28, 2016
Merged

Nox system test refactor #60

merged 12 commits into from
Oct 28, 2016

Conversation

theacodes
Copy link
Contributor

No description provided.

@theacodes
Copy link
Contributor Author

Not sure why travis is failing, I may have somehow broken the secrets. Will investigate tomorrow.

@theacodes
Copy link
Contributor Author

Not sure why travis is failing, I may have somehow broken the secrets. Will investigate tomorrow.

nvm, I think I did something dumb so it's maybe fixed now. :)

Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM

- python: 2.7
env: TOXENV=py27-system SYSTEM_TEST=1 SKIP_APP_ENGINE_SYSTEM_TEST=1
env: TOXENV=py27-system SYSTEM_TEST=1 SKIP_APP_ENGINE_SYSTEM_TEST=1 CLOUD_SDK_ROOT=${HOME}/.cache/cloud-sdk

This comment was marked as spam.

This comment was marked as spam.

# If set, this is where the environment setup will store the Cloud SDK.
# If unset, it will download the SDK to a temporary directory.
CLOUD_SDK_ROOT = os.environ.get('CLOUD_SDK_ROOT')
if CLOUD_SDK_ROOT:

This comment was marked as spam.

# If unset, it will download the SDK to a temporary directory.
CLOUD_SDK_ROOT = os.environ.get('CLOUD_SDK_ROOT')
if CLOUD_SDK_ROOT:
CLOUD_SDK_ROOT = py.path.local(CLOUD_SDK_ROOT)

This comment was marked as spam.

This comment was marked as spam.

if CLOUD_SDK_ROOT:
CLOUD_SDK_ROOT = py.path.local(CLOUD_SDK_ROOT)
CLOUD_SDK_ROOT.ensure(dir=True)
if not CLOUD_SDK_ROOT:

This comment was marked as spam.

This comment was marked as spam.

"""Downloads and installs the Google Cloud SDK."""

# If the sdk already exists, we don't need to do anything else.
if CLOUD_SDK_ROOT.join('google-cloud-sdk').exists():

This comment was marked as spam.

This comment was marked as spam.

'-O', str(tar_path))

# Extract the release.
prerun('tar', 'xzf', str(tar_path), '-C', str(CLOUD_SDK_ROOT))

This comment was marked as spam.

This comment was marked as spam.


# Run the install script.
prerun(
str(CLOUD_SDK_ROOT.join('google-cloud-sdk', 'install.sh')),

This comment was marked as spam.

This comment was marked as spam.

dest.remove()
py.path.local(application_default_credentials).copy(dest)

gcloud('auth', 'application-default', 'print-access-token')

This comment was marked as spam.

def session_default_explicit_service_account(session):
session.virtualenv = False
session.env['GOOGLE_APPLICATION_CREDENTIALS'] = SERVICE_ACCOUNT_FILE
session.env['EXPECT_PROJECT_ID'] = '1'

This comment was marked as spam.

This comment was marked as spam.

configure_cloud_sdk(AUTHORIZED_USER_FILE)

session.env[CLOUD_SDK_CONFIG_ENV] = str(CLOUD_SDK_ROOT)
session.run('pytest', '--pdb', 'test_default.py')

This comment was marked as spam.

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

@dhermes I did a bit of refactoring to remove the hacky usage of prerun, PTAL.

@@ -38,4 +38,5 @@ deploy:
repo: GoogleCloudPlatform/google-auth-library-python
env:
global:
secure: s6GdhJklftl8w/9WoETwLtvtKL4ledPA/TuBuqCXQxSuYWaPuTdRVcvoejGkHJpp7i/7v2T/0etYl+5koyskKm5+QZZweaaL7MAyjPGp+hmIaIlWQRz6w481NOf3i9uSmoQycssT0mNmwScNIqo+igbA2y14mr/e9aBuOcxNNzNzFQp2vaRMEju6q7xZMjYdcudUWL48vq9CoNa3X2ZArpqjkApR/TfYlG7glOj43NxuVDN4z9wIyUjaMHBfPgEhjaOaRyEFgEYITRwX1qDoXqcZdTVIq4Cn0uCH+Mvrz6Y+oUJGTJqH1k7N/DhzbSN9lJnVYaQW/yuvGHiGAwbb6Tcxiq2UqqhA9MfbPpmstDECs46v9Z3BT252KvYEQY7Q1v9g2gFhHvFGWISUxs80rnnPhEYfa11JoLvj2t8cowkE4pvj4OH32Eoyvc5H07hW3F5xpuF7Jt7N09TNZkUrpmiRJEhfrVNgjsrWO77/q5h8mXGd+9vYmz++yzKu+63x8x1MpeigGCG73Dpu9Otm5eydOZfpJ39ZfZWUb7G2JahgHaGweM9dmnpJtzHQgijmHjjfAx9jgnQ8IQz9nkFmyMI8H7HouwalnrJtpSSbvMqOQ0kiZhMzdBKH5pD3tjLgSlgA0pKelBwlooY6jGlj4LrtbDAxa6cZyXiFoqWpT1w=
- secure: s6GdhJklftl8w/9WoETwLtvtKL4ledPA/TuBuqCXQxSuYWaPuTdRVcvoejGkHJpp7i/7v2T/0etYl+5koyskKm5+QZZweaaL7MAyjPGp+hmIaIlWQRz6w481NOf3i9uSmoQycssT0mNmwScNIqo+igbA2y14mr/e9aBuOcxNNzNzFQp2vaRMEju6q7xZMjYdcudUWL48vq9CoNa3X2ZArpqjkApR/TfYlG7glOj43NxuVDN4z9wIyUjaMHBfPgEhjaOaRyEFgEYITRwX1qDoXqcZdTVIq4Cn0uCH+Mvrz6Y+oUJGTJqH1k7N/DhzbSN9lJnVYaQW/yuvGHiGAwbb6Tcxiq2UqqhA9MfbPpmstDECs46v9Z3BT252KvYEQY7Q1v9g2gFhHvFGWISUxs80rnnPhEYfa11JoLvj2t8cowkE4pvj4OH32Eoyvc5H07hW3F5xpuF7Jt7N09TNZkUrpmiRJEhfrVNgjsrWO77/q5h8mXGd+9vYmz++yzKu+63x8x1MpeigGCG73Dpu9Otm5eydOZfpJ39ZfZWUb7G2JahgHaGweM9dmnpJtzHQgijmHjjfAx9jgnQ8IQz9nkFmyMI8H7HouwalnrJtpSSbvMqOQ0kiZhMzdBKH5pD3tjLgSlgA0pKelBwlooY6jGlj4LrtbDAxa6cZyXiFoqWpT1w=

This comment was marked as spam.

This comment was marked as spam.

# This sets the config root to the tests' config root. This prevents
# our tests from clobbering a developer's configuration when running
# these tests locally.
session.env[CLOUD_SDK_CONFIG_ENV] = str(CLOUD_SDK_ROOT)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


# gcloud requires Python 2.7 and doesn't work on 3.x, so we need to tell it
# where to find 2.7 when we're running in a 3.x environment.
CLOUD_SDK_PYTHON_ENV = 'GCLOUD_PYTHON'

This comment was marked as spam.

This comment was marked as spam.

if CLOUD_SDK_ROOT.join('google-cloud-sdk').exists():
# Note that because of this we do not attempt to update the sdk -
# if the CLOUD_SDK_ROOT is cached, it will need to be periodically cleared.
if CLOUD_SDK_INSTALL_DIR.exists():

This comment was marked as spam.

This comment was marked as spam.

prerun(
str(CLOUD_SDK_ROOT.join('google-cloud-sdk', 'install.sh')),
session.run(
str(CLOUD_SDK_INSTALL_DIR.join('install.sh')),

This comment was marked as spam.

This comment was marked as spam.

dest = CLOUD_SDK_ROOT.join('application_default_credentials.json')
if dest.exists():
dest.remove()
py.path.local(application_default_credentials).copy(dest)

This comment was marked as spam.

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

No idea why travis is failing on py35-system, as there doesn't seem to be any output from the failing commands. Investigating now.

@theacodes
Copy link
Contributor Author

V I C T O R Y

@theacodes theacodes merged commit bbc3943 into master Oct 28, 2016
@theacodes theacodes deleted the nox-system-test-refactor branch October 28, 2016 06:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants