Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/test_mongodb_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,5 +475,4 @@ def test_run(self):
conn_id,
self.expected_sync_streams(),
self.expected_pks())

self.assertDictEqual(record_count_by_stream, self.expected_last_sync_row_counts())
26 changes: 18 additions & 8 deletions tests/test_mongodb_oplog_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,22 @@ def test_run(self):
client["simple_db"]["simple_coll_2"].insert_one({"int_field": 101, "string_field": random_string_generator()})
changed_ids.add(client['simple_db']['simple_coll_2'].find({'int_field': 101})[0]['_id'])

#Running a Sync before the marker 102
sync_job_name = runner.run_sync_mode(self, conn_id)
exit_status = menagerie.get_exit_status(conn_id, sync_job_name)
menagerie.verify_sync_exit_status(self, exit_status, sync_job_name)
# -----------------------------------
# ----------- Subsequent Oplog Sync ---------
# -----------------------------------

# Inserting Marker 102
with get_test_connection() as client:
marker_point = {"int_field": 102, "string_field": "marker_" + random_string_generator()}
result = client["simple_db"]["simple_coll_1"].insert_one(marker_point)
oplog_entry_point = client.local.oplog.rs.find_one({"o._id": result.inserted_id})
marker_ts = oplog_entry_point["ts"]
# Run sync
sync_job_name = runner.run_sync_mode(self, conn_id)

exit_status = menagerie.get_exit_status(conn_id, sync_job_name)
menagerie.verify_sync_exit_status(self, exit_status, sync_job_name)

Expand All @@ -222,12 +231,13 @@ def test_run(self):

final_state = menagerie.get_state(conn_id)

with get_test_connection() as client:
row = client.local.oplog.rs.find_one(sort=[('$natural', pymongo.DESCENDING)])
latest_oplog_ts = row.get('ts')
# with get_test_connection() as client:
# row = client.local.oplog.rs.find_one(sort=[('$natural', pymongo.DESCENDING)])
# latest_oplog_ts = row.get('ts')

self.assertEqual(
(latest_oplog_ts.time, latest_oplog_ts.inc),
(final_state['bookmarks']['simple_db-simple_coll_1']['oplog_ts_time'],
final_state['bookmarks']['simple_db-simple_coll_1']['oplog_ts_inc'])
tap_oplog_bookmark = (
final_state['bookmarks']['simple_db-simple_coll_1']['oplog_ts_time'],
final_state['bookmarks']['simple_db-simple_coll_1']['oplog_ts_inc']
)
marker_tuples = (marker_ts.time, marker_ts.inc)
self.assertGreaterEqual(tap_oplog_bookmark, marker_tuples)