-
Notifications
You must be signed in to change notification settings - Fork 6
Implement storage nfs-on-slave test #341
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
base: master
Are you sure you want to change the base?
Conversation
6afd538
to
d450bb2
Compare
d450bb2
to
81dd04c
Compare
81dd04c
to
b34c3f5
Compare
b34c3f5
to
e498c5b
Compare
Just a rebase. |
tests/storage/nfs/test_nfs_sr.py
Outdated
@pytest.mark.usefixtures('hostA2') | ||
# Make sure this fixture is called before the parametrized one | ||
@pytest.mark.usefixtures('vm_ref') | ||
@pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr'], indirect=True) |
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.
- What is the objective behind using a parametrized fixture here?
- A fixture that yields a VM usually has a name that starts with
vm_
- How to actually use the parametrized fixture in our job definitions in
jobs.py
and in Jenkins?
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.
What is the objective behind using a parametrized fixture here?
Make it work.
I needed a VM with its disk on NFS SR, and every other test in test_nfs_sr.py
uses this boilerplate.
Now I've read a bit more about pytest
and fixtures and it looks like I can just remove this last line, replace dispatch_nfs
by vm_on_nfs_sr
, and it still works, like magic. I guess I can remove the vm_ref
one as well.
Looks like I still have more to learn about pytest
😅
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.
I don't think you need to parametrize, here. It looks like you just want the vm_on_nfs_sr
fixture. Unless you want the test to run with both NFS3 and NFS4+, in which case you need
@pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True)
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.
CC @Nambrok who, IIRC, implemented this parametrization of the NFS tests.
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.
@tperard This conversation was not resolved. I discussed with Damien and he said that it would make sense to run the test for both nfs and nfs4, as we do in the rest of the test file.
e498c5b
to
ef3eaa9
Compare
vm.start() | ||
vm.wait_for_os_booted() |
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.
Shouldn't the start/shutdown be handled by a fixture? Looks like a test failure here would not shutdown that VM we started.
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.
Looks like this would break test_reboot
which reboot the host before starting the guest.
Or do you mean adding a fixture that uses vm_on_nfs_sr
?
But vm_on_nfs_sr
does a vm.destroy()
. Is that enough?
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.
Or do you mean adding a fixture that uses
vm_on_nfs_sr
?
Yes, that one.
But
vm_on_nfs_sr
does avm.destroy()
. Is that enough?
Looks so, then it can still be useful to clarify with a comment that the shutdown need not be in cleanup because of this.
tests/storage/nfs/test_nfs_sr.py
Outdated
|
||
@pytest.mark.small_vm | ||
@pytest.mark.usefixtures('hostA2') | ||
def test_plugin_nfs_on_on_slave(self, vm_on_nfs_sr: 'VM'): |
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.
A note on what we expect from this plugin would be nice.
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.
There's a comment...
vm.wait_for_os_booted() | ||
host = vm.get_residence_host() | ||
|
||
vdi = VDI(vm.vdi_uuids()[0], host=host) |
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.
Can't it be just vdi = vm.vdis[0]
?
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.
I don't know, vm.vdis
looks like brand new code.
Signed-off-by: Anthony PERARD <[email protected]>
.. for functions that are going to be used by test_plugin_nfs_on_on_slave(). Signed-off-by: Anthony PERARD <[email protected]>
This new test ensures that the "nfs-on-slave" host-plugin does check something, and return different result based on the environment. Signed-off-by: Anthony PERARD <[email protected]>
ef3eaa9
to
5d89924
Compare
This new test ensures that the "nfs-on-slave" host-plugin does
check something, and return different result based on the environment.
the extension for the path. It's currently hard-coded to .vhd.