From: Jason Dillaman Date: Tue, 24 Feb 2015 14:25:14 +0000 (-0500) Subject: tests: speed up Python RBD random data generation X-Git-Tag: v0.93~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bd40f23d7db947b83033a85a1385cf29496be517;p=ceph.git tests: speed up Python RBD random data generation The RBD large_write test cases was taking multiple minutes to run under a Fedora 21 VM. Replaced the million+ random number generator calls with a single call to os.urandom. The test now completes within seconds. Signed-off-by: Jason Dillaman --- diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 5d61d5322329..4be09085b5c2 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -1,6 +1,5 @@ # vim: expandtab smarttab shiftwidth=4 softtabstop=4 import functools -import random import socket import struct import os @@ -264,8 +263,7 @@ def test_rename(): eq([image_name], rbd.list(ioctx)) def rand_data(size): - l = [random.Random().getrandbits(64) for _ in xrange(size/8)] - return struct.pack((size/8)*'Q', *l) + return os.urandom(size) def check_stat(info, size, order): assert 'block_name_prefix' in info