[Bug 2049502] [NEW] Flaky tests due to relying on default result ordering

Launchpad Bug Tracker 2049502 at bugs.launchpad.net
Tue Jan 16 16:18:37 UTC 2024


You have been subscribed to a public bug by Ubuntu Foundations Team Bug Bot (crichton):

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")).

** Affects: golang-entgo-ent (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: patch
-- 
Flaky tests due to relying on default result ordering
https://bugs.launchpad.net/bugs/2049502
You received this bug notification because you are a member of Ubuntu Sponsors, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list