From a753ca7930378ee8fba487c07217b8b2eec16a85 Mon Sep 17 00:00:00 2001 From: Ivan Mikushin Date: Thu, 7 May 2015 21:01:19 +0500 Subject: [PATCH] test_run_system_container: wip --- .../integration/rancherostest/test_system.py | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/integration/rancherostest/test_system.py b/tests/integration/rancherostest/test_system.py index f4cd69d1..fc5d5397 100644 --- a/tests/integration/rancherostest/test_system.py +++ b/tests/integration/rancherostest/test_system.py @@ -8,6 +8,7 @@ def qemu(request): p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT) def fin(): + print('\nTerminating QEMU!!!') p.stdout.close() p.terminate() @@ -18,8 +19,27 @@ def qemu(request): @pytest.mark.timeout(20) def test_system_boot(qemu): for ln in iter(qemu.stdout.readline, ''): - l = string.strip(ln) - ros_booted_substr = string.find(l, 'RancherOS v0.3.1-rc2 started') + ros_booted_substr = string.find(ln, 'RancherOS v0.3.1-rc2 started') if ros_booted_substr > -1: assert True return + assert False + + +@pytest.mark.timeout(20) +def test_run_system_container(qemu): + assert qemu.returncode is None + ssh = subprocess.Popen( + './scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + try: + for ln in iter(ssh.stdout.readline, ''): + print(ln) + pass + ssh.wait() + assert ssh.returncode == 0 + finally: + ssh.stdout.close() + if ssh.returncode is None: + ssh.terminate()