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

octopus: mgr/dashboard: fix API tests to be py3 compatible #34759

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

callithea
Copy link
Member

@callithea callithea commented Apr 27, 2020

backport trackers:


backport of #34752
parent trackers:

this backport was staged using ceph-backport.sh version 15.1.1.389
find the latest version at https://github.com/ceph/ceph/blob/master/src/script/ceph-backport.sh

@callithea callithea requested a review from a team as a code owner April 27, 2020 08:39
@callithea callithea added this to the octopus milestone Apr 27, 2020
@callithea
Copy link
Member Author

jenkins test dashboard backend

@callithea
Copy link
Member Author

backend API test failure:

2020-04-27 10:22:43,247.247 INFO:__main__:test_selftest_cluster_log (tasks.mgr.test_module_selftest.TestModuleSelftest) ... ERROR
2020-04-27 10:22:43,247.247 INFO:__main__:Running ['./bin/ceph', 'log', 'Ended test tasks.mgr.test_module_selftest.TestModuleSelftest.test_selftest_cluster_log']
2020-04-27 10:22:44,159.159 INFO:__main__:Stopped test: test_selftest_cluster_log (tasks.mgr.test_module_selftest.TestModuleSelftest) in 24.059607s
2020-04-27 10:22:44,160.160 INFO:__main__:
2020-04-27 10:22:44,160.160 INFO:__main__:======================================================================
2020-04-27 10:22:44,160.160 INFO:__main__:ERROR: test_selftest_cluster_log (tasks.mgr.test_module_selftest.TestModuleSelftest)
2020-04-27 10:22:44,160.160 INFO:__main__:----------------------------------------------------------------------
2020-04-27 10:22:44,160.160 INFO:__main__:Traceback (most recent call last):
2020-04-27 10:22:44,160.160 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-dashboard-pr-backend/qa/tasks/mgr/test_module_selftest.py", line 317, in test_selftest_cluster_log
2020-04-27 10:22:44,160.160 INFO:__main__:    with self.assert_cluster_log(log_message):
2020-04-27 10:22:44,161.161 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-dashboard-pr-backend/qa/tasks/ceph_test_case.py", line 106, in __enter__
2020-04-27 10:22:44,161.161 INFO:__main__:    self.watcher_process = ceph_manager.run_ceph_w(watch_channel)
2020-04-27 10:22:44,161.161 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 938, in run_ceph_w
2020-04-27 10:22:44,161.161 INFO:__main__:    proc = self.controller.run(args=args, wait=False, stdout=StringIO())
2020-04-27 10:22:44,161.161 INFO:__main__:NameError: global name 'StringIO' is not defined
2020-04-27 10:22:44,161.161 INFO:__main__:
2020-04-27 10:22:44,161.161 INFO:__main__:----------------------------------------------------------------------
2020-04-27 10:22:44,161.161 INFO:__main__:Ran 266 tests in 3186.666s
2020-04-27 10:22:44,162.162 INFO:__main__:
2020-04-27 10:22:44,162.162 INFO:__main__:FAILED (errors=1)
2020-04-27 10:22:44,162.162 INFO:__main__:
2020-04-27 10:22:44,162.162 INFO:__main__:======================================================================
2020-04-27 10:22:44,162.162 INFO:__main__:ERROR: test_selftest_cluster_log (tasks.mgr.test_module_selftest.TestModuleSelftest)
2020-04-27 10:22:44,162.162 INFO:__main__:----------------------------------------------------------------------
2020-04-27 10:22:44,162.162 INFO:__main__:Traceback (most recent call last):
2020-04-27 10:22:44,163.163 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-dashboard-pr-backend/qa/tasks/mgr/test_module_selftest.py", line 317, in test_selftest_cluster_log
2020-04-27 10:22:44,163.163 INFO:__main__:    with self.assert_cluster_log(log_message):
2020-04-27 10:22:44,163.163 INFO:__main__:  File "/home/jenkins-build/build/workspace/ceph-dashboard-pr-backend/qa/tasks/ceph_test_case.py", line 106, in __enter__
2020-04-27 10:22:44,163.163 INFO:__main__:    self.watcher_process = ceph_manager.run_ceph_w(watch_channel)
2020-04-27 10:22:44,163.163 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 938, in run_ceph_w
2020-04-27 10:22:44,163.163 INFO:__main__:    proc = self.controller.run(args=args, wait=False, stdout=StringIO())
2020-04-27 10:22:44,163.163 INFO:__main__:NameError: global name 'StringIO' is not defined

@@ -935,7 +935,7 @@ def run_ceph_w(self, watch_channel=None):
if watch_channel is not None:
args.append("--watch-channel")
args.append(watch_channel)
proc = self.controller.run(args=args, wait=False, stdout=BytesIO())
proc = self.controller.run(args=args, wait=False, stdout=StringIO())
Copy link
Contributor

Choose a reason for hiding this comment

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

ahh, should add from six import StringIO at the top of this file.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tchaikov is it six or io, just asking because for BytesIO it's from io import BytesIO in the vstart_runner.py version of octopus.

Copy link
Contributor

@tchaikov tchaikov Apr 27, 2020

Choose a reason for hiding this comment

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

six.

because before using python3 for driving the octopus tests, we should be python2 compatible, but io.StringIO in python2 expects unicode, while StringIO.StringIO in python2 expects str. i don't want to investigate if any of vstart_runner's consumer would be annoyed at seeing unicode on Python2, so a safe bet would be six.StringIO which is an alias of StringIO.StringIO on python2 and io.StringIO on python3. but if you are sure about this, io.StringIO is the way to go.

but we don't have this issue when it comes to BytesIO .

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the detailed explanation, @tchaikov!

Copy link
Member Author

@callithea callithea Apr 28, 2020

Choose a reason for hiding this comment

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

As discussed offline with @tchaikov I added the missing import from six import StringIO - I added it to the backport commit which uses StringIO with an explanation why this change can not be cherry-picked from master.

@callithea
Copy link
Member Author

jenkins test dashboard backend

@callithea
Copy link
Member Author

jenkins test dashboard backend

alfonsomthd and others added 2 commits April 28, 2020 09:21
* test_perf_counters_mgr_get
* test_selftest_cluster_log

Fixes: https://tracker.ceph.com/issues/45170
Fixes: https://tracker.ceph.com/issues/45246
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
(cherry picked from commit 0ac2964)
to be consistent with 8bfe977

Fixes: https://tracker.ceph.com/issues/45246
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 2de78c3)

qa/tasks: Add missing StringIO import

This is directly fixed in octopus since it's needed
to get the dashboard backend API tests running
based on the previous commits of this PR.
There is a fix in master but this one
uses "from io import StringIO" while
we still need to be python2 compatible in octopus.
So this import is done with "six" (expects str in python2
instead of "io" (expects unicode
in python2).

This import line is not cherry-picked from master
due to the above mentioned reasons.

Signed-off-by: Laura Paduano <lpaduano@suse.com>
@callithea
Copy link
Member Author

jenkins test dashboard backend

@callithea
Copy link
Member Author

jenkins test dashboard

@callithea
Copy link
Member Author

callithea commented Apr 28, 2020

  • pkg build
  • QA run [3 failed / 6 passed]
    The failures are not related to the PR.

Failure Reason:
cannot install the best update candidate for package [...]

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

Successfully merging this pull request may close these issues.

6 participants