#1060915 golang-entgo-ent: Flaky tests due to relying on default result ordering

#1060915#5
Date:
2024-01-16 13:34:39 UTC
From:
To:
Dear Maintainer,

A test of the golang test suite of ent is sometimes failing because the results fetched from the database are not sorted as expected.

681s === RUN   Example_M2M2Types
681s --- FAIL: Example_M2M2Types (0.00s)
681s got:
681s [Group(id=2, name=GitLab) Group(id=1, name=GitHub)]
681s [Group(id=1, name=GitHub)]
681s [User(id=1, age=30, name=a8m) User(id=2, age=28, name=nati)]
681s want:
681s [Group(id=1, name=GitHub) Group(id=2, name=GitLab)]
681s [Group(id=1, name=GitHub)]
681s [User(id=1, age=30, name=a8m) User(id=2, age=28, name=nati)]

By default sqlite does not guaranty results ordering but this can go unnoticed on simple cases. I suspect some race condition somewhere is triggering the bug and the 2 results are swapped.

To make it reliable we need to explicitly call .Order(ent.Asc("id")).

#1060915#10
Date:
2024-01-16 13:49:27 UTC
From:
To:
Here is a patch to fix the issue.
#1060915#21
Date:
2024-03-14 03:51:13 UTC
From:
To:
Hi Paul,

Paul Mars <paul.mars@canonical.com> (2024-01-16):

Sorry, I didn't spot this bug report right away (its metadata got
adjusted along the way). Thanks for the bug report and the patch,
on their way to unstable!


Cheers,

#1060915#26
Date:
2024-03-14 04:06:18 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
golang-entgo-ent, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1060915@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Cyril Brulebois <cyril@debamax.com> (supplier of updated golang-entgo-ent package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 14 Mar 2024 04:46:38 +0100
Source: golang-entgo-ent
Architecture: source
Version: 0.11.3-5
Distribution: unstable
Urgency: medium
Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>
Changed-By: Cyril Brulebois <cyril@debamax.com>
Closes: 1060915
Changes:
 golang-entgo-ent (0.11.3-5) unstable; urgency=medium
 .
   [ Paul Mars ]
   * Add patch to avoid test failures due to different SQLite result
     ordering (Closes: #1060915, LP: #2049502):
      - 0005-force-result-ordering-in-tests.patch
Checksums-Sha1:
 86a28403a38d687351fd2444371a519c5b0b04aa 2746 golang-entgo-ent_0.11.3-5.dsc
 af839f4b0615196bd08263da4d1d598fada235a9 7272 golang-entgo-ent_0.11.3-5.debian.tar.xz
 88c3598aaf6274f2e222967c2cd47903fb89f5ee 7710 golang-entgo-ent_0.11.3-5_source.buildinfo
Checksums-Sha256:
 ca98c1681e2b1faa66780c1fa9bf286c9f36f08df7e575b7bff7a99756797e80 2746 golang-entgo-ent_0.11.3-5.dsc
 387b767754e48319ff2499abf43e020375b14ceac5f2efa1ac80101237b58e56 7272 golang-entgo-ent_0.11.3-5.debian.tar.xz
 d520981dee2c798092b0d6ac94c6f3ffb0b895d02874888c2d7f01bff81fcf3a 7710 golang-entgo-ent_0.11.3-5_source.buildinfo
Files:
 f60d8060feeb048899c136d9ad90c48b 2746 golang optional golang-entgo-ent_0.11.3-5.dsc
 5d0f2541904fdd175006c59fdeacc97f 7272 golang optional golang-entgo-ent_0.11.3-5.debian.tar.xz
 2efae20d6de4cf9f44820fb9b8f45baf 7710 golang optional golang-entgo-ent_0.11.3-5_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEEtg6/KYRFPHDXTPR4/5FK8MKzVSAFAmXydFsQHGtpYmlAZGVi
aWFuLm9yZwAKCRD/kUrwwrNVIAx5EACqdNaWm6DaAZkK5y32gBvn6ivwy9dn9Ofb
GfWQRmzq2aeXgIpLs0f0RH/RDva5XtC4e26N1VugQVcvMSfApfvFSi8Gkp0QhqZ8
aPvYFQTYIwUrVgotEJ+LnHIUEoJNlLJy4AH3IfXYqVWzApGrsFMHijQjfd4y8yS/
pLkdSKnst+muPWmHCGgCwjfu2N3eehJkx6uKUXfiq34ByU0oGuPQD4axHe7zRWJb
nwL8v+/IP/dHRBh0zC61BuOZ3tRwd3xDfrGXqv3LmbqmD3zO8xOTRuPOYwE3SQdZ
nEyxgIcAfy3LkNeLqAz/CpNj9ltmIGW0JkUag5pVZbyPAp0cUG4e71zpi2elpy6i
fokdts/jg7hk1ZZC2bh2GAG+VmxYNQSYugXH5u/9x6iDIUMefoh0e9do9o6qXOy5
gpqapjq0Uud6qaIimE9y4sSEOxeghXvbxu0ci/7YSaaDVSgrp0f+dbgAJvPvXwcq
u/eRGK8h10hHlfKzfUu2keHeQj35G2fco1OrK2xgaYHcokp8HlCpPgeTkp7Ucn3j
bTRNI+JixyIajM38Icdt+wQqt9+wS/SHDhRoMNYMPaUqUFKJnIN+/fNGZO4Th6AJ
jbd105hkgVbKO+hKa4zsDqsrIPDyB6i9T2lMJ6CcjiSWjeaR1/4a4jZfhIk+Ryuf
lctwpzpSAQ==
=+MRf
-----END PGP SIGNATURE-----