Skip to content

Commit

Permalink
Fix wrong call to serialize frame
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares committed Dec 11, 2024
1 parent 1b35e2b commit 991f309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rqd/rqd/rqcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def backupCache(self):
return
with open(self.backup_cache_path, "wb") as f:
for item in list(self.__cache.values()):
serialized = item.SerializeToString()
serialized = item.runFrame.SerializeToString()
f.write(len(serialized).to_bytes(4, byteorder="big"))
f.write(serialized)

Expand Down
10 changes: 6 additions & 4 deletions rqd/tests/rqcore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,10 @@ def test_backupCache_withPath(self, mockOpen):
"""Test backupCache writes frame data when backup path is configured"""
self.rqcore.backup_cache_path = '/tmp/rqd/cache.dat'
frameId = 'frame123'
runFrame = mock.MagicMock()
runFrame.SerializeToString.return_value = b'serialized_frame_data'
self.rqcore.storeFrame(frameId, runFrame)
runningFrame = mock.MagicMock()
runningFrame.runFrame = mock.MagicMock()
runningFrame.runFrame.SerializeToString.return_value = b'serialized_frame_data'
self.rqcore.storeFrame(frameId, runningFrame)

self.rqcore.backupCache()

Expand Down Expand Up @@ -663,7 +664,8 @@ def test_recoverCache_validBackup(self):
frame_id = frameId,
frame_name = "frame_name"
)
self.rqcore.storeFrame(frameId, frame)
running_frame = rqd.rqnetwork.RunningFrame(self.rqcore, frame)
self.rqcore.storeFrame(frameId, running_frame)
self.rqcore.backupCache()
self.__cache = {}
self.rqcore.recoverCache()
Expand Down

0 comments on commit 991f309

Please sign in to comment.