Fix functional tests
Functional tests have been broken by [1] as it has prescedence over host_vars which are defined for functional tests. [1] https://review.opendev.org/#/c/707943/ Change-Id: If687504ed08c34bd3336d31b1ae044b7d633318c
This commit is contained in:
parent
dfb0c6dafe
commit
377f8e389b
@ -3,11 +3,3 @@ ansible_host: 10.100.100.2
|
||||
ansible_become: True
|
||||
ansible_user: root
|
||||
container_name: container1
|
||||
lxc_container_config_list:
|
||||
- "{{ (hostvars[physical_host | default('localhost')]['ansible_distribution_version'] == '18.04') | ternary('lxc.apparmor.profile', 'lxc.aa_profile') }}=lxc-openstack"
|
||||
- "lxc.mount.entry=/openstack/{{ inventory_hostname }} opt/test1 none bind,create=dir 0 0"
|
||||
|
||||
lxc_container_commands: |
|
||||
if [[ ! -d "/opt/test1" ]]; then
|
||||
mkdir -p "/opt/test1"
|
||||
fi
|
||||
|
@ -3,7 +3,3 @@ ansible_host: 10.100.100.3
|
||||
ansible_become: True
|
||||
ansible_user: root
|
||||
container_name: container2
|
||||
lxc_container_config_list:
|
||||
# The unconfined profile is causing problems with overlayfs. See https://bugs.launchpad.net/openstack-ansible/+bug/1612412
|
||||
# Use the lxc2 aa_profile key to test that it is correctly changed in-flight to the required lxc3 key on bionic
|
||||
- "lxc.aa_profile={{ (lxc_container_backing_store == 'overlayfs') | ternary('lxc-openstack', 'unconfined') }}"
|
||||
|
@ -15,5 +15,3 @@
|
||||
|
||||
bridges:
|
||||
- "br-mgmt"
|
||||
|
||||
ansible_python_interpreter: "/usr/bin/python2"
|
||||
|
@ -32,33 +32,20 @@
|
||||
# container2 10.100.100.3, 172.16.12.4
|
||||
assert:
|
||||
that:
|
||||
- lxc_container_list.stdout | search("container1\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.2(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
- lxc_container_list.stdout | search("container2\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.3(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
- lxc_container_list.stdout | search("container3\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.4(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
- lxc_container_list.stdout is search("container1\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.2(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
- lxc_container_list.stdout is search("container2\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.3(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
- lxc_container_list.stdout is search("container3\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.4(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+")
|
||||
|
||||
- name: Check for the presence of the right app armor profile for container1
|
||||
command: grep "^{{ (hostvars[physical_host | default('localhost')]['ansible_distribution_version'] == '18.04') | ternary('lxc.apparmor.profile', 'lxc.aa_profile') }} = lxc-openstack$" /var/lib/lxc/container1/config
|
||||
command: "grep \"^{{ (hostvars[physical_host | default('localhost')]['ansible_os_family'] == 'Debian') | ternary('lxc.apparmor.profile', 'lxc.aa_profile') }} = {{ (hostvars[physical_host | default('localhost')]['ansible_distribution'] == 'Debian') | ternary('unconfined', 'lxc-openstack') }}$\" {{ item }}"
|
||||
register: container1_profile
|
||||
failed_when: container1_profile.rc != 0
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Check for the presence of the right app armor profile for container2
|
||||
command: "grep -E '^{{ (hostvars[physical_host | default('localhost')]['ansible_distribution_version'] == '18.04') | ternary('lxc.apparmor.profile', 'lxc.aa_profile') }} = {{ (lxc_container_backing_store == 'overlayfs') | ternary('lxc-openstack', 'unconfined') }}$' /var/lib/lxc/container2/config"
|
||||
register: container2_profile
|
||||
failed_when: container2_profile.rc != 0
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Check for the lack of presence of an aa_profile for container3
|
||||
command: grep "{{ (hostvars[physical_host | default('localhost')]['ansible_distribution_version'] == '18.04') | ternary('lxc.apparmor.profile', 'lxc.aa_profile') }}" /var/lib/lxc/container3/config
|
||||
register: container3_profile
|
||||
failed_when: container3_profile.rc == 0
|
||||
with_sequence: start=1 end=3 format=/var/lib/lxc/container%x/config
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Check for the presence of the right bound mount for container1
|
||||
command: grep "lxc.mount.entry = /openstack/container1 opt/test1 none bind,create=dir 0 0" /var/lib/lxc/container1/config
|
||||
command: grep "lxc.mount.entry = /openstack/log/container1" /var/lib/lxc/container1/config
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
@ -79,10 +66,11 @@
|
||||
hosts: container1
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: Check for the presence of /opt/test1
|
||||
command: ls -1 /opt/test1
|
||||
register: container1_test_dir
|
||||
failed_when: container1_test_dir.rc != 0
|
||||
- name: Check for the presence of /var/backup
|
||||
stat:
|
||||
path: /var/backup
|
||||
register: container1_backup_dir
|
||||
failed_when: container1_backup_dir.stat.isdir is not defined
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user