mirror of
https://github.com/rancher/os.git
synced 2025-08-17 22:38:22 +00:00
cleanup tests using SSH
This commit is contained in:
parent
2dd57c5f3a
commit
e2f3ac78a7
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
@ -195,6 +194,7 @@ if [ "$QEMU" == "1" ]; then
|
||||
KVM_ENABLE="-enable-kvm"
|
||||
CPU="-cpu host"
|
||||
fi
|
||||
set -x
|
||||
exec qemu-system-${QEMUARCH} -serial stdio \
|
||||
-rtc base=utc,clock=host \
|
||||
${KVM_ENABLE} \
|
||||
@ -202,7 +202,7 @@ if [ "$QEMU" == "1" ]; then
|
||||
${machine["$ARCH"]} \
|
||||
-kernel ${KERNEL} \
|
||||
-initrd ${INITRD} \
|
||||
-m 1024 \
|
||||
-m 2048 \
|
||||
${network["$ARCH"]} \
|
||||
$(eval "${cd["$ARCH"]} ${CCIMG}") \
|
||||
$(eval "${hd["$ARCH"]} ${HD}") \
|
||||
@ -240,6 +240,7 @@ elif [ "$QIND" == "1" ]; then
|
||||
SSH_PUB_ENABLE="--ssh-pub /stuff/rancher.key.pub"
|
||||
fi
|
||||
|
||||
set -x
|
||||
docker create --name=${NAME} -it ${KVM_ENABLE} \
|
||||
rancher/qind \
|
||||
--hostname "rancher-dev" \
|
||||
|
@ -75,15 +75,12 @@ def test_services_include(qemu, cloud_config):
|
||||
|
||||
@pytest.mark.timeout(40)
|
||||
def test_docker_tls_args(qemu, cloud_config):
|
||||
u.wait_for_ssh(qemu, ssh_command)
|
||||
|
||||
subprocess.check_call(
|
||||
ssh_command + ['sudo', 'ros', 'tls', 'gen'],
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
|
||||
subprocess.check_call(
|
||||
ssh_command + ['docker', '--tlsverify', 'version'],
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
SSH(qemu, ssh_command).check_call('''
|
||||
set -e -x
|
||||
sudo ros tls gen
|
||||
sleep 3
|
||||
docker --tlsverify version
|
||||
'''.strip())
|
||||
|
||||
|
||||
@pytest.mark.timeout(40)
|
||||
@ -99,9 +96,9 @@ def test_rancher_network(qemu, cloud_config):
|
||||
|
||||
|
||||
def test_docker_not_pid_one(qemu):
|
||||
SSH(qemu, ssh_command=ssh_command).check_call('bash', '-c', '''
|
||||
set -e -x
|
||||
for i in $(pidof docker); do
|
||||
[ $i != 1 ]
|
||||
done
|
||||
SSH(qemu, ssh_command).check_call('''
|
||||
set -e -x
|
||||
for i in $(pidof docker); do
|
||||
[ $i != 1 ]
|
||||
done
|
||||
'''.strip())
|
||||
|
@ -11,9 +11,9 @@ def qemu(request):
|
||||
|
||||
|
||||
def test_system_docker_survives_custom_docker_install(qemu):
|
||||
SSH(qemu).check_call('bash', '-c', '''
|
||||
set -x -e
|
||||
mkdir x
|
||||
sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x
|
||||
[ -d x/ros_subdir/home/rancher ]
|
||||
SSH(qemu).check_call('''
|
||||
set -x -e
|
||||
mkdir x
|
||||
sudo mount $(sudo ros dev LABEL=RANCHER_STATE) x
|
||||
[ -d x/ros_subdir/home/rancher ]
|
||||
'''.strip())
|
||||
|
@ -12,12 +12,13 @@ def qemu(request):
|
||||
|
||||
|
||||
def test_oem(qemu):
|
||||
SSH(qemu).check_call('sudo', 'bash', '-c', '''
|
||||
try:
|
||||
SSH(qemu).check_call('''
|
||||
set -x
|
||||
set -e
|
||||
sudo mkfs.ext4 -L RANCHER_OEM /dev/vda
|
||||
sudo mount /dev/vda /mnt
|
||||
cat > /tmp/oem-config.yml << "EOF"
|
||||
cat > /tmp/oem-config.yml << EOF
|
||||
#cloud-config
|
||||
rancher:
|
||||
upgrade:
|
||||
@ -25,11 +26,14 @@ rancher:
|
||||
EOF
|
||||
sudo cp /tmp/oem-config.yml /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
|
||||
if [ ! -e /usr/share/ros/oem/oem-config.yml ]; then
|
||||
echo Failed to find /usr/share/ros/oem/oem-config.yml
|
||||
|
@ -11,7 +11,7 @@ def qemu(request):
|
||||
|
||||
|
||||
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
|
||||
rm /var/lib/rancher/conf/cloud-config.yml
|
||||
|
||||
|
@ -21,7 +21,7 @@ def qemu(request):
|
||||
|
||||
|
||||
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
|
||||
|
||||
ip link show dev br0
|
||||
@ -37,7 +37,7 @@ sudo bash test-merge
|
||||
|
||||
|
||||
def test_network_dns_ros_set(qemu):
|
||||
SSH(qemu).check_call('bash', '-c', '''
|
||||
SSH(qemu).check_call('''
|
||||
set -x -e
|
||||
|
||||
sudo ros config set rancher.network.dns.search '[a,b]'
|
||||
|
Loading…
Reference in New Issue
Block a user