Add basic functional testing for swift3
This commit adds the following swift3 functional testing: 1. Install and configure `s3cmd` utility 2. Verify bucket creation 3. Verify object upload 4. Verify object listing 5. Verify object and bucket deletion Change-Id: I6290e8b02004f6c518983700a6439d28fbd127a4 Co-Authored-By: Jean-Philippe Evrard <jean-philippe@evrard.me>
This commit is contained in:
parent
7ab62ddbea
commit
ea0d7bdb3e
7
tests/s3cfg.j2
Normal file
7
tests/s3cfg.j2
Normal file
@ -0,0 +1,7 @@
|
||||
[default]
|
||||
access_key = "{{ ec2_access_key }}"
|
||||
host_base = "{{ ansible_host }}:8080"
|
||||
host_bucket = "{{ ansible_host }}:8080"
|
||||
secret_key = "{{ ec2_secret_key }}"
|
||||
signature_v2 = True
|
||||
use_https = False
|
91
tests/test-swift3-functional.yml
Normal file
91
tests/test-swift3-functional.yml
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Run functional tests for swift3 middleware
|
||||
hosts: swift_proxy[0]
|
||||
user: root
|
||||
gather_facts: true
|
||||
vars_files:
|
||||
- common/test-vars.yml
|
||||
tasks:
|
||||
- name: Install prerequisite python packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
virtualenv: "{{ swift_venv_bin | dirname }}"
|
||||
extra_args: >-
|
||||
{{ swift_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
with_items:
|
||||
- s3cmd
|
||||
- python-openstackclient
|
||||
|
||||
- name: Generate EC2 credentials
|
||||
shell: |
|
||||
. ~/openrc
|
||||
. {{ swift_venv_bin }}/activate
|
||||
openstack ec2 credentials create > /tmp/ec2_credentials.txt
|
||||
args:
|
||||
creates: /tmp/ec2_credentials.txt
|
||||
|
||||
- name: Extract EC2 access key
|
||||
shell: awk '/access/ { print $4 }' /tmp/ec2_credentials.txt
|
||||
changed_when: False
|
||||
register: ec2_access_key
|
||||
|
||||
- name: Extract EC2 secret
|
||||
shell: awk '/secret/ { print $4 }' /tmp/ec2_credentials.txt
|
||||
changed_when: False
|
||||
register: ec2_secret_key
|
||||
|
||||
- name: Set facts for .s3cfg template
|
||||
set_fact:
|
||||
ec2_access_key: "{{ ec2_access_key.stdout }}"
|
||||
ec2_secret_key: "{{ ec2_secret_key.stdout }}"
|
||||
|
||||
- name: Generate .s3cfg
|
||||
template:
|
||||
src: s3cfg.j2
|
||||
dest: /root/.s3cfg
|
||||
|
||||
- name: Verify we can create a bucket
|
||||
shell: |
|
||||
. {{ swift_venv_bin }}/activate
|
||||
s3cmd mb s3://swift3-test
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Verify we can put an object
|
||||
shell: |
|
||||
. {{ swift_venv_bin }}/activate
|
||||
s3cmd put /root/openrc s3://swift3-test
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Verify we can list the object
|
||||
shell: |
|
||||
. {{ swift_venv_bin }}/activate
|
||||
s3cmd la | grep openrc
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Verify we can remove buckets and objects
|
||||
shell: |
|
||||
. {{ swift_venv_bin }}/activate
|
||||
s3cmd -r rb s3://swift3-test
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
12
tox.ini
12
tox.ini
@ -127,6 +127,18 @@ commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:func_swift3]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_PARAMETERS=-vvv -e swift_swift3_enabled=True
|
||||
TEST_PLAYBOOK={toxinidir}/tests/test.yml {toxinidir}/tests/test-swift-functional.yml {toxinidir}/tests/test-swift3-functional.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:multi_reg]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
|
@ -33,3 +33,10 @@
|
||||
vars:
|
||||
tox_env: func_pypy
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-swift3-ubuntu-xenial-nv
|
||||
parent: openstack-ansible-functional-ubuntu-xenial
|
||||
voting: false
|
||||
vars:
|
||||
tox_env: func_swift3
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
- openstack-ansible-multireg-ubuntu-xenial
|
||||
- openstack-ansible-multireg-centos-7-nv
|
||||
- openstack-ansible-pypy-ubuntu-xenial-nv
|
||||
- openstack-ansible-swift3-ubuntu-xenial-nv
|
||||
experimental:
|
||||
jobs:
|
||||
- openstack-ansible-integrated-deploy-aio
|
||||
|
Loading…
Reference in New Issue
Block a user