This commit is contained in:
Brandon Thomas
2026-10-23 17:21:16 -04:00
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -63,6 +63,13 @@ impl PlaceNames {
self.lock().running
}
/// Whether a place names download has been started in this session (running, or ended).
#[cfg(test)]
pub(crate) fn download_started(&self) -> bool {
let sh = self.lock();
sh.running || sh.last.is_some()
}
/// The gazetteer in `dir`, parsed once and re-read only when the cities file's size or time changes.
fn load(&mut self, dir: &Path) -> std::result::Result<Arc<GeoNames>, lightcraft_geocode::GeocodeError> {
let file = dir.join(GEONAMES_FILES[0]);
+6
View File
@@ -452,8 +452,14 @@ fn command_sweep() {
for c in command_specs() {
assert!(ids.insert(c.id), "duplicate {}", c.id);
assert!(!c.label.is_empty() && !c.params.is_empty(), "{}", c.id);
// empty params make this one download from download.geonames.org into the real settings folder; its own tests run it against a loopback server
if c.id == "metadata.downloadPlaceNames" {
continue;
}
let _ = s.execute(c.id, &Value::Null);
}
// empty params must never start a download from the internet
assert!(!s.place_names.download_started(), "the sweep started a place names download");
assert!(s.commands().len() >= 70, "{}", s.commands().len());
}