From 43795fe28393cdb154f4b5f93471b125bea501e5 Mon Sep 17 00:00:00 2001 From: Ivan Mikushin Date: Thu, 1 Oct 2015 16:45:27 +0500 Subject: [PATCH] add integration test --- .../test_03_docker_in_persistent_console.py | 6 ---- .../rancherostest/test_04_ros_install.py | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 tests/integration/rancherostest/test_04_ros_install.py diff --git a/tests/integration/rancherostest/test_03_docker_in_persistent_console.py b/tests/integration/rancherostest/test_03_docker_in_persistent_console.py index 3fcbca30..c91d4940 100644 --- a/tests/integration/rancherostest/test_03_docker_in_persistent_console.py +++ b/tests/integration/rancherostest/test_03_docker_in_persistent_console.py @@ -1,7 +1,6 @@ import pytest import rancherostest.util as u import subprocess -import yaml ssh_command = ['./scripts/ssh', '--qemu', '--key', './tests/integration/assets/test.key'] @@ -13,11 +12,6 @@ def qemu(request): return u.run_qemu(request, ['--cloud-config', cloud_config_path]) -@pytest.fixture(scope="module") -def cloud_config(): - return yaml.load(open(cloud_config_path)) - - @pytest.mark.timeout(40) def test_reboot_with_container_running(qemu): assert qemu is not None diff --git a/tests/integration/rancherostest/test_04_ros_install.py b/tests/integration/rancherostest/test_04_ros_install.py new file mode 100644 index 00000000..21272260 --- /dev/null +++ b/tests/integration/rancherostest/test_04_ros_install.py @@ -0,0 +1,28 @@ +import pytest +import rancherostest.util as u +import subprocess + + +ssh_command = ['./scripts/ssh', '--qemu'] + + +@pytest.fixture(scope="module") +def qemu(request): + return u.run_qemu(request, ['--no-format']) + + +@pytest.mark.timeout(40) +def test_ros_install_on_formatted_disk(qemu): + assert qemu is not None + u.wait_for_ssh(ssh_command) + subprocess.check_call(ssh_command + ['sudo', 'mkfs.ext4', '/dev/vda'], + stderr=subprocess.STDOUT, universal_newlines=True) + + subprocess.check_call(ssh_command + ['sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda', + '-i', 'rancher/os:v0.4.0-dev-test.135'], + stderr=subprocess.STDOUT, universal_newlines=True) + + subprocess.call(ssh_command + ['sudo', 'reboot'], + stderr=subprocess.STDOUT, universal_newlines=True) + + u.wait_for_ssh(ssh_command)