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
|
||||
owner: root
|
||||
group: systemd-journal
|
||||
mode: "2755"
|
||||
mode: "02755"
|
||||
with_items:
|
||||
- /var/log/journal
|
||||
notify:
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
register: machines_create
|
||||
args:
|
||||
executable: /bin/bash
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
rescue:
|
||||
- name: Create volume file (fallback)
|
||||
shell: |
|
||||
|
@ -34,6 +36,8 @@
|
|||
register: machines_create
|
||||
args:
|
||||
executable: /bin/bash
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Systemd machinectl mount
|
||||
block:
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[all]
|
||||
localhost ansible_connection=local
|
||||
localhost ansible_connection=local physical_host=localhost
|
||||
|
|
|
@ -82,54 +82,69 @@
|
|||
|
||||
roles:
|
||||
- role: "nspawn_hosts"
|
||||
nspawn_net_address: 10.100.100.1
|
||||
nspawn_net_bridge: nspawnbr0
|
||||
nspawn_kernel_options:
|
||||
- { key: 'fs.inotify.max_user_instances', value: 1024 }
|
||||
nspawn_container_base_name: "test-container"
|
||||
nspawn_container_cache_files:
|
||||
- src: files/container-file-copy-test.txt
|
||||
dest: /tmp/file-copied-from-deployment-host.txt
|
||||
|
||||
post_tasks:
|
||||
- name: Get sysctl content
|
||||
set_fact:
|
||||
sysctl_conf: "{{ lookup('file', '/etc/sysctl.conf') }}"
|
||||
|
||||
- name: Check for nspawn bridge
|
||||
stat:
|
||||
path: /sys/class/net/nspawnbr0/bridge/bridge_id
|
||||
register: nspawn_bridge_file
|
||||
|
||||
- name: Check dnsmasq is running
|
||||
shell: ps auxfww | grep -w 'dnsmasq -u nspawn-dnsmasq'
|
||||
path: /sys/class/net/nspawn0/upper_mv-nspawn0
|
||||
changed_when: false
|
||||
|
||||
- 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
|
||||
register: nspawn_interface_file
|
||||
|
||||
- name: Check role functions
|
||||
assert:
|
||||
that:
|
||||
- interface_file | search('.*nspawnbr0.*')
|
||||
- interface_file | search('.*10.100.100.1.*')
|
||||
- interface_file | search('.*255.255.255.0.*')
|
||||
- sysctl_conf | search('fs.inotify.max_user_instances.*')
|
||||
- "nspawn_bridge_file.stat.exists"
|
||||
- "nspawnbr0_facts.ansible_facts.ansible_nspawnbr0.ipv4.address | match('10.100.100.1')"
|
||||
- "nspawn_interface_file.stat.exists"
|
||||
|
||||
- name: Check dnsmasq is running
|
||||
command: systemctl status dnsmasq-mv-nspawn0.service
|
||||
changed_when: false
|
||||
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:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
# - openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
experimental:
|
||||
jobs:
|
||||
- openstack-ansible-integrated-deploy-aio
|
||||
# - openstack-ansible-nspawn-centos-7
|
||||
# - openstack-ansible-nspawn-opensuse-423
|
||||
# - openstack-ansible-nspawn-ubuntu-xenial
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
# - openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
|
|
Loading…
Reference in New Issue