2015-12-20 05:26:09 +00:00
|
|
|
import time
|
|
|
|
import pytest
|
|
|
|
import rostest.util as u
|
|
|
|
from rostest.util import SSH
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def qemu(request):
|
|
|
|
q = u.run_qemu(request, run_args=['--append', 'rancher.state.dev=x'])
|
|
|
|
u.flush_out(q.stdout)
|
|
|
|
return q
|
|
|
|
|
|
|
|
|
|
|
|
def test_oem(qemu):
|
2016-04-01 01:56:18 +00:00
|
|
|
try:
|
|
|
|
SSH(qemu).check_call('''
|
2015-12-20 05:26:09 +00:00
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
sudo mkfs.ext4 -L RANCHER_OEM /dev/vda
|
|
|
|
sudo mount /dev/vda /mnt
|
2016-04-01 01:56:18 +00:00
|
|
|
cat > /tmp/oem-config.yml << EOF
|
2015-12-20 05:26:09 +00:00
|
|
|
#cloud-config
|
|
|
|
rancher:
|
|
|
|
upgrade:
|
|
|
|
url: 'foo'
|
|
|
|
EOF
|
|
|
|
sudo cp /tmp/oem-config.yml /mnt
|
|
|
|
sudo umount /mnt
|
2016-04-01 01:56:18 +00:00
|
|
|
sudo reboot
|
|
|
|
'''.strip())
|
|
|
|
except:
|
|
|
|
pass
|
2015-12-20 05:26:09 +00:00
|
|
|
|
2016-04-01 01:56:18 +00:00
|
|
|
time.sleep(3)
|
2015-12-20 05:26:09 +00:00
|
|
|
|
2016-04-01 01:56:18 +00:00
|
|
|
SSH(qemu).check_call('''
|
2015-12-20 05:26:09 +00:00
|
|
|
set -x
|
|
|
|
if [ ! -e /usr/share/ros/oem/oem-config.yml ]; then
|
|
|
|
echo Failed to find /usr/share/ros/oem/oem-config.yml
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
FOO="$(sudo ros config get rancher.upgrade.url)"
|
|
|
|
if [ "$FOO" != "foo" ]; then
|
|
|
|
echo rancher.upgrade.url is not foo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'''.strip())
|