-
Notifications
You must be signed in to change notification settings - Fork 6
a-posteriori review and fixes of Linstor tests #328
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
Draft
ydirson
wants to merge
5
commits into
master
Choose a base branch
from
linstor-post-review
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2335a30
linstor: stop removing python-linstor package
ydirson 3ca7752
test_create_sr_without_linstor: more idiomatic handling of exceptions
ydirson 0f82d1e
linstor: fix requirements description
ydirson d2bc7a5
WIP linstor: use a fixture to check linstor is not installed
ydirson be8e849
WIP linstor: remarks
ydirson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,17 +43,30 @@ def lvm_disks(host, sr_disks_for_all_hosts, provisioning_type): | |
|
||
@pytest.fixture(scope="package") | ||
def storage_pool_name(provisioning_type): | ||
# FIXME: this needs an explanation | ||
return GROUP_NAME if provisioning_type == "thick" else STORAGE_POOL_NAME | ||
|
||
# FIXME why having this feature of session scope? Shouldn't it make | ||
# it impossible to run both thin and thick tests in the same session? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since all linstor tests were going to be repeated with just one change of SR type, pytest |
||
@pytest.fixture(params=["thin"], scope="session") | ||
def provisioning_type(request): | ||
return request.param | ||
|
||
# FIXME: this feature has scope "package" but even test_linsor_sr file | ||
# includes tests that need *not* to have linstor installed. Currently | ||
# pool_with_saved_yum_state's setup is being run for both thin and | ||
# thick, but with a single teardown at the end (which is even not what | ||
# --setup-plan claims it will do)? Is there even a way to make this | ||
# work, with pool_with_saved_yum_state being of scope package anyway? | ||
# Possibly by grouping packages with identical package reqs into | ||
# searate sub-packages? | ||
@pytest.fixture(scope='package') | ||
def pool_with_linstor(hostA2, lvm_disks, pool_with_saved_yum_state): | ||
import concurrent.futures | ||
pool = pool_with_saved_yum_state | ||
|
||
# FIXME must check we have at least 3 hosts - hostA3 or a simple check here? | ||
|
||
def check_linstor_installed(host): | ||
if host.is_package_installed(LINSTOR_PACKAGE): | ||
raise Exception( | ||
|
@@ -69,6 +82,7 @@ def install_linstor(host): | |
host.yum_install([LINSTOR_PACKAGE], enablerepo="xcp-ng-linstor-testing") | ||
# Needed because the linstor driver is not in the xapi sm-plugins list | ||
# before installing the LINSTOR packages. | ||
# FIXME: why multipathd? | ||
host.ssh(["systemctl", "restart", "multipathd"]) | ||
host.restart_toolstack(verify=True) | ||
|
||
|
@@ -77,15 +91,6 @@ def install_linstor(host): | |
|
||
yield pool | ||
|
||
# Need to remove this package as we have separate run of `test_create_sr_without_linstor` | ||
# for `thin` and `thick` `provisioning_type`. | ||
def remove_linstor(host): | ||
logging.info(f"Cleaning up python-linstor from host {host}...") | ||
host.yum_remove(["python-linstor"]) | ||
|
||
with concurrent.futures.ThreadPoolExecutor() as executor: | ||
executor.map(remove_linstor, pool.hosts) | ||
|
||
@pytest.fixture(scope='package') | ||
def linstor_sr(pool_with_linstor, provisioning_type, storage_pool_name): | ||
sr = pool_with_linstor.master.sr_create('linstor', 'LINSTOR-SR-test', { | ||
|
@@ -108,3 +113,9 @@ def vm_on_linstor_sr(host, linstor_sr, vm_ref): | |
yield vm | ||
logging.info("<< Destroy VM") | ||
vm.destroy(verify=True) | ||
|
||
@pytest.fixture(scope='module') | ||
def host_without_linstor(host): | ||
# FIXME: is that really the package to test? | ||
assert not host.is_package_installed('python-linstor'), \ | ||
"linstor must not be installed on the host at the beginning of the tests" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to dynamically handle the
provisioning_type
used for buildingGROUP_NAME
. Please see comment fordef provisioning_type
for more.