Add functional tests to CI
Change-Id: I74f74e57f8a908f57d6b63d381b7e3af3d08e711
This commit is contained in:
parent
e8ced3d13c
commit
47ce2f7136
|
@ -0,0 +1,41 @@
|
|||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- novajoin-functional:
|
||||
voting: false
|
||||
|
||||
- job:
|
||||
name: novajoin-functional
|
||||
description: |
|
||||
Run functional tests for novajoin.
|
||||
parent: devstack-tox-base
|
||||
nodeset: devstack-single-node-centos-7
|
||||
pre-run: playbooks/functional/pre.yaml
|
||||
run: playbooks/functional/run.yaml
|
||||
post-run: playbooks/functional/post.yaml
|
||||
vars:
|
||||
devstack_services:
|
||||
# FreeIPA is using Apache with TLS
|
||||
tls-proxy: false
|
||||
# Disable Swift services
|
||||
s-account: false
|
||||
s-container: false
|
||||
s-object: false
|
||||
s-proxy: false
|
||||
# Disable Cinder services
|
||||
c-api: false
|
||||
c-bak: false
|
||||
c-sch: false
|
||||
c-vol: false
|
||||
cinder: false
|
||||
group-vars:
|
||||
# This job runs single node, but for completeness:
|
||||
subnode:
|
||||
devstack_services:
|
||||
# FreeIPA is using Apache with TLS
|
||||
tls-proxy: false
|
||||
# Disable Swift services
|
||||
# s-*: false
|
||||
# Disable Cinder services
|
||||
c-bak: false
|
||||
c-vol: false
|
10
README.rst
10
README.rst
|
@ -38,10 +38,14 @@ Package Requirements
|
|||
Beyond those packages normally installed by Openstack, these are also
|
||||
required::
|
||||
|
||||
{free}ipa-python
|
||||
python-ipalib
|
||||
python-ipaclient
|
||||
|
||||
These may be pip-installable but as of March 2017 it has only been
|
||||
extensively tested with real packages installed on RHEL/CentOS/Fedora.
|
||||
These may be pip-installable but still require other system packages
|
||||
like `krb5-devel` to be present and may not be compatible with your
|
||||
FreeIPA installation, so it is best to install them with your system
|
||||
package manager. Functional tests are configured to run against
|
||||
system packages found on RHEL/CentOS/Fedora.
|
||||
|
||||
|
||||
Configuration
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# System distribution package dependencies
|
||||
# This is used by bindep: sudo [apt-get | yum] install $(bindep -b)
|
||||
|
||||
python-ipalib
|
||||
python-ipaclient
|
|
@ -0,0 +1,33 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
|
||||
- name: Make ipaserver-install log readable
|
||||
file:
|
||||
path: "/var/log/ipaserver-install.log"
|
||||
mode: 0644
|
||||
become: true
|
||||
failed_when: false
|
||||
|
||||
- name: Collect ipaserver-install logs
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}"
|
||||
mode: pull
|
||||
src: "/var/log/ipaserver-install.log"
|
||||
verify_host: true
|
||||
failed_when: false
|
||||
|
||||
- name: Collect novajoin-install logs
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}"
|
||||
mode: pull
|
||||
src: "/var/log/novajoin-install.log"
|
||||
verify_host: true
|
||||
failed_when: false
|
||||
|
||||
- name: Collect novajoin logs
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}"
|
||||
mode: pull
|
||||
src: "/var/log/novajoin"
|
||||
verify_host: true
|
||||
failed_when: false
|
|
@ -0,0 +1,27 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
|
||||
- name: Change hostname in /etc/hosts
|
||||
replace:
|
||||
path: /etc/hosts
|
||||
regexp: '{{ ansible_hostname }}'
|
||||
replace: '{{ ansible_hostname }}.example.test {{ ansible_hostname }}'
|
||||
become: true
|
||||
|
||||
- name: Remove 127.0.1.1 from /etc/hosts
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '127\.0\.1\.1'
|
||||
state: absent
|
||||
become: true
|
||||
|
||||
- name: Remove controller from /etc/hosts
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: 'controller'
|
||||
state: absent
|
||||
become: true
|
||||
|
||||
- name: Change hostname
|
||||
command: 'hostnamectl set-hostname {{ ansible_hostname }}.example.test'
|
||||
become: true
|
|
@ -0,0 +1,12 @@
|
|||
- hosts: all
|
||||
roles:
|
||||
- run-devstack
|
||||
- configure-freeipa
|
||||
- role: bindep
|
||||
bindep_profile: test
|
||||
bindep_dir: "{{ zuul_work_dir }}"
|
||||
- configure-novajoin
|
||||
- download-centos
|
||||
- test-setup
|
||||
- ensure-tox
|
||||
- tox
|
|
@ -0,0 +1,59 @@
|
|||
- name: Find Paramiko ssh_gss.py
|
||||
command: python -c "from paramiko import ssh_gss; print(ssh_gss.__file__.rstrip('c'))"
|
||||
register: ssh_gss_file
|
||||
|
||||
- name: Patch Paramiko (https://github.com/paramiko/paramiko/pull/1311)
|
||||
replace:
|
||||
path: '{{ ssh_gss_file.stdout }}'
|
||||
regexp: 'GSS_EXCEPTIONS = \(gssapi.GSSException,\)'
|
||||
replace: 'GSS_EXCEPTIONS = ()'
|
||||
become: true
|
||||
|
||||
- name: Patch Paramiko (https://github.com/paramiko/paramiko/pull/1311)
|
||||
replace:
|
||||
path: '{{ ssh_gss_file.stdout }}'
|
||||
regexp: 'GSS_AUTH_AVAILABLE = True'
|
||||
replace: 'GSS_AUTH_AVAILABLE = False'
|
||||
become: true
|
||||
|
||||
- name: Uninstall urllib3 to fix later conflict with python-urllib3 system package
|
||||
pip:
|
||||
name: urllib3
|
||||
state: absent
|
||||
become: true
|
||||
|
||||
- name: Install FreeIPA
|
||||
package:
|
||||
name: ipa-server-dns
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: check if mod_nss is installed
|
||||
package:
|
||||
name: mod_nss
|
||||
state: present
|
||||
check_mode: true
|
||||
ignore_errors: yes
|
||||
register: mod_nss_check
|
||||
|
||||
- name: Remove mod_ssl config which conflicts with FreeIPA
|
||||
file:
|
||||
path: /etc/httpd/conf.d/ssl.conf
|
||||
state: absent
|
||||
become: true
|
||||
when: not mod_nss_check.changed
|
||||
|
||||
- name: Stop unbound
|
||||
systemd:
|
||||
name: unbound
|
||||
state: stopped
|
||||
become: true
|
||||
|
||||
- name: Configure FreeIPA
|
||||
command: >
|
||||
ipa-server-install -U -r EXAMPLE.TEST
|
||||
-p password -a password --hostname {{ ansible_hostname }}.example.test
|
||||
--ip-address={{ ansible_default_ipv4.address }} --setup-dns --no-reverse
|
||||
--forwarder={{ unbound_primary_nameserver_v4 | default('1.1.1.1') }}
|
||||
--forwarder={{ unbound_secondary_nameserver_v4 | default('8.8.8.8') }}
|
||||
become: true
|
|
@ -0,0 +1,55 @@
|
|||
- name: Build novajoin
|
||||
command: python setup.py build
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
||||
|
||||
- name: Install novajoin
|
||||
command: python setup.py install
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
||||
become: true
|
||||
|
||||
- name: Configure novajoin
|
||||
shell: >
|
||||
source /opt/stack/devstack/openrc admin admin &&
|
||||
novajoin-install --debug --principal admin --password password
|
||||
--user stack --nova-password secretservice
|
||||
--keystone-auth-url http://127.0.0.1/identity
|
||||
args:
|
||||
executable: /bin/bash
|
||||
become: true
|
||||
|
||||
- name: Create novajoin log directory
|
||||
file:
|
||||
path: /var/log/novajoin
|
||||
state: directory
|
||||
owner: stack
|
||||
become: true
|
||||
|
||||
- name: Start novajoin-server
|
||||
shell: nohup novajoin-server --debug </dev/null >/dev/null 2>&1 &
|
||||
become: true
|
||||
become_user: stack
|
||||
|
||||
- name: Start novajoin-notify
|
||||
shell: nohup novajoin-notify --debug </dev/null >/dev/null 2>&1 &
|
||||
become: true
|
||||
become_user: stack
|
||||
|
||||
- name: Restart nova services
|
||||
command: systemctl restart devstack@n-*
|
||||
become: true
|
||||
|
||||
- name: Set FreeIPA DNS in demo private-subnet
|
||||
shell: >
|
||||
source /opt/stack/devstack/openrc demo demo &&
|
||||
openstack subnet set --no-dns-nameservers private-subnet &&
|
||||
openstack subnet set --dns-nameserver {{ ansible_default_ipv4.address }} private-subnet
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Chmod /etc/novajoin/krb5.keytab for use by tests
|
||||
file:
|
||||
path: /etc/novajoin/krb5.keytab
|
||||
mode: 0644
|
||||
become: true
|
|
@ -0,0 +1,16 @@
|
|||
- name: Download image
|
||||
get_url:
|
||||
url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz
|
||||
dest: /tmp/centos-image.qcow2.xz
|
||||
|
||||
- name: Extract image
|
||||
command: unxz /tmp/centos-image.qcow2.xz
|
||||
|
||||
- name: Add centos-image to Glance
|
||||
shell: >
|
||||
source /opt/stack/devstack/openrc admin admin &&
|
||||
openstack image create --disk-format qcow2 --container-format bare
|
||||
--public --file /tmp/centos-image.qcow2 centos-image
|
||||
args:
|
||||
executable: /bin/bash
|
||||
become: true
|
2
tox.ini
2
tox.ini
|
@ -69,7 +69,7 @@ envdir = {toxworkdir}/pep8
|
|||
commands = oslo-config-generator --config-file=files/novajoin-config-generator.conf
|
||||
|
||||
[testenv:functional]
|
||||
basepython = python3
|
||||
sitepackages = true
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
setenv =
|
||||
OS_TEST_PATH={toxinidir}/novajoin/tests/functional
|
||||
|
|
Loading…
Reference in New Issue