1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-05 09:44:59 +01:00

Use secondary disks for storage integration tests

Due to a couple of bugs related to loopback and sfdisk, we should
be using available secondary disks for testing atomic storage.  This
is part of the destructive testing we now do.

Also, configured vagrant to dispatch two disks so the tests can be done
there too.

Closes: #851
Approved by: baude
This commit is contained in:
Brent Baude
2017-01-26 15:50:23 -06:00
committed by Atomic Bot
parent de9011983a
commit 860f34fa71
4 changed files with 21 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ host:
distro: centos/7/atomic/continuous
specs:
secondary-disk: 10
secondary-disk: 10
context: centos/7/atomic

View File

@@ -7,6 +7,7 @@ from . import util
from .Export import export_docker
from .Import import import_docker
from .util import NoDockerDaemon, default_docker_lib
import subprocess
try:
from subprocess import DEVNULL # pylint: disable=no-name-in-module
@@ -168,7 +169,11 @@ class Storage(Atomic):
self._vgroup(self.args.vgroup)
if len(self.args.devices) > 0:
self._add_device(self.args.devices)
if util.call(["docker-storage-setup"]) != 0:
try:
util.check_output(["docker-storage-setup"], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
util.write_out("Return Code: {}".format(e.returncode))
util.write_out("Failure: {}".format(e.output))
os.rename(self.dss_conf_bak, self.dss_conf)
util.call(["docker-storage-setup"])
raise ValueError("docker-storage-setup failed")

2
Vagrantfile vendored
View File

@@ -9,6 +9,8 @@ Vagrant.configure(2) do |config|
config.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 2048
libvirt.cpus = 3
libvirt.storage :file,
:type => 'qcow2'
end
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/home/vagrant/atomic", type: "rsync",

View File

@@ -29,9 +29,16 @@ smarter_copy() {
setup () {
# Perform setup routines here.
smarter_copy /etc/sysconfig/docker-storage-setup /etc/sysconfig/docker-storage-setup.atomic-tests-backup
dd if=/dev/zero of=${WORK_DIR}/img-1 bs=1M count=10
TEST_DEV_1=$(losetup --show -f -P ${WORK_DIR}/img-1)
TEST_DEV_1_pvs=${TEST_DEV_1}p1
TEST_DEV_1=/dev/vdb
mount
#MNT=$(mount | grep vdb | awk '{print $3}')
MNT=$(mount | awk '$1 ~/vdb/' | awk '{print $3}')
if [ ${MNT} ]; then
umount $MNT
fi
wipefs -a "$TEST_DEV_1"
fdisk -l
TEST_DEV_1_pvs=${TEST_DEV_1}1
ROOT_DEV=$( awk '$2 ~ /^\/$/ && $1 !~ /rootfs/ { print $1 }' /proc/mounts )
VGROUP=$(lvs --noheadings -o vg_name ${ROOT_DEV} || true)
@@ -40,13 +47,12 @@ setup () {
teardown () {
# Cleanup your test data.
set -e
[ -n "$VGROUP" ] && (vgreduce $VGROUP "$TEST_DEV_1_pvs" || true)
losetup -d "$TEST_DEV_1"
wipefs -a "$TEST_DEV_1"
smarter_copy /etc/sysconfig/docker-storage-setup.atomic-tests-backup /etc/sysconfig/docker-storage-setup
}
trap teardown EXIT
setup
trap teardown EXIT
# Running without /e/s/d-s-s should fail.