Test that idle host semaphores and .meta files are removed

New tests, failing before the fix: fetches from many hosts, and fetches
that end without a connection, must leave no semaphore in hostSems once
they finish; VariantStorage.Delete must remove the variant's .meta file,
and must succeed when that file is already missing.

Model: opus-5-5
This commit is contained in:
2026-10-04 04:58:26 +00:00
parent 3a274aaa44
commit f2384bc849
3 changed files with 157 additions and 0 deletions
@@ -194,6 +194,14 @@ func semLen(f *HTTPFetcher, host string) int {
return len(f.getHostSemaphore(host))
}
// hostSemCount reports how many hosts have a semaphore in hostSems.
func hostSemCount(f *HTTPFetcher) int {
f.hostSemMu.Lock()
defer f.hostSemMu.Unlock()
return len(f.hostSems)
}
func TestFetchRedirectToPrivateIPBlocked(t *testing.T) {
t.Parallel()