add minimal functional tests
Change-Id: Ie76759e6c162270fd3e767d4719b885b57a7539b Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
46401ea520
commit
942531a8d8
|
@ -92,7 +92,7 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: systemd-journal
|
group: systemd-journal
|
||||||
mode: "2755"
|
mode: "02755"
|
||||||
with_items:
|
with_items:
|
||||||
- /var/log/journal
|
- /var/log/journal
|
||||||
notify:
|
notify:
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
register: machines_create
|
register: machines_create
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
rescue:
|
rescue:
|
||||||
- name: Create volume file (fallback)
|
- name: Create volume file (fallback)
|
||||||
shell: |
|
shell: |
|
||||||
|
@ -34,6 +36,8 @@
|
||||||
register: machines_create
|
register: machines_create
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: Systemd machinectl mount
|
- name: Systemd machinectl mount
|
||||||
block:
|
block:
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
[all]
|
[all]
|
||||||
localhost ansible_connection=local
|
localhost ansible_connection=local physical_host=localhost
|
||||||
|
|
|
@ -82,54 +82,69 @@
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: "nspawn_hosts"
|
- role: "nspawn_hosts"
|
||||||
nspawn_net_address: 10.100.100.1
|
nspawn_container_base_name: "test-container"
|
||||||
nspawn_net_bridge: nspawnbr0
|
|
||||||
nspawn_kernel_options:
|
|
||||||
- { key: 'fs.inotify.max_user_instances', value: 1024 }
|
|
||||||
nspawn_container_cache_files:
|
nspawn_container_cache_files:
|
||||||
- src: files/container-file-copy-test.txt
|
- src: files/container-file-copy-test.txt
|
||||||
dest: /tmp/file-copied-from-deployment-host.txt
|
dest: /tmp/file-copied-from-deployment-host.txt
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Get sysctl content
|
|
||||||
set_fact:
|
|
||||||
sysctl_conf: "{{ lookup('file', '/etc/sysctl.conf') }}"
|
|
||||||
|
|
||||||
- name: Check for nspawn bridge
|
- name: Check for nspawn bridge
|
||||||
stat:
|
stat:
|
||||||
path: /sys/class/net/nspawnbr0/bridge/bridge_id
|
path: /sys/class/net/nspawn0/upper_mv-nspawn0
|
||||||
register: nspawn_bridge_file
|
|
||||||
|
|
||||||
- name: Check dnsmasq is running
|
|
||||||
shell: ps auxfww | grep -w 'dnsmasq -u nspawn-dnsmasq'
|
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
register: nspawn_interface_file
|
||||||
- name: DEBIAN - Get deployed interface file contents, without Ansible managed line
|
|
||||||
set_fact:
|
|
||||||
interface_file: "{{ lookup('pipe', 'cat /etc/network/interfaces.d/nspawn-net-bridge.cfg | tail -n +3') }}"
|
|
||||||
when: ansible_os_family | lower == "debian"
|
|
||||||
|
|
||||||
- name: RHEL - Get deployed interface file contents, without Ansible managed line
|
|
||||||
set_fact:
|
|
||||||
interface_file: "{{ lookup('pipe', 'cat /etc/sysconfig/network-scripts/ifcfg-nspawnbr0 | tail -n +3') }}"
|
|
||||||
when: ansible_os_family | lower == "redhat"
|
|
||||||
|
|
||||||
- name: SUSE - Get deployed interface file contents, without Ansible managed line
|
|
||||||
set_fact:
|
|
||||||
interface_file: "{{ lookup('pipe', 'cat /etc/sysconfig/network/ifcfg-nspawnbr0 | tail -n +3') }}"
|
|
||||||
when: ansible_os_family | lower == "suse"
|
|
||||||
|
|
||||||
- name: Get bridge interface facts
|
|
||||||
setup:
|
|
||||||
filter: ansible_nspawnbr0
|
|
||||||
register: nspawnbr0_facts
|
|
||||||
|
|
||||||
- name: Check role functions
|
- name: Check role functions
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- interface_file | search('.*nspawnbr0.*')
|
- "nspawn_interface_file.stat.exists"
|
||||||
- interface_file | search('.*10.100.100.1.*')
|
|
||||||
- interface_file | search('.*255.255.255.0.*')
|
- name: Check dnsmasq is running
|
||||||
- sysctl_conf | search('fs.inotify.max_user_instances.*')
|
command: systemctl status dnsmasq-mv-nspawn0.service
|
||||||
- "nspawn_bridge_file.stat.exists"
|
changed_when: false
|
||||||
- "nspawnbr0_facts.ansible_facts.ansible_nspawnbr0.ipv4.address | match('10.100.100.1')"
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- name: Check for machines mount
|
||||||
|
command: "systemctl status var-lib-machines.mount"
|
||||||
|
changed_when: false
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- name: Check dnsmasq is running
|
||||||
|
command: systemctl status dnsmasq-mv-nspawn0.service
|
||||||
|
changed_when: false
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- name: Check for valid BTRFS file system
|
||||||
|
command: "btrfs filesystem show /var/lib/machines"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Check for base container
|
||||||
|
command: "machinectl show-image test-container"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Ensure images can be cloned
|
||||||
|
command: "machinectl clone test-container test1"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Ensure images can be removed
|
||||||
|
command: "machinectl remove test1"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Ensure images can be marked read-only
|
||||||
|
command: "machinectl read-only test-container yes"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Ensure a read-only image is read-only
|
||||||
|
file:
|
||||||
|
path: /var/lib/machines/test-container/test-file
|
||||||
|
state: touch
|
||||||
|
failed_when:
|
||||||
|
- read_only_test | success
|
||||||
|
register: read_only_test
|
||||||
|
|
||||||
|
- name: Remove base image
|
||||||
|
command: "machinectl remove test-container"
|
||||||
|
changed_when: false
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: openstack-ansible-nspawn-container-create
|
||||||
|
parent: openstack-ansible-cross-repo-functional
|
||||||
|
required-projects:
|
||||||
|
- name: openstack/openstack-ansible-nspawn_container_create
|
||||||
|
vars:
|
||||||
|
osa_test_repo: "openstack/openstack-ansible-nspawn_container_create"
|
||||||
|
|
||||||
|
# - job:
|
||||||
|
# name: openstack-ansible-nspawn-ubuntu-xenial
|
||||||
|
# parent: openstack-ansible-nspawn-container-create
|
||||||
|
|
||||||
|
# - job:
|
||||||
|
# name: openstack-ansible-nspawn-centos-7
|
||||||
|
# parent: openstack-ansible-nspawn-container-create
|
||||||
|
# nodeset: centos-7
|
||||||
|
|
||||||
|
# - job:
|
||||||
|
# name: openstack-ansible-nspawn-opensuse-423
|
||||||
|
# parent: openstack-ansible-nspawn-container-create
|
||||||
|
# nodeset: opensuse-423
|
|
@ -17,12 +17,15 @@
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-ansible-linters
|
- openstack-ansible-linters
|
||||||
- openstack-ansible-functional-centos-7
|
- openstack-ansible-functional-centos-7
|
||||||
|
# - openstack-ansible-functional-opensuse-423
|
||||||
- openstack-ansible-functional-ubuntu-xenial
|
- openstack-ansible-functional-ubuntu-xenial
|
||||||
experimental:
|
# - openstack-ansible-nspawn-centos-7
|
||||||
jobs:
|
# - openstack-ansible-nspawn-opensuse-423
|
||||||
- openstack-ansible-integrated-deploy-aio
|
# - openstack-ansible-nspawn-ubuntu-xenial
|
||||||
|
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-ansible-linters
|
- openstack-ansible-linters
|
||||||
- openstack-ansible-functional-centos-7
|
- openstack-ansible-functional-centos-7
|
||||||
|
# - openstack-ansible-functional-opensuse-423
|
||||||
- openstack-ansible-functional-ubuntu-xenial
|
- openstack-ansible-functional-ubuntu-xenial
|
||||||
|
|
Loading…
Reference in New Issue