-
Notifications
You must be signed in to change notification settings - Fork 4
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
Introduce setup and teardown fixtures #38
Introduce setup and teardown fixtures #38
Conversation
This PR need few changes to be merged to pass the tests |
Please feel free to edit the description to add the keyword |
Done! |
a6e04a7
to
d4a8ae5
Compare
c5e73e9
to
63ccac8
Compare
6726cda
to
1a4153f
Compare
centos-ci/xfs seems to have failed . @Shwetha-Acharya can you check if its related to the proposed change? |
ea46590
to
97b78c7
Compare
97b78c7
to
70a9c0d
Compare
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.
some minor changes. The rest looks good.
You can also go ahead with re-adding tests for pre-mounted shares after making those changes.
Thanks.
b3ce06b
to
507f7f2
Compare
@spuiuk sit environment is not adding any premounted share value inside test-info created by it: Refer test-info.yaml on client from build artefacts of client in: https://jenkins-samba.apps.ocp.cloud.ci.centos.org/job/samba_cephfs.vfs-integration-test-cases/125/
Also the same code pass, when run locally by changing test-info.yml.example to test-info.yml (This is because the premounted share value is now present)
So, inorder to resolve this, I have added logic to ignore premounted share test, if there are no premounted shares in test-info fie. This logic to skip is useful even if any user wants to manually run the tests without the value of premounted shares inside the test_info file |
Please consider the following suggestions for a future PR. These aren't a result of the changes in this PR but will be nice to have for this test.
|
This is fine in my opinion. pytest skips the empty tests and it isn't considered an error. I have requested you to remove this logic from the code from my code review which I did earlier. The premounted shares section is for use with Windows clients where we cannot use mount the shares for the client. In such cases, we need to consider pre-mounted locations to run the tests on. In such cases, we will see the opposite where Skipped messages will be seen on tests which expect to perform the cifs_mounts. eg: test_check_mnt_stress(), test_dbm_consistency(), test_check_io_consistency() |
507f7f2
to
dac37c3
Compare
I will take a look on it after this PR id merged. Else there can be a lot of merge conflicts. |
/retest centos-ci/xfs |
321bcd7
to
fd79f63
Compare
With this change, multiple test modules triggered from testcases/mount can be run as individual tests complying to pytest standards. Also any number of new tests can be added efficiently on the mount. Old approach: - All the different tests are called from test_mount.py: https://github.com/samba-in-kubernetes/sit-test-cases/blob/main/testcases/mount/test_mount.py - Test_mount.py creates a mount, the required tests are called and then test_mount.py cleans the mount. New approach : - This PR complies with the proposal to use fixtures in order to remove all the load on one single module: samba-in-kubernetes#25 (comment) samba-in-kubernetes#25 (comment) - The tests are no more called from test_mount.py. - Setting up of mount and tearing down of mount is taken care by setup and teardown fixture which is defined in testcases/mount/conftest.py More information about fixtures: https://docs.pytest.org/en/6.2.x/fixture.html - With this change, test files remain the same, but the initiator function starts with keyword test and the each test module starts with keyword 'test' That way the tests are called by pytest. Usage of setup and teardown fixture becomes easily possible. We no more need to to call the test function explictly. This also helps with easy debugging and better understanding of the code, as the tests will be failed at individual mount/IO test. In this case, pytest clearly points which test among test_mount_io.py, test_mount_dbm.py and test_mount_stress.py are failing. Can be very useful - when more and more tests are added - when we want to parse test results in sit-environment project Fixes: samba-in-kubernetes#30 Signed-off-by: Shwetha K Acharya <[email protected]>
fd79f63
to
d84fe24
Compare
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.
ACK
Confirmed that the CI tests for xfs only fail at smb2.create which is a known failure because of selinux issues. All other tests pass as expected.
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.
lgtm
With this change, multiple test modules triggered from testcases/mount can be run as individual tests complying to pytest standards. Also any number of new tests can be added efficiently on the mount.
Old approach:
https://github.com/samba-in-kubernetes/sit-test-cases/blob/main/testcases/mount/test_mount.py
New approach :
This PR complies with the proposal to use fixtures in order to remove all the load on one single
module:
mount: Add a stress test with multiple clients #25 (comment)
mount: Add a stress test with multiple clients #25 (comment)
The tests are no more called from test_mount.py.
Setting up of mount and tearing down of mount is taken care by setup and teardown fixture
which is defined in testcases/mount/conftest.py
More information about fixtures:
https://docs.pytest.org/en/6.2.x/fixture.html
With this change, test files remain the same, but the initiator function starts with keyword test
and the each test module starts with keyword 'test'
That way the tests are called by pytest.
Usage of setup and teardown fixture becomes easily possible.
We no more need to to call the test function explictly.
This also helps with easy debugging and better understanding of the code, as the tests will be
failed at individual mount/IO test.
In this case, pytest clearly points which test among test_mount_io.py, test_mount_dbm.py
and test_mount_stress.py are failing.
Can be very useful
Fixes: #30