Skip to content

Commit 8c5a5d4

Browse files
authored
Merge pull request #61 from UpCloudLtd/feature-update-templates
Fix travis/integration test CI.
2 parents a8ffeaa + da30b3d commit 8c5a5d4

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ script:
1515
matrix:
1616
allow_failures:
1717
- python: "nightly"
18+
19+
dist: trusty

test/helpers/infra.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
zone=ZONE.London,
4141
password_delivery='none',
4242
storage_devices=[
43-
Storage(os='CentOS 7.0', size=10),
43+
Storage(os='CentOS 7.6', size=10),
4444
Storage(size=10),
4545
],
4646
login_user=login_user_block('testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x user@some.host'], True),
@@ -53,7 +53,7 @@
5353
zone=ZONE.London,
5454
password_delivery='none',
5555
storage_devices=[
56-
Storage(os='Debian 7.8', size=30)
56+
Storage(os='Debian 10.0', size=30)
5757
],
5858
login_user=login_user_block('testuser', ['ssh-rsa AAAAB3NzaC1yc2EAA[...]ptshi44x user@some.host'], True),
5959
)

test/test_integration/test_integration_test.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,24 @@
2121
PASSWORD = os.environ.get('UPCLOUD_API_PASSWD')
2222

2323

24-
integration_test = pytest.mark.skipif(
25-
not pytest.config.getoption('--integration-tests'),
26-
reason='need --integration-tests option to run'
27-
)
24+
def pytest_addoption(parser):
25+
parser.addoption(
26+
"--integration-tests", action="store_true", default=False, help="run integration tests"
27+
)
28+
29+
30+
def pytest_configure(config):
31+
config.addinivalue_line("markers", "interagtion: mark test as integration")
32+
33+
34+
def pytest_collection_modifyitems(config, items):
35+
if config.getoption("--integration-tests"):
36+
# --integration-tests given in cli: do not skip integration tests
37+
return
38+
integration_tests = pytest.mark.skip(reason="need --integration-tests option to run")
39+
for item in items:
40+
if "integration_test" in item.keywords:
41+
item.add_marker(integration_tests)
2842

2943

3044
# globals to store created resources so we can cleanup after tests
@@ -42,7 +56,7 @@ def delete_tag(tag):
4256
tag.destroy()
4357

4458

45-
@integration_test
59+
@pytest.mark.integration_test
4660
def teardown_module(module):
4761
manager = CloudManager(USERNAME, PASSWORD, timeout=160)
4862

@@ -61,7 +75,7 @@ def teardown_module(module):
6175
manager.delete_tag(tag)
6276

6377

64-
@integration_test
78+
@pytest.mark.integration_test
6579
def test_infra_ops():
6680
global CREATED_SERVERS
6781
global CREATED_TAGS

upcloud_api/cloud_manager/cloud_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(self, username, password, timeout=10):
2727
`None` means that there is no timeout.
2828
"""
2929
if not username or not password:
30-
raise Exception('Invalid credentials, please provide a username and password.')
30+
raise Exception(
31+
'Invalid credentials, please provide a username and password')
3132

3233
credentials = '{0}:{1}'.format(username, password).encode()
3334
encoded_credentials = base64.b64encode(credentials).decode()

upcloud_api/cloud_manager/server_mixin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ def create_server(self, server):
105105
(id is a running starting from 1)
106106
- tier defaults to maxiops
107107
- valid operating systems are:
108-
"CentOS 6.5", "CentOS 7.0"
109-
"Debian 7.8"
108+
"CentOS 6.10", "CentOS 7.6"
110109
"Ubuntu 12.04", "Ubuntu 14.04"
111-
"Windows 2003","Windows 2008" ,"Windows 2012"
110+
"Windows 2012", "Windows 2016"
112111
"""
113112
if isinstance(server, Server):
114113
body = server.prepare_post_body()

0 commit comments

Comments
 (0)