def test_v2_versioning_carries_existing_segment_overrides_across(
    environment: int,
    environment_api_key: str,
    admin_client: "APIClient",
    segment: int,
    feature: int,
    feature_segment: int,
    segment_featurestate: int,
) -> None:
    """
    This is a specific test to reproduce an issue found in testing where, after
    enabling v2 versioning, feature segments were not being returned via the
    API.
    """
    # Given
    feature_segments_list_url = "%s?feature=%d&environment=%d" % (
        reverse("api-v1:features:feature-segment-list"),
        feature,
        environment,
    )

    # Firstly, let's check the response to the feature segments list endpoint
    # before we enable v2 versioning.
    feature_segment_list_pre_migrate_response = admin_client.get(
        feature_segments_list_url
    )
    feature_segments_list_response_pre_migrate_json = (
        feature_segment_list_pre_migrate_response.json()
    )
    assert feature_segments_list_response_pre_migrate_json["count"] == 1
    assert (
        feature_segments_list_response_pre_migrate_json["results"][0]["id"]
        == feature_segment
    )

    # Now, let's enable v2 versioning.
    enable_v2_versioning_url = reverse(
        "api-v1:environments:environment-enable-v2-versioning",
        args=[environment_api_key],
    )
    assert (
        admin_client.post(enable_v2_versioning_url).status_code
        == status.HTTP_202_ACCEPTED
    )

    # and let's check the response to the feature segments endpoint after enabling v2 versioning
    feature_segment_list_post_migrate_response = admin_client.get(
        feature_segments_list_url
    )
    feature_segment_list_post_migrate_response_json = (
        feature_segment_list_post_migrate_response.json()
    )
    assert feature_segment_list_post_migrate_response_json["count"] == 1
    assert (
        feature_segment_list_post_migrate_response_json["results"][0]["id"]
        == feature_segment
    )

    This is a specific test to reproduce an issue found in testing where, after
    enabling v2 versioning, feature segments were not being returned via the
    API.
    
api/tests/integration/features/versioning/test_integration_v2_versioning.py