]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Moves all integration tests to an integration folder and provides a new tox env to... 357/head
authorAndrew Schoen <aschoen@redhat.com>
Wed, 12 Nov 2014 21:21:27 +0000 (15:21 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 12 Nov 2014 21:23:17 +0000 (15:23 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
.coveragerc
pytest.ini
teuthology/orchestra/test/integration/__init__.py [new file with mode: 0644]
teuthology/orchestra/test/integration/test_integration.py [new file with mode: 0644]
teuthology/orchestra/test/test_integration.py [deleted file]
teuthology/test/integration/__init__.py [new file with mode: 0644]
teuthology/test/integration/test_suite.py [new file with mode: 0644]
teuthology/test/test_suite.py
tox.ini

index 9f08918b0a03a7d12665b539097efbd2ad4ed608..560e8001711545b943dfc31c40611c687c0062c3 100644 (file)
@@ -1,2 +1,2 @@
 [run]
-omit = teuthology/test/*
+omit = */test/* 
index 847360a69692a147aa5f8b1634cbfeeae55ceb0b..b50b1e6084e792883e250b4c0f123f118fde3cdc 100644 (file)
@@ -1,2 +1,2 @@
 [pytest]
-norecursedirs = .git build virtualenv teuthology.egg-info .tox
+norecursedirs = .git build virtualenv teuthology.egg-info .tox */integration
diff --git a/teuthology/orchestra/test/integration/__init__.py b/teuthology/orchestra/test/integration/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/teuthology/orchestra/test/integration/test_integration.py b/teuthology/orchestra/test/integration/test_integration.py
new file mode 100644 (file)
index 0000000..1fc3496
--- /dev/null
@@ -0,0 +1,80 @@
+from teuthology.orchestra import monkey
+monkey.patch_all()
+
+from cStringIO import StringIO
+
+import os
+from teuthology.orchestra import connection, remote, run
+from teuthology.orchestra.test.util import assert_raises
+from teuthology.exceptions import CommandCrashedError, ConnectionLostError
+
+from pytest import skip
+
+HOST = None
+
+
+class TestIntegration():
+    def setup(self):
+        try:
+            host = os.environ['ORCHESTRA_TEST_HOST']
+        except KeyError:
+            skip('To run integration tests, set environment ' +
+                 'variable ORCHESTRA_TEST_HOST to user@host to use.')
+        global HOST
+        HOST = host
+
+    def test_crash(self):
+        ssh = connection.connect(HOST)
+        e = assert_raises(
+            CommandCrashedError,
+            run.run,
+            client=ssh,
+            args=['sh', '-c', 'kill -ABRT $$'],
+            )
+        assert e.command == "sh -c 'kill -ABRT $$'"
+        assert str(e) == "Command crashed: \"sh -c 'kill -ABRT $$'\""
+
+    def test_lost(self):
+        ssh = connection.connect(HOST)
+        e = assert_raises(
+            ConnectionLostError,
+            run.run,
+            client=ssh,
+            args=['sh', '-c', 'kill -ABRT $PPID'],
+            )
+        assert e.command == "sh -c 'kill -ABRT $PPID'"
+        assert str(e) == \
+            "SSH connection was lost: \"sh -c 'kill -ABRT $PPID'\""
+
+    def test_pipe(self):
+        ssh = connection.connect(HOST)
+        r = run.run(
+            client=ssh,
+            args=['cat'],
+            stdin=run.PIPE,
+            stdout=StringIO(),
+            wait=False,
+            )
+        assert r.stdout.getvalue() == ''
+        r.stdin.write('foo\n')
+        r.stdin.write('bar\n')
+        r.stdin.close()
+
+        r.wait()
+        got = r.exitstatus
+        assert got == 0
+        assert r.stdout.getvalue() == 'foo\nbar\n'
+
+    def test_and(self):
+        ssh = connection.connect(HOST)
+        r = run.run(
+            client=ssh,
+            args=['true', run.Raw('&&'), 'echo', 'yup'],
+            stdout=StringIO(),
+            )
+        assert r.stdout.getvalue() == 'yup\n'
+
+    def test_os(self):
+        rem = remote.Remote(HOST)
+        assert rem.os.name
+        assert rem.os.version
diff --git a/teuthology/orchestra/test/test_integration.py b/teuthology/orchestra/test/test_integration.py
deleted file mode 100644 (file)
index 6d45b28..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-from .. import monkey
-monkey.patch_all()
-
-from cStringIO import StringIO
-
-import os
-from .. import connection, remote, run
-from .util import assert_raises
-from teuthology.exceptions import CommandCrashedError, ConnectionLostError
-
-from pytest import skip
-
-HOST = None
-
-
-class TestIntegration():
-    def setup(self):
-        try:
-            host = os.environ['ORCHESTRA_TEST_HOST']
-        except KeyError:
-            skip('To run integration tests, set environment ' +
-                 'variable ORCHESTRA_TEST_HOST to user@host to use.')
-        global HOST
-        HOST = host
-
-    def test_crash(self):
-        ssh = connection.connect(HOST)
-        e = assert_raises(
-            CommandCrashedError,
-            run.run,
-            client=ssh,
-            args=['sh', '-c', 'kill -ABRT $$'],
-            )
-        assert e.command == "sh -c 'kill -ABRT $$'"
-        assert str(e) == "Command crashed: \"sh -c 'kill -ABRT $$'\""
-
-    def test_lost(self):
-        ssh = connection.connect(HOST)
-        e = assert_raises(
-            ConnectionLostError,
-            run.run,
-            client=ssh,
-            args=['sh', '-c', 'kill -ABRT $PPID'],
-            )
-        assert e.command == "sh -c 'kill -ABRT $PPID'"
-        assert str(e) == \
-            "SSH connection was lost: \"sh -c 'kill -ABRT $PPID'\""
-
-    def test_pipe(self):
-        ssh = connection.connect(HOST)
-        r = run.run(
-            client=ssh,
-            args=['cat'],
-            stdin=run.PIPE,
-            stdout=StringIO(),
-            wait=False,
-            )
-        assert r.stdout.getvalue() == ''
-        r.stdin.write('foo\n')
-        r.stdin.write('bar\n')
-        r.stdin.close()
-
-        r.wait()
-        got = r.exitstatus
-        assert got == 0
-        assert r.stdout.getvalue() == 'foo\nbar\n'
-
-    def test_and(self):
-        ssh = connection.connect(HOST)
-        r = run.run(
-            client=ssh,
-            args=['true', run.Raw('&&'), 'echo', 'yup'],
-            stdout=StringIO(),
-            )
-        assert r.stdout.getvalue() == 'yup\n'
-
-    def test_os(self):
-        rem = remote.Remote(HOST)
-        assert rem.os.name
-        assert rem.os.version
diff --git a/teuthology/test/integration/__init__.py b/teuthology/test/integration/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/teuthology/test/integration/test_suite.py b/teuthology/test/integration/test_suite.py
new file mode 100644 (file)
index 0000000..012dbc5
--- /dev/null
@@ -0,0 +1,86 @@
+import os
+import requests
+from pytest import raises, skip
+
+from teuthology.config import config
+from teuthology import suite
+
+
+class TestSuiteOnline(object):
+    def setup(self):
+        if 'TEST_ONLINE' not in os.environ:
+            skip("To run these sets, set the environment variable TEST_ONLINE")
+
+    def test_ceph_hash_simple(self):
+        resp = requests.get(
+            'https://api.github.com/repos/ceph/ceph/git/refs/heads/master')
+        ref_hash = resp.json()['object']['sha']
+        assert suite.get_hash('ceph') == ref_hash
+
+    def test_kernel_hash_saya(self):
+        # We don't currently have these packages.
+        assert suite.get_hash('kernel', 'master', 'basic', 'saya') is None
+
+    def test_all_master_branches(self):
+        # Don't attempt to send email
+        config.results_email = None
+        job_config = suite.create_initial_config('suite', 'master',
+                                                 'master', 'master', 'testing',
+                                                 'basic', 'centos', 'plana')
+        assert ((job_config.branch, job_config.teuthology_branch,
+                 job_config.suite_branch) == ('master', 'master', 'master'))
+
+    def test_config_bogus_kernel_branch(self):
+        # Don't attempt to send email
+        config.results_email = None
+        with raises(suite.ScheduleFailError):
+            suite.create_initial_config('s', None, 'master', 't',
+                                        'bogus_kernel_branch', 'f', 'd', 'm')
+
+    def test_config_bogus_kernel_flavor(self):
+        # Don't attempt to send email
+        config.results_email = None
+        with raises(suite.ScheduleFailError):
+            suite.create_initial_config('s', None, 'master', 't', 'k',
+                                        'bogus_kernel_flavor', 'd', 'm')
+
+    def test_config_bogus_ceph_branch(self):
+        # Don't attempt to send email
+        config.results_email = None
+        with raises(suite.ScheduleFailError):
+            suite.create_initial_config('s', None, 'bogus_ceph_branch', 't',
+                                        'k', 'f', 'd', 'm')
+
+    def test_config_bogus_suite_branch(self):
+        # Don't attempt to send email
+        config.results_email = None
+        with raises(suite.ScheduleFailError):
+            suite.create_initial_config('s', 'bogus_suite_branch', 'master',
+                                        't', 'k', 'f', 'd', 'm')
+
+    def test_config_bogus_teuthology_branch(self):
+        # Don't attempt to send email
+        config.results_email = None
+        with raises(suite.ScheduleFailError):
+            suite.create_initial_config('s', None, 'master',
+                                        'bogus_teuth_branch', 'k', 'f', 'd',
+                                        'm')
+
+    def test_config_substitution(self):
+        # Don't attempt to send email
+        config.results_email = None
+        job_config = suite.create_initial_config('MY_SUITE', 'master',
+                                                 'master', 'master', 'testing',
+                                                 'basic', 'centos', 'plana')
+        assert job_config['suite'] == 'MY_SUITE'
+
+    def test_config_kernel_section(self):
+        # Don't attempt to send email
+        config.results_email = None
+        job_config = suite.create_initial_config('MY_SUITE', 'master',
+                                                 'master', 'master', 'testing',
+                                                 'basic', 'centos', 'plana')
+        assert job_config['kernel']['kdb'] is True
+
+
+# maybe use notario for the above?
index f30f1eea867173e11e60acab1e166b2269098be5..f7306d058e0711399ceff8272c63bb6c3b75d03d 100644 (file)
@@ -1,9 +1,5 @@
-import os
-import requests
 from datetime import datetime
-from pytest import raises, skip
 
-from teuthology.config import config
 from teuthology import suite
 
 
@@ -56,83 +52,3 @@ class TestSuiteOffline(object):
         assert isinstance(
             suite.dict_templ['overrides']['admin_socket']['branch'],
             suite.Placeholder)
-
-
-class TestSuiteOnline(object):
-    def setup(self):
-        if 'TEST_ONLINE' not in os.environ:
-            skip("To run these sets, set the environment variable TEST_ONLINE")
-
-    def test_ceph_hash_simple(self):
-        resp = requests.get(
-            'https://api.github.com/repos/ceph/ceph/git/refs/heads/master')
-        ref_hash = resp.json()['object']['sha']
-        assert suite.get_hash('ceph') == ref_hash
-
-    def test_kernel_hash_saya(self):
-        # We don't currently have these packages.
-        assert suite.get_hash('kernel', 'master', 'basic', 'saya') is None
-
-    def test_all_master_branches(self):
-        # Don't attempt to send email
-        config.results_email = None
-        job_config = suite.create_initial_config('suite', 'master',
-                                                 'master', 'master', 'testing',
-                                                 'basic', 'centos', 'plana')
-        assert ((job_config.branch, job_config.teuthology_branch,
-                 job_config.suite_branch) == ('master', 'master', 'master'))
-
-    def test_config_bogus_kernel_branch(self):
-        # Don't attempt to send email
-        config.results_email = None
-        with raises(suite.ScheduleFailError):
-            suite.create_initial_config('s', None, 'master', 't',
-                                        'bogus_kernel_branch', 'f', 'd', 'm')
-
-    def test_config_bogus_kernel_flavor(self):
-        # Don't attempt to send email
-        config.results_email = None
-        with raises(suite.ScheduleFailError):
-            suite.create_initial_config('s', None, 'master', 't', 'k',
-                                        'bogus_kernel_flavor', 'd', 'm')
-
-    def test_config_bogus_ceph_branch(self):
-        # Don't attempt to send email
-        config.results_email = None
-        with raises(suite.ScheduleFailError):
-            suite.create_initial_config('s', None, 'bogus_ceph_branch', 't',
-                                        'k', 'f', 'd', 'm')
-
-    def test_config_bogus_suite_branch(self):
-        # Don't attempt to send email
-        config.results_email = None
-        with raises(suite.ScheduleFailError):
-            suite.create_initial_config('s', 'bogus_suite_branch', 'master',
-                                        't', 'k', 'f', 'd', 'm')
-
-    def test_config_bogus_teuthology_branch(self):
-        # Don't attempt to send email
-        config.results_email = None
-        with raises(suite.ScheduleFailError):
-            suite.create_initial_config('s', None, 'master',
-                                        'bogus_teuth_branch', 'k', 'f', 'd',
-                                        'm')
-
-    def test_config_substitution(self):
-        # Don't attempt to send email
-        config.results_email = None
-        job_config = suite.create_initial_config('MY_SUITE', 'master',
-                                                 'master', 'master', 'testing',
-                                                 'basic', 'centos', 'plana')
-        assert job_config['suite'] == 'MY_SUITE'
-
-    def test_config_kernel_section(self):
-        # Don't attempt to send email
-        config.results_email = None
-        job_config = suite.create_initial_config('MY_SUITE', 'master',
-                                                 'master', 'master', 'testing',
-                                                 'basic', 'centos', 'plana')
-        assert job_config['kernel']['kdb'] is True
-
-
-# maybe use notario for the above?
diff --git a/tox.ini b/tox.ini
index dbe5b894f18d048b960bc005912b15f15b34a630..1ce78de426575753a8a7d8b7616759d1ccbe1c43 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py27, flake8
+envlist = py27, py27-integration, flake8
 
 [testenv:py27]
 sitepackages=True
@@ -14,6 +14,20 @@ deps=
 
 commands=py.test --cov=teuthology --cov-report=term -v {posargs:teuthology scripts}
 
+[testenv:py27-integration]
+sitepackages=True
+deps=
+  -r{toxinidir}/requirements.txt
+  pytest
+  mock
+  fudge
+  nose
+  pytest-cov==1.6
+  coverage==3.7.1
+
+commands=py.test --cov=teuthology --cov-report=term -v {posargs:teuthology/test/integration teuthology/orchestra/test/integration}
+basepython=python2.7
+
 [testenv:flake8]
 deps=
   flake8