Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package python-uhashring [ Reason ] Fixes non-deterministic FTBFS. [ Impact ] No much impact for users, but fixes Debian CI. [ Tests ] The patch fixes non-deterministic FTBFS during tests. [ Risks ] Not much risks for end users, as the only modified thingy is a single test. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing unblock python-uhashring/2.1-2
diff -Nru python-uhashring-2.1/debian/changelog python-uhashring-2.1/debian/changelog --- python-uhashring-2.1/debian/changelog 2021-09-30 15:36:45.000000000 +0200 +++ python-uhashring-2.1/debian/changelog 2023-04-03 08:17:43.000000000 +0200 @@ -1,3 +1,9 @@ +python-uhashring (2.1-3) unstable; urgency=medium + + * Add Fix-test_distribution-to-be-deterministic.patch (Closes: #1033426). + + -- Thomas Goirand <z...@debian.org> Mon, 03 Apr 2023 08:17:43 +0200 + python-uhashring (2.1-2) unstable; urgency=medium * Uploading to unstable. diff -Nru python-uhashring-2.1/debian/patches/Fix-test_distribution-to-be-deterministic.patch python-uhashring-2.1/debian/patches/Fix-test_distribution-to-be-deterministic.patch --- python-uhashring-2.1/debian/patches/Fix-test_distribution-to-be-deterministic.patch 1970-01-01 01:00:00.000000000 +0100 +++ python-uhashring-2.1/debian/patches/Fix-test_distribution-to-be-deterministic.patch 2023-04-03 08:17:43.000000000 +0200 @@ -0,0 +1,32 @@ +Description: Fix test_distribution to be deterministic + using randint causes a failure roughly once every 10000 runs +Author: Ben Hockley <b...@pexip.com> +Date: Mon, 12 Sep 2022 17:04:24 +0100 +Origin: upstream, https://github.com/ultrabug/uhashring/commit/9218c291e617ee8d2dfa3ad55c84794ea752c642.patch +Bug-Debian: https://bugs.debian.org/1033426 +Last-Update: 2023-04-05 + +diff --git a/tests/test_distribution.py b/tests/test_distribution.py +index 00669e4..76567a0 100644 +--- a/tests/test_distribution.py ++++ b/tests/test_distribution.py +@@ -6,6 +6,7 @@ + from collections import Counter + from math import sqrt + from random import randint ++from itertools import cycle + + from uhashring import HashRing + +@@ -25,9 +26,10 @@ def test_distribution(): + for i in range(1, numnodes + 1): + ring["node{}".format(i)] = {"instance": "node_value{}".format(i)} + ++ deterministic_input = cycle(range(1, numvalues)) + distribution = Counter() + for i in range(numhits): +- key = str(randint(1, numvalues)) ++ key = str(next(deterministic_input)) + node = ring[key] + distribution[node] += 1 + diff -Nru python-uhashring-2.1/debian/patches/series python-uhashring-2.1/debian/patches/series --- python-uhashring-2.1/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ python-uhashring-2.1/debian/patches/series 2023-04-03 08:17:43.000000000 +0200 @@ -0,0 +1 @@ +Fix-test_distribution-to-be-deterministic.patch