-
Notifications
You must be signed in to change notification settings - Fork 85
Adding Travis CI config #16
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
Changes from 8 commits
78972f2
26b5612
e496269
cc2f62a
9bcd75b
873d496
322236c
2ba4add
e2110a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
sudo: false | ||
language: python | ||
matrix: | ||
include: | ||
- python: 2.7 | ||
env: TOXENV=py27 | ||
- python: 3.4 | ||
env: TOXENV=py34 | ||
- python: 3.5 | ||
env: TOXENV=py35 | ||
- python: 3.6 | ||
env: TOXENV=py36 | ||
- python: 3.6 | ||
env: TOXENV=bandit | ||
- python: 3.6 | ||
env: TOXENV=doc8 | ||
- python: 3.6 | ||
env: TOXENV=readme | ||
# pending reorg of deserialize_header | ||
# - python: 3.6 | ||
# env: TOXENV=flake8 | ||
# - python: 3.6 | ||
# env: TOXENV=pylint | ||
# pending test-vectors refactor | ||
# - python: 3.6 | ||
# env: TOXENV=flake8-tests | ||
- python: 3.6 | ||
env: TOXENV=pylint-tests | ||
- python: 3.6 | ||
env: TOXENV=examples | ||
- python: 3.6 | ||
env: TOXENV=flake8-examples | ||
- python: 3.6 | ||
env: TOXENV=pylint-examples | ||
install: pip install tox | ||
script: tox |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
************************************ | ||
aws-encryption-sdk Integration Tests | ||
************************************ | ||
|
||
In order to run these integration tests successfully, these things which must be configured. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: wording polish ("these things which must be configured") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to "these things must be configured". |
||
|
||
#. Ensure that AWS credentials are available in one of the `automatically discoverable credential locations`_. | ||
#. Set environment variable ``AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID`` to valid | ||
`AWS KMS key id`_ to use for integration tests. | ||
#. Set environment variable ``AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_CONTROL`` to ``RUN``. | ||
|
||
.. _automatically discoverable credential locations: http://boto3.readthedocs.io/en/latest/guide/configuration.html | ||
.. _AWS KMS key id: http://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,60 +14,31 @@ | |
decision making for integration tests.""" | ||
import os | ||
|
||
import botocore.session | ||
from six.moves.configparser import ConfigParser | ||
from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProvider | ||
|
||
SKIP_MESSAGE = 'Skipping tests due to blocking environment variable' | ||
SKIP_MESSAGE = ( | ||
'Required environment variables not found. Skipping integration tests.' | ||
' See integration tests README.rst for more information.' | ||
) | ||
TEST_CONTROL = 'AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_CONTROL' | ||
AWS_KMS_KEY_ID = 'AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID' | ||
|
||
|
||
def skip_tests(): | ||
blocker_var_name = 'AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_CONTROL' | ||
blocker_val = os.environ.get(blocker_var_name, None) | ||
if blocker_val != 'RUN': | ||
return True | ||
return False | ||
"""Only run tests if both required environment variables are found.""" | ||
test_control = os.environ.get(TEST_CONTROL, None) | ||
key_id = os.environ.get(AWS_KMS_KEY_ID, None) | ||
return not (test_control == 'RUN' and key_id is not None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: not a huge deal given the context, but could be a bit more readable for maintenance's sake; even just expanding the negate out would help: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll be refactoring a decent chunk of the integration test utils when we get the test vectors packaged as a Python package, so I'll leave refining this bit until then. |
||
|
||
|
||
def read_test_config(): | ||
"""Reads the test_values config file.""" | ||
config = ConfigParser() | ||
config_file = os.sep.join([os.path.dirname(__file__), 'test_values.conf']) | ||
config_readme = os.sep.join([os.path.dirname(__file__), 'README']) | ||
if not os.path.isfile(config_file): | ||
raise Exception('Integration test config file missing. See setup instructions in {}'.format(config_readme)) | ||
config.read(config_file) | ||
return config | ||
|
||
|
||
def get_cmk_arn(config): | ||
"""Retrieves the target CMK ARN from the received config.""" | ||
return config.get('TestKMSThickClientIntegration', 'cmk_arn') | ||
|
||
|
||
def setup_botocore_session(config): | ||
"""Configures a botocore session based on the received config.""" | ||
aws_params = {} | ||
for key in ['aws_access_key_id', 'aws_secret_access_key', 'aws_session_token']: | ||
try: | ||
aws_params[key] = config.get('TestKMSThickClientIntegration', key) | ||
except Exception: | ||
pass | ||
botocore_session = botocore.session.Session() | ||
if aws_params: | ||
botocore_session.set_credentials( | ||
access_key=aws_params['aws_access_key_id'], | ||
secret_key=aws_params['aws_secret_access_key'], | ||
token=aws_params['aws_session_token'] | ||
) | ||
return botocore_session | ||
def get_cmk_arn(): | ||
"""Retrieves the target CMK ARN from environment variable.""" | ||
return os.environ.get(AWS_KMS_KEY_ID) | ||
|
||
|
||
def setup_kms_master_key_provider(): | ||
"""Reads the test_values config file and builds the requested KMS Master Key Provider.""" | ||
config = read_test_config() | ||
cmk_arn = get_cmk_arn(config) | ||
botocore_session = setup_botocore_session(config) | ||
kms_master_key_provider = KMSMasterKeyProvider(botocore_session=botocore_session) | ||
cmk_arn = get_cmk_arn() | ||
kms_master_key_provider = KMSMasterKeyProvider() | ||
kms_master_key_provider.add_master_key(cmk_arn) | ||
return kms_master_key_provider |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, flag this as TODO and link to some tracker so we don't forget?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue opened to fix the underlying issue: #17