Add functional tests for our different backendstores
This change adds several tox functional sections to support our different backend storage options. This change will allow us to create jenkens jobs specific to the various backends to validate they work as we expect them to. Change-Id: Ic1152ae666973af8c01499bb5ca89d8eeaa5f1d2 Depends-On: I70d53cabd0888954f31def924e9f4436398cdebf Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
5877bf036a
commit
28c66bee59
@ -13,6 +13,4 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Not Implemented
|
||||
fail:
|
||||
msg: "BTRFS backed containers has not been implemented yet."
|
||||
- include: lxc_container_cow.yml
|
||||
|
16
tests/overrides-btrfs.yml
Normal file
16
tests/overrides-btrfs.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2015, 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.
|
||||
|
||||
lxc_container_backing_store: btrfs
|
16
tests/overrides-dir.yml
Normal file
16
tests/overrides-dir.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2015, 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.
|
||||
|
||||
lxc_container_backing_store: dir
|
16
tests/overrides-machinectl.yml
Normal file
16
tests/overrides-machinectl.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2015, 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.
|
||||
|
||||
lxc_container_backing_store: machinectl
|
16
tests/overrides-overlayfs.yml
Normal file
16
tests/overrides-overlayfs.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
# Copyright 2015, 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.
|
||||
|
||||
lxc_container_backing_store: overlayfs
|
19
tests/overrides-zfs.yml
Normal file
19
tests/overrides-zfs.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
# Copyright 2015, 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.
|
||||
|
||||
# At this time we're only testing ZFS on linux when the OS is Ubuntu.
|
||||
# If ZFS get support across more distros we can revist this.
|
||||
lxc_container_backing_store: zfs
|
||||
lxc_container_zfs_root_name: "pool/lxc"
|
60
tests/test-create-btrfs-dev.yml
Normal file
60
tests/test-create-btrfs-dev.yml
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
# Copyright 2017, BBC R&D
|
||||
#
|
||||
# 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.
|
||||
|
||||
- name: Configure BTRFS backing storage
|
||||
hosts: localhost
|
||||
user: root
|
||||
become: true
|
||||
connection: local
|
||||
tasks:
|
||||
- block:
|
||||
- name: Install BTRFS packages
|
||||
package:
|
||||
name: "{{ zfs_package[ansible_distribution | lower] }}"
|
||||
state: present
|
||||
|
||||
- name: Create base directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: "directory"
|
||||
with_items:
|
||||
- /openstack
|
||||
- /var/lib/lxc
|
||||
|
||||
- name: Create sparse lxc-btrfs file
|
||||
command: "truncate -s 1024G /openstack/lxc-btrfs.img"
|
||||
args:
|
||||
creates: /openstack/lxc-btrfs.img
|
||||
register: lxc_btrfs_create
|
||||
|
||||
- name: Format the lxc-btrfs file
|
||||
filesystem:
|
||||
fstype: btrfs
|
||||
dev: /openstack/lxc-btrfs.img
|
||||
when: lxc_btrfs_create | changed
|
||||
|
||||
- name: Create the mount points, fstab entries and mount the file systems
|
||||
mount:
|
||||
name: /var/lib/lxc
|
||||
src: /openstack/lxc-btrfs.img
|
||||
fstype: btrfs
|
||||
state: mounted
|
||||
when:
|
||||
- lxc_container_backing_store == 'btrfs'
|
||||
vars:
|
||||
btrfs_package:
|
||||
ubuntu: "btrfs-tools"
|
||||
redhat: "btrfs-progs"
|
||||
suse: "btrfsprogs"
|
53
tests/test-create-zfs-dev.yml
Normal file
53
tests/test-create-zfs-dev.yml
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
# Copyright 2017, BBC R&D
|
||||
#
|
||||
# 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.
|
||||
|
||||
- name: Configure ZFS backing storage
|
||||
hosts: localhost
|
||||
user: root
|
||||
become: true
|
||||
connection: local
|
||||
tasks:
|
||||
- block:
|
||||
- name: Install ZFS packages
|
||||
package:
|
||||
name: "{{ zfs_package[ansible_distribution | lower] }}"
|
||||
state: present
|
||||
|
||||
- name: Create base directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: "directory"
|
||||
with_items:
|
||||
- /openstack
|
||||
- /var/lib/lxc
|
||||
|
||||
- name: Create sparse ZFS backing file
|
||||
command: "truncate -s 1024G /openstack/lxc-zfs.img"
|
||||
args:
|
||||
creates: /openstack/lxc-zfs.img
|
||||
register: lxc_zfs_create
|
||||
|
||||
- name: Create the ZFS pool
|
||||
command: zpool create pool /openstack/lxc-zfs.img
|
||||
args:
|
||||
creates: /pool
|
||||
|
||||
- name: Create the ZFS pool/lxc volume
|
||||
shell: "(zfs list | grep lxc) || zfs create -o mountpoint=/var/lib/lxc pool/lxc"
|
||||
when:
|
||||
- lxc_container_backing_store == 'zfs'
|
||||
vars:
|
||||
zfs_package:
|
||||
ubuntu: "zfsutils-linux"
|
@ -13,6 +13,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Create a zfs backend
|
||||
- include: test-create-zfs-dev.yml
|
||||
|
||||
# Create a btrfs backend
|
||||
- include: test-create-btrfs-dev.yml
|
||||
|
||||
# Setup the host
|
||||
- include: common/test-setup-host.yml
|
||||
|
||||
|
63
tox.ini
63
tox.ini
@ -95,14 +95,75 @@ commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
# Functional testing for BTRFS backed containers
|
||||
[testenv:btrfs]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/overrides-btrfs.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
# Functional testing for Directory backed containers
|
||||
[testenv:dir]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/overrides-dir.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
# Functional testing for machinectl backed containers
|
||||
[testenv:mnctl]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/overrides-machinectl.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
# Functional testing for OverlayFS backed containers
|
||||
[testenv:ofs]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/overrides-overlayfs.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
# Functional testing for ZFS backed containers
|
||||
[testenv:zfs]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/overrides-zfs.yml
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
deps =
|
||||
{[testenv:dir]deps}
|
||||
setenv =
|
||||
{[testenv:dir]setenv}
|
||||
commands =
|
||||
{[testenv:dir]commands}
|
||||
|
||||
|
||||
[testenv:linters]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
|
Loading…
Reference in New Issue
Block a user