Skip to content

Commit dd04ba6

Browse files
authored
fix(Segments): Flaky test fails because of unspecified Condition ordering (#8284)
1 parent dc99d65 commit dd04ba6

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

api/app/settings/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,18 +1425,21 @@
14251425
"FEATURE_VALUE_LIMIT must be between 0 and 2,000,000 (2MB)."
14261426
)
14271427

1428+
# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
14281429
SEGMENT_RULES_CONDITIONS_LIMIT = env.int("SEGMENT_RULES_CONDITIONS_LIMIT", 100)
14291430

14301431
# These settings are to handle large datasets / odd behaviour where rules and conditions
14311432
# often aren't returned in the order that they were created in, which the code implicitly
14321433
# expects.
1434+
# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
14331435
SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED = env.bool(
14341436
"SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED", default=False
14351437
)
14361438

14371439
# In SaaS, we need to be able to split out rules and conditions
14381440
# (since the ordering issue has been evident on rules for longer, and
14391441
# only recently happened to conditions).
1442+
# TODO: Delete as per https://github.com/Flagsmith/flagsmith/issues/7818
14401443
SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED = env.bool(
14411444
"SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED",
14421445
default=SEGMENT_RULES_CONDITIONS_EXPLICIT_ORDERING_ENABLED,

api/tests/unit/segments/test_unit_segments_views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,8 +1997,10 @@ def test_update_segment__whitelisted_segment_exceeds_max_conditions__returns_200
19971997
mocker: MockerFixture,
19981998
project: Project,
19991999
segment: Segment,
2000+
settings: SettingsWrapper,
20002001
) -> None:
20012002
# Given
2003+
settings.SEGMENT_CONDITIONS_EXPLICIT_ORDERING_ENABLED = True
20022004
WhitelistedSegment.objects.create(segment=segment)
20032005
timestamp = "2099-01-01T00:00:00Z"
20042006
over_limit_rule: SegmentRuleType = {

0 commit comments

Comments
 (0)