File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
unit_tests/sources/declarative/incremental Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -3449,3 +3449,43 @@ def test_semaphore_cleanup():
34493449 assert '{"id":"2"}' not in cursor ._semaphore_per_partition
34503450 assert len (cursor ._partition_parent_state_map ) == 0 # All parent states should be popped
34513451 assert cursor ._parent_state == {"parent" : {"state" : "state2" }} # Last parent state
3452+
3453+
3454+ def test_given_global_state_when_read_then_state_is_not_per_partition () -> None :
3455+ manifest = deepcopy (SUBSTREAM_MANIFEST )
3456+ manifest ["definitions" ]["post_comments_stream" ]["incremental_sync" ]["global_substream_cursor" ] = True
3457+ record = {
3458+ "id" : 9 ,
3459+ "post_id" : 1 ,
3460+ "updated_at" : COMMENT_10_UPDATED_AT ,
3461+ }
3462+ mock_requests = [
3463+ (
3464+ f"https://api.example.com/community/posts?per_page=100&start_time={ START_DATE } " ,
3465+ {
3466+ "posts" : [
3467+ {"id" : 1 , "updated_at" : POST_1_UPDATED_AT },
3468+ ],
3469+ },
3470+ ),
3471+ # Fetch the first page of comments for post 1
3472+ (
3473+ "https://api.example.com/community/posts/1/comments?per_page=100" ,
3474+ {
3475+ "comments" : [record ],
3476+ },
3477+ ),
3478+ ]
3479+ run_mocked_test (
3480+ mock_requests ,
3481+ manifest ,
3482+ CONFIG ,
3483+ "post_comments" ,
3484+ {},
3485+ [record ],
3486+ {
3487+ "lookback_window" : 1 ,
3488+ "parent_state" : {"posts" : {"updated_at" : "2024-01-30T00:00:00Z" }},
3489+ "state" : {"updated_at" : "2024-01-25T00:00:00Z" }
3490+ }, # this state does have per partition which would be under `states`
3491+ )
You can’t perform that action at this time.
0 commit comments