Fixes Lint errors and improve tests

* adds skip_ansible_lint where necessary
* moves tests to openstack client

Change-Id: Ib0d0250be713c547f87007cc84ea373978220505
This commit is contained in:
German Eichberger 2018-02-13 14:19:33 -08:00
parent e4d5cd0da7
commit 1c1f769adc
3 changed files with 63 additions and 59 deletions

View File

@ -17,8 +17,11 @@
## disbale the tests which spin up an amphora
test_octavia_amphora: False
test_octavia_api_group: "{{ ((groups['octavia_api'] is defined) and (groups['octavia_api'] | length > 0)) | ternary('octavia_api', 'all_containers') }}"
test_octavia_api_host: "{{ hostvars[groups[test_octavia_api_group][0]]['ansible_host'] }}"
# Test Octavia standalone
octavia_v2: True
octavia_v1: False
test_octavia_api_host: "{{ hostvars['octavia1']['ansible_host'] }}"
## octavia User / Group
octavia_system_user_name: octavia
@ -31,8 +34,10 @@ octavia_system_home_folder: "/var/lib/{{ octavia_system_user_name }}"
octavia_venv_tag: "testing"
octavia_developer_mode: True
octavia_git_install_branch: master
octavia_service_internaluri: "http://{{ test_octavia_api_host }}:9876"
octavia_service_internalurl: "{{ octavia_service_internaluri }}"
octavia_service_internalurl_v2: "http://{{ test_octavia_api_host }}:9876"
octavia_service_adminurl_v2: "{{ octavia_service_internalurl_v2 }}"
octavia_service_publicurl_v2: "{{ octavia_service_internalurl_v2 }}"
octavia_service_password: "secrete"
octavia_service_name: octavia
octavia_service_project_name: "service"
@ -92,41 +97,3 @@ octavia_ssh_enabled: True
octavia_amphora_driver: "{% if test_octavia_amphora | bool %}amphora_haproxy_rest_driver{% else %}amphora_noop_driver{% endif %}"
octavia_compute_driver: "{% if test_octavia_amphora | bool %}compute_nova_driver{% else %}compute_noop_driver{% endif %}"
octavia_network_driver: "{% if test_octavia_amphora | bool %}allowed_address_pairs_driver{% else %}network_noop_driver{% endif %}"
#Neutron mappings
neutron_plugin_base:
- router
- metering
- neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
neutron_lbaasv2_service_provider: LOADBALANCERV2:Octavia:neutron_lbaas.drivers.octavia.driver.OctaviaDriver:default
neutron_rpc_conn_pool_size: |
30
[octavia]
base_url= http://{{ hostvars['octavia1']['ansible_host'] }}:9876
request_poll_timeout = 500
# if we have Barbican
[certificates]
# Certificate Manager plugin. Defaults to barbican. (string value)
cert_manager_type = barbican
# Name of the Barbican authentication method to use (string value)
#barbican_auth = barbican_acl_auth
[service_auth]
insecure = {{ keystone_service_internaluri_insecure | bool }}
auth_plugin = password
# this needs to have a v3 added manually :-(
auth_url = "http://{{ test_keystone_host }}:5000/v3"
admin_project_domain = default
admin_user_domain = default
admin_tenant_name = service
admin_user = neutron
admin_password = secrete
region = RegionOne
endpoint_type = internalURL
service_name = neutron
auth_version = 3

View File

@ -51,6 +51,8 @@
repo: "https://git.openstack.org/openstack/octavia"
dest: "{{ octavia_system_home_folder }}/octavia"
version: "{{ octavia_git_install_branch }}"
tags:
- skip_ansible_lint
- name: Clone Diskimage-Builder
git:
repo: "https://git.openstack.org/openstack/diskimage-builder"

View File

@ -30,6 +30,8 @@
OS_USER_DOMAIN_NAME: Default
OS_PROJECT_DOMAIN_NAME: Default
OS_REGION_NAME: RegionOne
OS_IDENTITY_API_VERSION: 3
OS_AUTH_VERSION: 3
tasks:
- name: Install pip requirements
pip:
@ -43,6 +45,8 @@
- "python-neutronclient"
- "python-glanceclient"
- "shade"
- "python-octaviaclient"
- "python-openstackclient"
- name: Ensure public network exists
os_network:
@ -108,38 +112,69 @@
- name: Create a loadbalancer
shell: >
neutron lbaas-loadbalancer-create --name test-lb public-subnet
openstack --debug loadbalancer create --name test-lb --vip-subnet-id public-subnet
environment: "{{ env }}"
tags:
- skip_ansible_lint
- name: Wait until LB is up
- name: Wait until LB is active
shell: >
neutron lbaas-loadbalancer-show test-lb | grep ONLINE
openstack loadbalancer show test-lb -c provisioning_status -f value
environment: "{{ env }}"
register: lb_up
until: lb_up|success
retries: 100
delay: 5
register: lb_active
until: lb_active.stdout == "ACTIVE"
retries: 50
delay: 10
tags:
- skip_ansible_lint
- name: Create a listener
shell: >
neutron lbaas-listener-create --loadbalancer test-lb --protocol HTTP --protocol-port 80 --name listener
openstack loadbalancer listener create --protocol HTTP --protocol-port 80 --name listener test-lb
environment: "{{ env }}"
tags:
- skip_ansible_lint
- name: Curl the Listener
- name: Wait until Listener is active
shell: >
curl -s -o /dev/null -w "%{http_code}" http://`neutron lbaas-loadbalancer-show test-lb | awk '/ vip_address / {print $4}'`
openstack loadbalancer show test-lb -c provisioning_status -f value
environment: "{{ env }}"
register: http_status_code
when: test_octavia_amphora | bool
register: lb_active
until: lb_active.stdout == "ACTIVE"
retries: 10
delay: 10
tags:
- skip_ansible_lint
- name: Run Show (for debugging)
shell: >
openstack loadbalancer show test-lb
environment: "{{ env }}"
when:
- debug|bool == true
tags:
- skip_ansible_lint
- name: Register VIP IP # this is likley changing with a newer version of octaviaclient
shell: >
openstack loadbalancer show test-lb -c vip_address -f value
environment: "{{ env }}"
register: vip_output
tags:
- skip_ansible_lint
- name: Set VIP fact
set_fact:
vip: "{{ vip_output.stdout }}"
- name: Test the Listener
uri:
url: "http://{{ vip }}"
status_code: 503
when: test_octavia_amphora|bool == true
- name: Delete LoadBalancer
shell: >
openstack loadbalancer delete --cascade test-lb
environment: "{{ env }}"
register: lb_deleted
until: lb_deleted|success
retries: 10
delay: 15
tags:
- skip_ansible_lint
- name: Check that we got 503
assert:
that:
- "'503' in http_status_code.stdout"
when: test_octavia_amphora | bool
vars_files:
- common/test-vars.yml