@@ -163,6 +163,41 @@ def test_valid_from_snapshot(self, prepare_nrtm4_test, caplog):
163163 assert "import of snapshot at version 3" in caplog .text
164164 assert "Updating from deltas, starting from version 4" in caplog .text
165165
166+ def test_valid_from_snapshot_deferring_deltas (self , prepare_nrtm4_test , caplog ):
167+ # #1087
168+ mock_dh = MockDatabaseHandler ()
169+ mock_dh .reset_mock ()
170+ mock_dh .query_responses [DatabaseStatusQuery ] = iter (
171+ [
172+ {
173+ "force_reload" : True ,
174+ "nrtm4_client_session_id" : UUID (MOCK_SESSION_ID ),
175+ "nrtm4_client_version" : 2 ,
176+ "nrtm4_client_current_key" : None ,
177+ "nrtm4_client_next_key" : None ,
178+ "nrtm4_client_previous_file_hashes" : None ,
179+ }
180+ ]
181+ )
182+ NRTM4Client ("TEST" , mock_dh ).run_client ()
183+ assert "import of snapshot at version 3" in caplog .text
184+ assert "Loaded snapshot at version 3, deferring deltas to next run" in caplog .text
185+ assert "Updating from deltas" not in caplog .text
186+ assert "delete_rpsl_object" not in {call [0 ] for call in mock_dh .other_calls }
187+ assert (
188+ "record_nrtm4_client_status" ,
189+ {
190+ "source" : "TEST" ,
191+ "status" : NRTM4ClientDatabaseStatus (
192+ session_id = UUID (MOCK_SESSION_ID ),
193+ version = 3 ,
194+ current_key = MOCK_UNF_PUBLIC_KEY ,
195+ next_key = MOCK_UNF_PUBLIC_KEY_OTHER ,
196+ previous_file_hashes = VALID_PREVIOUS_FILE_HASHES ,
197+ ),
198+ },
199+ ) in mock_dh .other_calls
200+
166201 def test_valid_from_delta (self , prepare_nrtm4_test , caplog ):
167202 mock_dh = MockDatabaseHandler ()
168203 mock_dh .reset_mock ()
0 commit comments