mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-01-06 14:03:07 -06:00
Corrections to two test testing tool (#1276)
Ensure the two disk test tool is used to ensure any tweaks to the format made to the script are exercised.
This commit is contained in:
parent
4edb9a6831
commit
9d70d261b4
4
.github/workflows/integration-tests.yml
vendored
4
.github/workflows/integration-tests.yml
vendored
@ -90,6 +90,8 @@ jobs:
|
||||
- name: Run tests
|
||||
run: |
|
||||
mkdir -p $HOME/.vagrant.d/
|
||||
# use export with full path to avoid needing to resolve ~
|
||||
export VAGRANT_HOME=$HOME/.vagrant.d
|
||||
# use software emulation due to lack of nested emulation
|
||||
cat <<EOF > $HOME/.vagrant.d/Vagrantfile
|
||||
Vagrant.configure("2") do |config|
|
||||
@ -100,5 +102,3 @@ jobs:
|
||||
EOF
|
||||
# run under libvirt group
|
||||
sg libvirt -c "bats -f '${{ matrix.test_name }}' ./tests/runtests.bats"
|
||||
env:
|
||||
VAGRANT_HOME: ~/.vagrant.d
|
||||
|
@ -20,7 +20,10 @@ setup_file() {
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
[ -n "${TEMPDIR:-}" ] && [ -d "${TEMPDIR:-}" ] && rm -rf ${TEMPDIR}
|
||||
if [ -n "${TEMPDIR:-}" ] && [ -d "${TEMPDIR:-}" ]
|
||||
then
|
||||
rm -rf ${TEMPDIR:-}
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
@ -81,6 +84,7 @@ cleanup() {
|
||||
@test "bring up with two disks" {
|
||||
export VAGRANT_CWD=tests/two_disks
|
||||
cleanup
|
||||
tools/create_box_with_two_disks.sh ${VAGRANT_HOME} ${VAGRANT_CMD}
|
||||
run ${VAGRANT_CMD} up ${VAGRANT_OPT}
|
||||
echo "${output}"
|
||||
echo "status = ${status}"
|
||||
|
2
tests/two_disks/Vagrantfile
vendored
2
tests/two_disks/Vagrantfile
vendored
@ -2,7 +2,7 @@
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "yamatoRT/tinycore-two-disks"
|
||||
config.vm.box = "infernix/tinycore-two-disks"
|
||||
config.vm.box_version = "0.0.2"
|
||||
config.ssh.shell = "/bin/sh"
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
@ -1,3 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
VAGRANT_HOME=${1:-$HOME/.vagrant.d/}
|
||||
VAGRANT_CMD=${2:-vagrant}
|
||||
@ -6,22 +9,24 @@ echo 'Create box with two disks'
|
||||
${VAGRANT_CMD} box list
|
||||
if [ "$(${VAGRANT_CMD} box list | grep -c -E '^infernix/tinycore-two-disks\s')" -eq 0 ]
|
||||
then
|
||||
${VAGRANT_CMD} box list
|
||||
if [ "$(${VAGRANT_CMD} box list | grep -c -E '^infernix/tinycore\s')" -eq 0 ]
|
||||
then
|
||||
${VAGRANT_CMD} box add infernix/tinycore
|
||||
fi
|
||||
NEW_PATH="${VAGRANT_HOME}/boxes/infernix-VAGRANTSLASH-tinycore-two-disks"
|
||||
cp -r "${VAGRANT_HOME}/boxes/infernix-VAGRANTSLASH-tinycore" "${NEW_PATH}"
|
||||
BOX_VERSION="$(${VAGRANT_CMD} box list --machine-readable | grep -A 10 infernix/tinycore-two-disks | grep box-version | cut -d, -f4)"
|
||||
BOX_VERSION="$(${VAGRANT_CMD} box list --machine-readable | grep -A 10 infernix/tinycore-two-disks | grep box-version | head -n 1 | cut -d, -f4)"
|
||||
qemu-img create -f qcow2 "${NEW_PATH}/${BOX_VERSION}/libvirt/disk2.qcow2" 10G
|
||||
cat > "${NEW_PATH}/${BOX_VERSION}/libvirt/metadata.json" <<EOF
|
||||
{
|
||||
"provider": "libvirt",
|
||||
"disks" : [
|
||||
{
|
||||
"path": "box.img"
|
||||
},
|
||||
{
|
||||
"path":"disk2.qcow2",
|
||||
"path": "disk2.qcow2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user