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

test: No direct use of nose #45064

Merged
merged 3 commits into from May 11, 2022
Merged

Conversation

s-t-e-v-e-n-k
Copy link
Contributor

@s-t-e-v-e-n-k s-t-e-v-e-n-k commented Feb 17, 2022

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

With nose being firmly deprecated for quite some time, remove use of it from the test suite directly.

Fixes: https://tracker.ceph.com/issues/54252

@tserong
Copy link
Contributor

tserong commented Feb 21, 2022

jenkins test api

@tserong
Copy link
Contributor

tserong commented Mar 29, 2022

(I'm not 100% sure who's best to review this, so, @tchaikov, @cbodley, if you're not those people, are you able to recommend someone else?)

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, will take a closer look tonight.


# Local Variables:
# compile-command: "cd ../../..; cmake --build build --target get_command_descriptions -j4 &&
# CEPH_BIN=build/bin \
# PYTHONPATH=src/pybind nosetests --stop \
# src/test/pybind/test_ceph_argparse.py:TestOSD.test_rm"
# PYTHONPATH=src/pybin python3 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/pybin/pybind/

@cbodley
Copy link
Contributor

cbodley commented Mar 29, 2022

thanks @s-t-e-v-e-n-k, this is great. dropping nose has been on our "TODO someday maybe" list for a long time, so i'm thrilled that you're taking this on

these rgw multisite tests are complicated by the fact that they need to run in two different environments:

  • one from src/test/rgw/test_multi.py to deploy vstart clusters to run against, and
  • one from qa/tasks/rgw_multisite_tests.py to run under the rgw/multisite suite in teuthology

i see that you've covered test_multi.py and the stuff under rgw_multi/ already - have you managed to run that successfully to verify your changes there?

on the teuthology side, we also have some nose-specific logic in the rgw-multisite-tests task. i'm not good with python, so i had a lot of trouble getting this stuff to work. i think i tried using 'pytest' initially, with some guidance from @alfredodeza, but nose was the only thing i could actually get to load and run these test cases. this is further complicated by the need to run test cases from a different suite-branch to support upgrade tests

since this part only runs in teuthology, maybe it's fine to leave the leave the nose stuff in rgw_multisite_tests.py - i'll leave that up to. but we do need to verify that this invocation of nose.run() still works with your changes under src/test/rgw/rgw_multi/ (including the upgrade case that overrides the qa branch)

@mcepl
Copy link

mcepl commented Mar 29, 2022

i see that you've covered test_multi.py and the stuff under rgw_multi/ already - have you managed to run that successfully to verify your changes there?

We are Python people (actually, maintainers of Python packages in openSUSE) so most of what's going on in Ceph goes right above our head. Our primary goal is to eliminate nose from our distribution, so it is all we did.

@cbodley
Copy link
Contributor

cbodley commented Mar 29, 2022

Our primary goal is to eliminate nose from our distribution, so it is all we did.

if your only goal is to drop the package dependency, then you probably don't need to touch these rgw tests at all - they don't get packaged anywhere

@alfredodeza
Copy link
Contributor

My recommendation here would be to prioritize the work to remove nose in Ceph as a whole and work closely with the places there it is still needed to port over to Pytest. This is no longer a matter of preference, but Nose is not viable anymore as an unmaintained project. I anticipated that distributions dropping is going to be one of many problems to come if the Ceph teams decides to keep it around.

@s-t-e-v-e-n-k
Copy link
Contributor Author

You're welcome @cbodley! I've rebased on current master, and corrected the typo that @tchaikov spotted. I have not successfully run the rgw_multi tests, I don't have a suitable test environment to hand, so some help there would be lovely, and I'd be delighted to help look at some test failures caused by my changes. I've also edited qa/tasks/rgw_multisite_tests.py to drop nose, but I'm not certain if my changes are correct there.


return LogStream()
argv = [sys.executable, self.module_path + "../test_multi.py"] + extra_args
testsuite = subprocess.run(argv, check=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think this can work. test_multi.py is creating its own ceph clusters with the vstart.sh script, but this teuthology script is meant to run tests against the clusters that teuthology itself set up

in qa/tasks/rgw_multisite.py, which runs just before this rgw_multisite_tests.py task, we do a lot of work to set up the python environment according to teuthology's deployment, and we pass this information into the python module here

so we need to run the test cases in that same environment - i don't think a subprocess can work here

from rgw_multi.tests import *
from rgw_multi.tests_es import *
from rgw_multi.tests_ps import *
from rgw_multi.tests_az import *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried running this modified test_multi.py by hand (according to docs in https://github.com/ceph/ceph/blob/master/src/test/rgw/test_multi.md), and it isn't finding any of the test cases to run. i believe it's because the tests are no longer imported into this module

~/ceph/build $ cat test_multi.conf 
[DEFAULT]
num_zones = 2
num_ps_zones = 0
num_zonegroups = 1
gateways_per_zone = 1

~/ceph/build $ RGW_MULTI_TEST_CONF=test_multi.conf MON=1 OSD=1 MGR=0 MDS=0 nosetests ../src/test/rgw/test_multi.py

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

@cbodley
Copy link
Contributor

cbodley commented Mar 30, 2022

since these rgw tests are proving to be difficult, we might consider splitting that piece out to another PR? these other changes outside of rgw look a lot easier to verify and merge in the meantime

nose has been unmaintained for a long time, and to work on
removing it as a dependency, re-work test_ceph_argparse to use
bare unittest.

Signed-off-by: Steve Kowalik <steven@wedontsleep.org>
nose has been unmaintained for a long time, and to work on
removing it as a dependency, re-work test_ceph_daemon to use
bare unittest.

Signed-off-by: Steve Kowalik <steven@wedontsleep.org>
With the direct calls of nose methods removed, we no longer need to
BuildRequire it.

Fixes: https://tracker.ceph.com/issues/54252
Signed-off-by: Steve Kowalik <steven@wedontsleep.org>
@s-t-e-v-e-n-k
Copy link
Contributor Author

What a great idea! I've split out the separate rgw test changes, and I'll create a new PR with that commit directly.

@s-t-e-v-e-n-k
Copy link
Contributor Author

rgw has been split out to #45759

@mcepl
Copy link

mcepl commented May 11, 2022

@cbodley ping? I thought after #45064 (comment) and @s-t-e-v-e-n-k 's splitting the this PR, it could get merged. We really need to get rid of nose from our distro, it breaks some of our tools.

@cbodley
Copy link
Contributor

cbodley commented May 11, 2022

@cbodley ping? I thought after #45064 (comment) and @s-t-e-v-e-n-k 's splitting the this PR, it could get merged. We really need to get rid of nose from our distro, it breaks some of our tools.

sorry, i'm only familiar with the rgw parts so assumed someone else would follow up on review here

but given @tchaikov's "LGTM in general", i'd be willing to approve this so long as it doesn't break anything in CI. i pushed this branch to ceph-ci to test the packaging at https://shaman.ceph.com/builds/ceph/pr-45064/

@cbodley
Copy link
Contributor

cbodley commented May 11, 2022

jenkins test make check

@cbodley
Copy link
Contributor

cbodley commented May 11, 2022

'make check' looks good 👍

135/277 Test 149: test_ceph_daemon.py ....................... Passed 0.30 sec
180/277 Test 150: test_ceph_argparse.py ..................... Passed 73.71 sec

waiting on packages to finish building

@cbodley cbodley merged commit f0e30f6 into ceph:master May 11, 2022
@mcepl
Copy link

mcepl commented May 12, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants