Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ script:
matrix:
allow_failures:
- python: "nightly"

dist: trusty
4 changes: 2 additions & 2 deletions test/helpers/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
)
Expand Down
26 changes: 20 additions & 6 deletions test/test_integration/test_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion upcloud_api/cloud_manager/cloud_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions upcloud_api/cloud_manager/server_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down