Skip to content
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

Update Vault version test matrix / Oldest Support Vault Version #610

Merged
merged 4 commits into from Jul 26, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -4,10 +4,10 @@ python:
- '3.7'
- '2.7'
env:
- HVAC_VAULT_VERSION=1.4.0 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.3.4 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.5.0 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.4.3 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.3.7 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.2.4 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=1.1.5 HVAC_VAULT_LICENSE=enterprise
- HVAC_VAULT_VERSION=STABLE HVAC_VAULT_LICENSE=OSS
- TOXENV=flake8
matrix:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,8 +11,8 @@
[![Twitter - @python_hvac](https://img.shields.io/twitter/follow/python_hvac.svg?label=Twitter%20-%20@python_hvac&style=social?style=plastic)](https://twitter.com/python_hvac)
[![Gitter chat](https://badges.gitter.im/hvac/community.png)](https://gitter.im/hvac/community)

Tested against the latest release, HEAD ref, and 3 previous minor versions (counting back from the latest release) of Vault.
Current official support covers Vault v1.1.5 or later.
Tested against the latest release, HEAD ref, and 3 previous minor versions (counting back from the latest release) of Vault.
Current official support covers Vault v1.2.4 or later.

## Installation

Expand Down
52 changes: 20 additions & 32 deletions tests/integration_tests/api/auth_methods/test_gcp.py
Expand Up @@ -59,42 +59,30 @@ def test_configure(self, label, credentials='', raises=None):
param(
'success',
),
param(
'no config written yet',
write_config_first=False,
raises=exceptions.InvalidPath
)
])
def test_read_config(self, label, write_config_first=True, raises=None):
def test_read_config(self, label):

credentials = utils.load_config_file('example.jwt.json')
if write_config_first:
self.client.auth.gcp.configure(
credentials=credentials,
mount_point=self.TEST_MOUNT_POINT,
)
if raises is not None:
with self.assertRaises(raises):
self.client.auth.gcp.read_config(
mount_point=self.TEST_MOUNT_POINT,
)
else:
read_config_response = self.client.auth.gcp.read_config(
mount_point=self.TEST_MOUNT_POINT,
)
logging.debug('read_config_response: %s' % read_config_response)
self.client.auth.gcp.configure(
credentials=credentials,
mount_point=self.TEST_MOUNT_POINT,
)
read_config_response = self.client.auth.gcp.read_config(
mount_point=self.TEST_MOUNT_POINT,
)
logging.debug('read_config_response: %s' % read_config_response)

creds_dict = json.loads(credentials)
expected_config = {
'project_id': creds_dict['project_id'],
'client_email': creds_dict['client_email'],
'private_key_id': creds_dict['private_key_id'],
}
for k, v in expected_config.items():
self.assertEqual(
first=v,
second=read_config_response[k],
)
creds_dict = json.loads(credentials)
expected_config = {
'project_id': creds_dict['project_id'],
'client_email': creds_dict['client_email'],
'private_key_id': creds_dict['private_key_id'],
}
for k, v in expected_config.items():
self.assertEqual(
first=v,
second=read_config_response[k],
)

@parameterized.expand([
# param(
Expand Down
7 changes: 1 addition & 6 deletions tests/scripts/install-vault.sh
@@ -1,7 +1,7 @@
#!/bin/bash
set -eux

DEFAULT_VAULT_VERSION="1.3.4"
DEFAULT_VAULT_VERSION="1.5.0"
DEFAULT_VAULT_LICENSE="oss"
DEFAULT_VAULT_DIRECTORY="${HOME}/bin"
HVAC_VAULT_VERSION="${1:-$DEFAULT_VAULT_VERSION}"
Expand Down Expand Up @@ -49,11 +49,6 @@ function install_vault_release() {

if [[ "${HVAC_VAULT_LICENSE}" == "enterprise" ]]; then
download_url="https://releases.hashicorp.com/vault/${HVAC_VAULT_VERSION}+ent/vault_${HVAC_VAULT_VERSION}+ent_${machine}_amd64.zip"
if ! curl --head "${download_url}" | head -1 | grep '\b200\b'; then
# Vault enterprise binaries earlier than v1.2.3 have different release downlaod URLs, so we
# fallback to this S3 URL in such cases.
download_url="https://s3-us-west-2.amazonaws.com/hc-enterprise-binaries/vault/ent/${HVAC_VAULT_VERSION}/vault-enterprise_${HVAC_VAULT_VERSION}%2Bent_${machine}_amd64.zip"
fi
else
download_url="https://releases.hashicorp.com/vault/${HVAC_VAULT_VERSION}/vault_${HVAC_VAULT_VERSION}_${machine}_amd64.zip"
fi
Expand Down
9 changes: 7 additions & 2 deletions tests/utils/server_manager.py
Expand Up @@ -132,10 +132,15 @@ def stop(self):
if process.poll() is None:
process.kill()
if os.getenv('HVAC_OUTPUT_VAULT_STDERR', False):
_, stderr_lines = process.communicate()
stdout_lines, stderr_lines = process.communicate()
stderr_filename = 'vault{num}_stderr.log'.format(num=process_num)
with open(get_config_file_path(stderr_filename), 'w') as f:
f.writelines(stderr_lines)
logger.debug(stderr_lines.decode())
f.writelines(stderr_lines.decode())
stdout_filename = 'vault{num}_stdout.log'.format(num=process_num)
with open(get_config_file_path(stdout_filename), 'w') as f:
logger.debug(stdout_lines.decode())
f.writelines(stdout_lines.decode())

def initialize(self):
"""Perform initialization of the vault server process and record the provided unseal keys and root token."""
Expand Down