Skip to content

Commit 0611eff

Browse files
committed
chg: [tests] account for the publish_timestamp not being set on events/add time
1 parent 6dfd9bf commit 0611eff

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/testlive_comprehensive.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,14 @@ def test_search_publish_timestamp(self) -> None:
688688
# we need to sleep here as per 2.5.40 we've moved the publish timestamp setting to the background process instead of front loading it.
689689
# The default tick rate of the background worker is 5s so 10 seconds should be safe-ish. (assuming no other fuck-ups)
690690
time.sleep(10)
691-
691+
692+
# The add_event response no longer carries the publish_timestamp (it is now set by the background
693+
# publish job, not synchronously), so the events fetched above still hold publish_timestamp == 0,
694+
# which pythonify leaves as a plain int rather than a datetime. Re-fetch them now that the worker
695+
# has published so publish_timestamp is populated as a datetime for the .timestamp() calls below.
696+
first = self.pub_misp_connector.get_event(first, pythonify=True)
697+
second = self.pub_misp_connector.get_event(second, pythonify=True)
698+
692699
# Test 5 sec before timestamp of 2nd event
693700
events = self.pub_misp_connector.search(publish_timestamp=(second.publish_timestamp.timestamp()), pythonify=True)
694701
self.assertEqual(len(events), 1)

0 commit comments

Comments
 (0)