1
0
mirror of https://github.com/rancher/os.git synced 2025-08-19 07:19:05 +00:00

cleanup tests using SSH

This commit is contained in:
Ivan Mikushin 2016-03-31 18:56:18 -07:00
parent 2dd57c5f3a
commit e2f3ac78a7
6 changed files with 31 additions and 29 deletions

View File

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -x
cd $(dirname $0)/.. cd $(dirname $0)/..
@ -195,6 +194,7 @@ if [ "$QEMU" == "1" ]; then
KVM_ENABLE="-enable-kvm" KVM_ENABLE="-enable-kvm"
CPU="-cpu host" CPU="-cpu host"
fi fi
set -x
exec qemu-system-${QEMUARCH} -serial stdio \ exec qemu-system-${QEMUARCH} -serial stdio \
-rtc base=utc,clock=host \ -rtc base=utc,clock=host \
${KVM_ENABLE} \ ${KVM_ENABLE} \
@ -202,7 +202,7 @@ if [ "$QEMU" == "1" ]; then
${machine["$ARCH"]} \ ${machine["$ARCH"]} \
-kernel ${KERNEL} \ -kernel ${KERNEL} \
-initrd ${INITRD} \ -initrd ${INITRD} \
-m 1024 \ -m 2048 \
${network["$ARCH"]} \ ${network["$ARCH"]} \
$(eval "${cd["$ARCH"]} ${CCIMG}") \ $(eval "${cd["$ARCH"]} ${CCIMG}") \
$(eval "${hd["$ARCH"]} ${HD}") \ $(eval "${hd["$ARCH"]} ${HD}") \
@ -240,6 +240,7 @@ elif [ "$QIND" == "1" ]; then
SSH_PUB_ENABLE="--ssh-pub /stuff/rancher.key.pub" SSH_PUB_ENABLE="--ssh-pub /stuff/rancher.key.pub"
fi fi
set -x
docker create --name=${NAME} -it ${KVM_ENABLE} \ docker create --name=${NAME} -it ${KVM_ENABLE} \
rancher/qind \ rancher/qind \
--hostname "rancher-dev" \ --hostname "rancher-dev" \

View File

@ -75,15 +75,12 @@ def test_services_include(qemu, cloud_config):
@pytest.mark.timeout(40) @pytest.mark.timeout(40)
def test_docker_tls_args(qemu, cloud_config): def test_docker_tls_args(qemu, cloud_config):
u.wait_for_ssh(qemu, ssh_command) SSH(qemu, ssh_command).check_call('''
set -e -x
subprocess.check_call( sudo ros tls gen
ssh_command + ['sudo', 'ros', 'tls', 'gen'], sleep 3
stderr=subprocess.STDOUT, universal_newlines=True) docker --tlsverify version
'''.strip())
subprocess.check_call(
ssh_command + ['docker', '--tlsverify', 'version'],
stderr=subprocess.STDOUT, universal_newlines=True)
@pytest.mark.timeout(40) @pytest.mark.timeout(40)
@ -99,7 +96,7 @@ def test_rancher_network(qemu, cloud_config):
def test_docker_not_pid_one(qemu): def test_docker_not_pid_one(qemu):
SSH(qemu, ssh_command=ssh_command).check_call('bash', '-c', ''' SSH(qemu, ssh_command).check_call('''
set -e -x set -e -x
for i in $(pidof docker); do for i in $(pidof docker); do
[ $i != 1 ] [ $i != 1 ]

View File

@ -11,7 +11,7 @@ def qemu(request):
def test_system_docker_survives_custom_docker_install(qemu): def test_system_docker_survives_custom_docker_install(qemu):
SSH(qemu).check_call('bash', '-c', ''' SSH(qemu).check_call('''
set -x -e set -x -e
mkdir x mkdir x
sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x

View File

@ -12,12 +12,13 @@ def qemu(request):
def test_oem(qemu): def test_oem(qemu):
SSH(qemu).check_call('sudo', 'bash', '-c', ''' try:
SSH(qemu).check_call('''
set -x set -x
set -e set -e
sudo mkfs.ext4 -L RANCHER_OEM /dev/vda sudo mkfs.ext4 -L RANCHER_OEM /dev/vda
sudo mount /dev/vda /mnt sudo mount /dev/vda /mnt
cat > /tmp/oem-config.yml << "EOF" cat > /tmp/oem-config.yml << EOF
#cloud-config #cloud-config
rancher: rancher:
upgrade: upgrade:
@ -25,11 +26,14 @@ rancher:
EOF EOF
sudo cp /tmp/oem-config.yml /mnt sudo cp /tmp/oem-config.yml /mnt
sudo umount /mnt sudo umount /mnt
sudo reboot >/dev/null 2>&1 &'''.strip()) sudo reboot
'''.strip())
except:
pass
time.sleep(1) time.sleep(3)
SSH(qemu).check_call('bash', '-c', ''' SSH(qemu).check_call('''
set -x set -x
if [ ! -e /usr/share/ros/oem/oem-config.yml ]; then if [ ! -e /usr/share/ros/oem/oem-config.yml ]; then
echo Failed to find /usr/share/ros/oem/oem-config.yml echo Failed to find /usr/share/ros/oem/oem-config.yml

View File

@ -11,7 +11,7 @@ def qemu(request):
def test_ssh_key_merging(qemu): def test_ssh_key_merging(qemu):
SSH(qemu).check_call('bash', '-c', '''cat > test-merge << "SCRIPT" SSH(qemu).check_call('''cat > test-merge << "SCRIPT"
set -x -e set -x -e
rm /var/lib/rancher/conf/cloud-config.yml rm /var/lib/rancher/conf/cloud-config.yml

View File

@ -21,7 +21,7 @@ def qemu(request):
def test_network_conf(qemu): def test_network_conf(qemu):
SSH(qemu).check_call('bash', '-c', '''cat > test-merge << "SCRIPT" SSH(qemu).check_call('''cat > test-merge << "SCRIPT"
set -x -e set -x -e
ip link show dev br0 ip link show dev br0
@ -37,7 +37,7 @@ sudo bash test-merge
def test_network_dns_ros_set(qemu): def test_network_dns_ros_set(qemu):
SSH(qemu).check_call('bash', '-c', ''' SSH(qemu).check_call('''
set -x -e set -x -e
sudo ros config set rancher.network.dns.search '[a,b]' sudo ros config set rancher.network.dns.search '[a,b]'