1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

fix: flaky tests on segments order (#2472)

## About the changes
This test fails randomly, example:
https://github.com/Unleash/unleash/actions/runs/3496006349/jobs/5853415518#step:5:376

It's not so frequent but I tested locally one out of 4 or 8 runs fails
because the rows returned are in the wrong order.

## Discussion points
If the order of segments is relevant, we should look into how we're
fetching them or applying a `sort()` before returning from the query.
I've validated on my machine that even if the segments are sent in
order, when pulled from the db sometimes they are processed in a
different order
This commit is contained in:
Gastón Fournier 2022-11-21 14:39:15 +01:00 committed by GitHub
parent b39f6a2f0d
commit 97372cf48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2703,7 +2703,7 @@ test.only('should add multiple segments to a strategy', async () => {
(strat) => strat.id === strategyOne.id,
);
expect(strategy.segments).toEqual([
expect(strategy.segments.sort()).toEqual([
segment.id,
segmentTwo.id,
segmentThree.id,