]> git.openstreetmap.org Git - nominatim.git/commitdiff
always return 0 for updates unless there is an error
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 11 Feb 2021 09:01:31 +0000 (10:01 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 11 Feb 2021 09:33:49 +0000 (10:33 +0100)
This is more in line with previous behavioru than returning
a status code when no updates are available.

nominatim/clicmd/replication.py
test/python/test_cli.py

index 4852c8b1390a45382c70fe79645037f707dbb523..2a19e6cdad8c74c594be404bb9507c119187eaaa 100644 (file)
@@ -154,8 +154,6 @@ class UpdateReplication:
                 LOG.warning("No new changes. Sleeping for %d sec.", recheck_interval)
                 time.sleep(recheck_interval)
 
-        return state.value
-
 
     @staticmethod
     def run(args):
@@ -167,4 +165,5 @@ class UpdateReplication:
         if args.check_for_updates:
             return UpdateReplication._check_for_updates(args)
 
-        return UpdateReplication._update(args)
+        UpdateReplication._update(args)
+        return 0
index a8efd35670e63e0cc2744a2da097bd7db13f55f3..0c0a689e28b9f99a5897332babd711d9f7cacfa5 100644 (file)
@@ -186,17 +186,15 @@ def test_replication_update_bad_interval_for_geofabrik(monkeypatch, temp_db):
     assert call_nominatim('replication') == 1
 
 
-@pytest.mark.parametrize("state, retval", [
-                         (nominatim.tools.replication.UpdateState.UP_TO_DATE, 0),
-                         (nominatim.tools.replication.UpdateState.NO_CHANGES, 3)
-                         ])
+@pytest.mark.parametrize("state", [nominatim.tools.replication.UpdateState.UP_TO_DATE,
+                                   nominatim.tools.replication.UpdateState.NO_CHANGES])
 def test_replication_update_once_no_index(monkeypatch, temp_db, temp_db_conn,
-                                          status_table, state, retval):
+                                          status_table, state):
     status.set_status(temp_db_conn, date=dt.datetime.now(dt.timezone.utc), seq=1)
     func_mock = MockParamCapture(retval=state)
     monkeypatch.setattr(nominatim.tools.replication, 'update', func_mock)
 
-    assert retval == call_nominatim('replication', '--once', '--no-index')
+    assert 0 == call_nominatim('replication', '--once', '--no-index')
 
 
 def test_replication_update_continuous(monkeypatch, temp_db_conn, status_table):