Open matthewelwell opened 6 months ago
I haven't invested any time in looking into this, but it looks like we have a flaky unit test in the LD importer functionality. See example below. This failed in CI but seems to pass every time locally.
https://github.com/Flagsmith/flagsmith/actions/runs/9351281565/job/25736647982
=================================== FAILURES =================================== ________________ test_process_import_request__segments_imported ________________ [gw2] linux -- Python 3.12.3 /home/runner/.cache/pypoetry/virtualenvs/flagsmith-api-h9Rv37Cj-py3.12/bin/python project = <Project: Project Test Project> import_request = <LaunchDarklyImportRequest: LaunchDarklyImportRequest object (9)> def test_process_import_request__segments_imported( project: Project, import_request: LaunchDarklyImportRequest, ): # When process_import_request(import_request) # Then segments = Segment.objects.filter(project=project, feature_id=None) assert set(segments.values_list("name", flat=True)) == { # Segments "User List (Override for test)", "User List (Override for production)", "Dynamic List (Override for test)", "Dynamic List (Override for production)", "Dynamic List 2 (Override for test)", "Dynamic List 2 (Override for production)", } # Tests for "Dynamic List (Override for test)" dynamic_list_test_segment = Segment.objects.get( name="Dynamic List (Override for test)" ) dynamic_list_test_segment_rule = SegmentRule.objects.get( segment=dynamic_list_test_segment ) # Parents are always "ALL" rules. assert dynamic_list_test_segment_rule.type == SegmentRule.ALL_RULE dynamic_list_test_segment_subrules = SegmentRule.objects.filter( rule=dynamic_list_test_segment_rule ) assert dynamic_list_test_segment_subrules.count() == 1 # UI needs to have subrules as `ANY_RULE` to display properly. assert list(dynamic_list_test_segment_subrules)[0].type == SegmentRule.ANY_RULE dynamic_list_test_segment_subrule_conditions = Condition.objects.filter( rule=dynamic_list_test_segment_subrules[0] ) assert set( dynamic_list_test_segment_subrule_conditions.values_list( "property", "operator", "value" ) ) == { ("email", segment_constants.REGEX, ".*@gmail\\.com"), } # Tests for "Dynamic List 2 (Override for production)" dynamic_list_2_production_segment = Segment.objects.get( name="Dynamic List 2 (Override for production)" ) dynamic_list_2_production_segment_rule = SegmentRule.objects.get( segment=dynamic_list_2_production_segment ) # Parents are always "ALL" rules. assert dynamic_list_2_production_segment_rule.type == SegmentRule.ALL_RULE dynamic_list_2_production_segment_subrules = SegmentRule.objects.filter( rule=dynamic_list_2_production_segment_rule ) assert dynamic_list_2_production_segment_subrules.count() == 5 # UI needs to have subrules as `ANY_RULE` to display properly. > assert ( list(dynamic_list_2_production_segment_subrules)[0].type == SegmentRule.ANY_RULE ) E AssertionError: assert 'NONE' == 'ANY' E - ANY E + NONE tests/unit/integrations/launch_darkly/test_services.py:308: AssertionError ---------- coverage: platform linux, python 3.12.3-final-0 ----------- Coverage XML written to file coverage.xml =========================== short test summary info ============================ FAILED tests/unit/integrations/launch_darkly/test_services.py::test_process_import_request__segments_imported - AssertionError: assert 'NONE' == 'ANY' - ANY + NONE
Closed as we haven't seen any further occurrences of this.
Coincidentally, I think we saw another occurrence of this today, here.
I haven't invested any time in looking into this, but it looks like we have a flaky unit test in the LD importer functionality. See example below. This failed in CI but seems to pass every time locally.
https://github.com/Flagsmith/flagsmith/actions/runs/9351281565/job/25736647982