@pytest.fixture
def index_mock(monkeypatch, tokenizer_mock, init_status):
mock = MockParamCapture()
- monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_boundaries', mock)
- monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_by_rank', mock)
+ monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_full', mock)
return mock
assert str(update_mock.last_args[1]['osm2pgsql']) == '/secret/osm2pgsql'
+ @pytest.mark.parametrize("update_interval", [60, 3600])
+ def test_replication_catchup(self, monkeypatch, index_mock, update_interval, placex_table):
+ monkeypatch.setenv('NOMINATIM_REPLICATION_UPDATE_INTERVAL', str(update_interval))
+ states = [nominatim.tools.replication.UpdateState.NO_CHANGES]
+ monkeypatch.setattr(nominatim.tools.replication, 'update',
+ lambda *args, **kwargs: states.pop())
+
+ assert self.call_nominatim('--catch-up') == 0
+
+
def test_replication_update_custom_threads(self, update_mock):
assert self.call_nominatim('--once', '--no-index', '--threads', '4') == 0
with pytest.raises(IndexError):
self.call_nominatim()
- assert index_mock.called == 4
+ assert index_mock.called == 2
def test_replication_update_continuous_no_change(self, monkeypatch, index_mock):
with pytest.raises(IndexError):
self.call_nominatim()
- assert index_mock.called == 2
+ assert index_mock.called == 1
assert sleep_mock.called == 1
assert sleep_mock.last_args[0] == 60