Add functional testing

A test playbook has been created to validate basic functionality of
barbican.

The api-paste template has been updated to use keystone auth_token by
default.

Change-Id: Ib542f5a0112b504e70d8bab6b49e9c6f5367f9e7
This commit is contained in:
Jimmy McCrory 2016-05-07 22:53:11 -07:00
parent 8e3b27a95e
commit e957326fc3
4 changed files with 67 additions and 6 deletions

View File

@ -1,7 +1,7 @@
[composite:main]
use = egg:Paste#urlmap
/: barbican_version
/v1: barbican_api
/v1: barbican-api-keystone
# Use this pipeline for Barbican API - versions no authentication
[pipeline:barbican_version]
@ -46,10 +46,10 @@ audit_map_file = /etc/barbican/api_audit_map.conf
[filter:keystone_authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
#need ability to re-auth a token, thus admin url
identity_uri = http://localhost:35357
admin_tenant_name = service
admin_user = barbican
admin_password = orange
identity_uri = {{ keystone_service_adminuri }}
admin_tenant_name = {{ barbican_service_project_name }}
admin_user = {{ barbican_service_user_name }}
admin_password = {{ barbican_service_password }}
auth_version = v3.0
#delay failing perhaps to log the unauthorized request in barbican ..
#delay_auth_decision = true

View File

@ -0,0 +1,55 @@
---
# Copyright 2016, 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: Playbook for functional testing of barbican
hosts: barbican_api
user: root
roles:
- openstack_openrc
post_tasks:
# Packages need to be installed outside
# of venv to be usable by Ansible
- name: Install testing pip packages
pip:
name: "{{ item }}"
state: present
with_items:
- httplib2
- python-barbicanclient
- python-openstackclient
- name: Check the barbican api
uri:
url: "http://localhost:9311"
status_code: 200,300
- name: Create a test secret
shell: |
. /root/openrc
openstack secret store --payload secrete --payload-content-type text/plain
register: barbican_secret_store
- name: Register secret location
set_fact:
secret_ref: "{{ item.split('|')[2] }}"
with_items: barbican_secret_store.stdout_lines
when: item.find('Secret href') != -1
- name: Retrieve test secret
shell: |
. /root/openrc
openstack secret get --decrypt --payload_content_type text/plain {{ secret_ref }}
register: barbican_secret_store
- name: Check retrieved secret
assert:
that: barbican_secret_store.stdout.find('secrete') != -1
vars_files:
- test-vars.yml

View File

@ -41,10 +41,13 @@ barbican_rabbitmq_vhost: /barbican
barbican_requirements_git_install_branch: master
barbican_service_password: secrete
barbican_venv_tag: testing
openrc_os_auth_url: "http://127.0.0.1:5000/v3"
openrc_os_auth_url: "{{ keystone_service_internalurl }}"
openrc_os_domain_name: Default
openrc_os_password: "{{ keystone_auth_admin_password }}"
rabbitmq_port: 5671
rabbitmq_servers: 10.100.100.2
rabbitmq_use_ssl: true
verbose: true
barbican_service_publicurl: "http://10.100.100.4:9311"
barbican_service_internalurl: "{{ barbican_service_publicurl }}"
barbican_service_adminurl: "{{ barbican_service_publicurl }}"

View File

@ -30,3 +30,6 @@
# Install Barbican
- include: test-install-barbican.yml
# Test Barbican
- include: test-barbican-functional.yml