diff --git a/.travis.yml b/.travis.yml index cad94b4..8591e4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,3 +15,5 @@ script: matrix: allow_failures: - python: "nightly" + +dist: trusty diff --git a/test/helpers/infra.py b/test/helpers/infra.py index 6a45f00..3b83f8f 100644 --- a/test/helpers/infra.py +++ b/test/helpers/infra.py @@ -40,7 +40,7 @@ zone=ZONE.London, password_delivery='none', storage_devices=[ - Storage(os='CentOS 7.0', size=10), + Storage(os='CentOS 7.6', size=10), Storage(size=10), ], login_user=login_user_block('testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x user@some.host'], True), @@ -53,7 +53,7 @@ zone=ZONE.London, password_delivery='none', storage_devices=[ - Storage(os='Debian 7.8', size=30) + Storage(os='Debian 10.0', size=30) ], login_user=login_user_block('testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x user@some.host'], True), ) diff --git a/test/test_integration/test_integration_test.py b/test/test_integration/test_integration_test.py index d4b7736..ee520a7 100644 --- a/test/test_integration/test_integration_test.py +++ b/test/test_integration/test_integration_test.py @@ -21,10 +21,24 @@ PASSWORD = os.environ.get('UPCLOUD_API_PASSWD') -integration_test = pytest.mark.skipif( - not pytest.config.getoption('--integration-tests'), - reason='need --integration-tests option to run' -) +def pytest_addoption(parser): + parser.addoption( + "--integration-tests", action="store_true", default=False, help="run integration tests" + ) + + +def pytest_configure(config): + config.addinivalue_line("markers", "interagtion: mark test as integration") + + +def pytest_collection_modifyitems(config, items): + if config.getoption("--integration-tests"): + # --integration-tests given in cli: do not skip integration tests + return + integration_tests = pytest.mark.skip(reason="need --integration-tests option to run") + for item in items: + if "integration_test" in item.keywords: + item.add_marker(integration_tests) # globals to store created resources so we can cleanup after tests @@ -42,7 +56,7 @@ def delete_tag(tag): tag.destroy() -@integration_test +@pytest.mark.integration_test def teardown_module(module): manager = CloudManager(USERNAME, PASSWORD, timeout=160) @@ -61,7 +75,7 @@ def teardown_module(module): manager.delete_tag(tag) -@integration_test +@pytest.mark.integration_test def test_infra_ops(): global CREATED_SERVERS global CREATED_TAGS diff --git a/upcloud_api/cloud_manager/cloud_manager.py b/upcloud_api/cloud_manager/cloud_manager.py index 90eaad8..b067cad 100644 --- a/upcloud_api/cloud_manager/cloud_manager.py +++ b/upcloud_api/cloud_manager/cloud_manager.py @@ -27,7 +27,8 @@ def __init__(self, username, password, timeout=10): `None` means that there is no timeout. """ if not username or not password: - raise Exception('Invalid credentials, please provide a username and password.') + raise Exception( + 'Invalid credentials, please provide a username and password') credentials = '{0}:{1}'.format(username, password).encode() encoded_credentials = base64.b64encode(credentials).decode() diff --git a/upcloud_api/cloud_manager/server_mixin.py b/upcloud_api/cloud_manager/server_mixin.py index e5fdcb8..bbea267 100644 --- a/upcloud_api/cloud_manager/server_mixin.py +++ b/upcloud_api/cloud_manager/server_mixin.py @@ -105,10 +105,9 @@ def create_server(self, server): (id is a running starting from 1) - tier defaults to maxiops - valid operating systems are: - "CentOS 6.5", "CentOS 7.0" - "Debian 7.8" + "CentOS 6.10", "CentOS 7.6" "Ubuntu 12.04", "Ubuntu 14.04" - "Windows 2003","Windows 2008" ,"Windows 2012" + "Windows 2012", "Windows 2016" """ if isinstance(server, Server): body = server.prepare_post_body()