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

qa/tasks/vstart_runner,doc: be compatible with python3 #34636

Merged
merged 4 commits into from Apr 20, 2020

Conversation

tchaikov
Copy link
Contributor

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

as vstart_runner.py is compatible with python3, and so is the tests
under `qa/` directory.

and use `pip` to install teuthology, simpler this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
Copy link
Contributor

@alfonsomthd alfonsomthd left a comment

Choose a reason for hiding this comment

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

Tested locally running run-backend-api-tests.sh: it works.

$ git clone https://github.com/ceph/teuthology
$ cd teuthology/
$ virtualenv -p python2.7 ./venv
$ virtualenv --python=python3 venv
Copy link
Contributor

Choose a reason for hiding this comment

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

@tchaikov For consistency, can you also update this line
https://github.com/ceph/ceph/blob/master/src/pybind/mgr/dashboard/run-backend-api-tests.sh#L44
to sth like:

virtualenv --python=${TEUTHOLOGY_PYTHON_BIN:-/usr/bin/python3} venv

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. updated and repushed.

@tchaikov
Copy link
Contributor Author

jenkins render docs

@lxbsz
Copy link
Member

lxbsz commented Apr 20, 2020

@tchaikov

Run # python3 ../qa/tasks/vstart_runner.py tasks.cephfs.test_volume_client.TestVolumeClient.test_get_authorized_ids failed for me.

I have paste the fixing patch, could you fix it here ?

diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py
index 227d86e..cd05824 100644
--- a/qa/tasks/cephfs/fuse_mount.py
+++ b/qa/tasks/cephfs/fuse_mount.py
@@ -454,9 +454,9 @@ print(find_socket("{client_name}"))
 
         # Query client ID from admin socket
         json_data = self.client_remote.sh(
-            ['sudo', self._prefix + 'ceph', '--admin-daemon', asok_path] + args,
+            ['sudo', self._prefix + 'ceph', '--admin-daemon', asok_path.decode("utf-8")] + args,
             timeout=(15*60))
-        return json.loads(json_data)
+        return json.loads(json_data.decode("utf-8"))
 
     def get_global_id(self):
         """
diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py
index 5dec6a6..c73ba04 100644
--- a/qa/tasks/vstart_runner.py
+++ b/qa/tasks/vstart_runner.py
@@ -390,7 +390,7 @@ class LocalRemote(object):
 
             # Hack: writing to stdin is not deadlock-safe, but it "always" works
             # as long as the input buffer is "small"
-            subproc.stdin.write(stdin)
+            subproc.stdin.write(stdin.encode())
 
         proc = LocalRemoteProcess(
             args, subproc, check_status,

@ceph-jenkins
Copy link
Collaborator

Doc render available at http://docs.ceph.com/ceph-prs/34636/

differentiate `str` and `bytes` instances, and drop python2 support from
vstart_runner.py, as we've moved to python3 already

Signed-off-by: Kefu Chai <kchai@redhat.com>
since vstart_runner.py is now py3, let's use python3 by default

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

@lxbsz instead i am passing StringIO() for capturing stdout.

pass `StringIO()` to capture stdout whose value will be interpreted as a
string later on

Signed-off-by: Kefu Chai <kchai@redhat.com>
Copy link
Member

@lxbsz lxbsz left a comment

Choose a reason for hiding this comment

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

Tested and works for me.

@tchaikov tchaikov merged commit 94e39db into ceph:master Apr 20, 2020
@tchaikov tchaikov deleted the wip-vstart-runner-py3 branch April 20, 2020 13:23
alfonsomthd added a commit to rhcs-dashboard/ceph-dev that referenced this pull request Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants