Skip to content

Commit

Permalink
Moves all integration tests to an integration folder and provides a n…
Browse files Browse the repository at this point in the history
…ew tox env to run only those tests

Signed-off-by: Andrew Schoen <[email protected]>
  • Loading branch information
andrewschoen committed Nov 12, 2014
1 parent 2c95a3a commit a3f2f63
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
omit = teuthology/test/*
omit = */test/*
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
norecursedirs = .git build virtualenv teuthology.egg-info .tox
norecursedirs = .git build virtualenv teuthology.egg-info .tox */integration
Empty file.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from .. import monkey
from teuthology.orchestra import monkey
monkey.patch_all()

from cStringIO import StringIO

import os
from .. import connection, remote, run
from .util import assert_raises
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
Expand Down
Empty file.
86 changes: 86 additions & 0 deletions teuthology/test/integration/test_suite.py
Original file line number Diff line number Diff line change
@@ -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?
84 changes: 0 additions & 84 deletions teuthology/test/test_suite.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -56,83 +52,3 @@ def test_substitute_placeholders(self):
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?
16 changes: 15 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, flake8
envlist = py27, py27-integration, flake8

[testenv:py27]
sitepackages=True
Expand All @@ -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
Expand Down

0 comments on commit a3f2f63

Please sign in to comment.