LR-META-LOCATION: no test starts the GeoNames download

The command sweep ran metadata.downloadPlaceNames with empty params, which
starts a real download from download.geonames.org into the settings folder.
The sweep now skips it (the command has its own loopback-server tests) and
asserts that no place names download was started.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Nathaniel Ledford
2026-10-23 09:43:44 -04:00
co-authored by Claude
parent 23e181283c
commit 63f4a3197d
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());
}