Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove direct dependencies on SDK v3 #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 1 addition & 14 deletions ovirtlago/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
from ovirtlago import utils
from utils import partial

import ovirtsdk.api
from ovirtsdk.infrastructure.errors import (RequestError, ConnectionError)

from . import (
constants,
testlib,
Expand Down Expand Up @@ -284,13 +281,6 @@ def _create_api(self, api_ver):
if api_ver == 3:
if '3' not in available_sdks():
raise RuntimeError('oVirt Python SDK v3 not found.')
return ovirtsdk.api.API(
url=url,
username=constants.ENGINE_USER,
password=str(self.metadata['ovirt-engine-password']),
validate_cert_chain=False,
insecure=True,
)
if api_ver == 4:
if '4' not in available_sdks():
raise RuntimeError('oVirt Python SDK v4 not found.')
Expand Down Expand Up @@ -318,10 +308,7 @@ def get():
return True
return False

testlib.assert_true_within_short(
get,
allowed_exceptions=[RequestError, ConnectionError],
)
testlib.assert_true_within_short(get)
except AssertionError:
raise RuntimeError('Failed to connect to the engine')

Expand Down
13 changes: 3 additions & 10 deletions tests/unit/ovirtlago/test_ovirtlago_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@

class TestUtilsOvirtSDKs(object):
@pytest.mark.parametrize(
('modules'),
[(['ovirtsdk4', 'ovirtsdk']), (['ovirtsdk4', 'ovirtsdk', 'dummy'])]
('modules'), [(['ovirtsdk4']), (['ovirtsdk4', 'dummy'])]
)
def test_available_all(self, modules):
assert utils.available_sdks(modules=modules) == ['3', '4']
assert utils.available_sdks(modules=modules) == ['4']

@pytest.mark.parametrize(
('modules', 'require'), [
(['ovirtsdk4'], ['4']), (['ovirtsdk'], ['3']),
(['ovirtsdk', 'dummy'], ['3'])
(['ovirtsdk4'], ['4']),
]
)
def test_available_one(self, modules, require):
Expand All @@ -43,10 +41,6 @@ def test_available_one(self, modules, require):
@pytest.mark.parametrize(
('modules', 'version'), [
(['ovirtsdk4'], '4'),
(['ovirtsdk'], '3'),
(['ovirtsdk', 'dummy'], '3'),
(['ovirtsdk', 'ovirtsdk4'], '3'),
([], '3'),
([], '4'),
]
)
Expand All @@ -59,7 +53,6 @@ def foo():

@pytest.mark.parametrize(
('modules', 'version'), [
(['ovirtsdk4'], '3'),
(['ovirtsdk'], '4'),
(['ovirtsdk', 'dummy'], '4'),
]
Expand Down