move to running tests in lxd rather than docker
other work requires having systemd running
This commit is contained in:
parent
57c8160ffb
commit
f7a93e6d1b
20
.travis.yml
20
.travis.yml
|
@ -1,27 +1,11 @@
|
|||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
- IMAGE=ubuntu:xenial
|
||||
- IMAGE=ubuntu:artful
|
||||
- IMAGE=ubuntu:bionic
|
||||
- IMAGE=ubuntu-daily:bionic
|
||||
|
||||
language: bash
|
||||
|
||||
# Travis still doesn't support anything newer than trusty so we pull
|
||||
# docker tricks to run things on Xenial. Maybe we should run things on
|
||||
# bionic or whatever as well but this is a start...
|
||||
|
||||
before_install:
|
||||
- docker pull $IMAGE
|
||||
- cid=`docker run --tty --detach --workdir /subiquity -v $(pwd):/subiquity $IMAGE`
|
||||
- docker exec $cid apt-get update
|
||||
- docker exec $cid apt-get -y dist-upgrade
|
||||
- docker exec $cid apt-get install -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel curtin
|
||||
- docker exec $cid pip3 install -r requirements.txt
|
||||
- docker exec $cid python3 setup.py build
|
||||
script:
|
||||
- docker exec $cid python3 -m unittest discover
|
||||
- docker exec $cid timeout 60 sh -c 'LANG=C.UTF-8 PYTHONPATH=. python3 bin/subiquity-tui --dry-run --answers examples/answers.yaml --dry-run --machine-config examples/mwhudson.json'
|
||||
- sudo ./scripts/test-in-lxd.sh $IMAGE
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
apt-get update
|
||||
apt-get -y dist-upgrade
|
||||
apt-get install -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel curtin
|
||||
pip3 install -r requirements.txt
|
||||
python3 setup.py build
|
||||
|
||||
python3 -m unittest discover
|
||||
# The --foreground is important to avoid subiquity getting SIGTTOU-ed.
|
||||
timeout --foreground 60 sh -c 'LANG=C.UTF-8 PYTHONPATH=. python3 bin/subiquity-tui --answers examples/answers.yaml --dry-run --machine-config examples/mwhudson.json'
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
IMAGE=$1
|
||||
|
||||
apt-get -qq update
|
||||
apt -t trusty-backports install -y lxd
|
||||
|
||||
sed -i 's/LXD_IPV4_ADDR=".*"/LXD_IPV4_ADDR="192.168.123.1"/' /etc/default/lxd-bridge
|
||||
sed -i 's/LXD_IPV4_NETMASK=".*"/LXD_IPV4_NETMASK="255.255.255.0"/' /etc/default/lxd-bridge
|
||||
sed -i 's/LXD_IPV4_NETWORK=".*"/LXD_IPV4_NETWORK="192.168.123.0\/24"/' /etc/default/lxd-bridge
|
||||
sed -i 's/LXD_IPV4_DHCP_RANGE=".*"/LXD_IPV4_DHCP_RANGE="192.168.123.2,192.168.123.12"/' /etc/default/lxd-bridge
|
||||
sed -i 's/LXD_IPV4_DHCP_MAX=".*"/LXD_IPV4_DHCP_MAX="10"/' /etc/default/lxd-bridge
|
||||
sed -i 's/LXD_IPV6_PROXY=".*"/LXD_IPV6_PROXY="false"/' /etc/default/lxd-bridge
|
||||
|
||||
lxd init --auto
|
||||
service lxd restart
|
||||
|
||||
lxc launch $IMAGE tester -c security.privileged=true
|
||||
lxc config device add tester code disk source=`pwd` path=/subiquity
|
||||
|
||||
attempts=0
|
||||
while ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep -q ^nameserver; do
|
||||
sleep 1
|
||||
attempts=$((attempts+1))
|
||||
if [ $attempts -gt 30 ]; then
|
||||
lxc file pull tester/etc/resolv.conf
|
||||
lxc exec tester -- ps aux
|
||||
echo "Network failed to come up after 30 seconds"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep ^nameserver | grep -qv 127.0.0.53
|
||||
then
|
||||
echo "systemd-resolved"
|
||||
while ! lxc file pull tester/run/systemd/resolve/resolv.conf - 2> /dev/null | grep -v fe80 | grep -q ^nameserver; do
|
||||
sleep 1
|
||||
attempts=$((attempts+1))
|
||||
if [ $attempts -gt 30 ]; then
|
||||
echo "Network failed to come up after 30 seconds"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
lxc exec tester -- sh -c "cd /subiquity && ./scripts/runtests.sh"
|
Loading…
Reference in New Issue