From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: python3: Fix UUID packing/unpacking on python 3 ......................................................................
Patch Set 9:
(1 comment)
https://gerrit.ovirt.org/#/c/78632/9/tests/storage/misc_test.py File tests/storage/misc_test.py:
Line 459: Test that the uuid that was packed can be unpacked without being Line 460: changed Line 461: """ Line 462: for i in range(1000): Line 463: origUuid = str(uuid.uuid4())
We test here 1000 random uuids, better than small list of random uuids. And
I have nothing against testing 1000 numbers. What I don't like is surprises in tests.
Assume your test fails on a single random uuid on a single CI run by a single developer. Nobody would notice. All they'd see is a fluke -1, and they'd re-trigger the job.
A safe approach is to have a predictable list of number. If we introduce a bug that makes the test fail on one of them, it would keep on failing.
r = random.Random(42) for _ in range(1000): origUiid = str(uuid.UUID(int=r.randint(0, 2**128-1))) ...
it's not terribly important for this simple test, but I think that uncontrolled randomness is a bad practice for testing, and it should be avoided. Line 464: packedUuid = misc.packUuid(origUuid) Line 465: self.assertEqual(misc.unpackUuid(packedUuid), origUuid) Line 466: Line 467:
vdsm-patches@lists.fedorahosted.org