Flaky tests due to relying on default result ordering
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
golang-entgo-ent (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
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(
description: | updated |
description: | updated |
PPA build: https:/ /launchpad. net/~upils/ +archive/ ubuntu/ test-ppa/ +build/ 27648425