test: add CDN prefetch tests for 304 responses and snapshot handling
CI / changes (push) Successful in 8s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 29s
CI / docker-web (push) Has been skipped
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 15s
CI / docker-go (push) Successful in 8m32s

- Introduced `TestRefreshModuleIngest_CDN304UsesStoredSnapshot` to verify that the module ingest correctly uses stored snapshots when receiving a 304 Not Modified response.
- Added `TestCollectModulePrefixRows_CDN304RetriesWithoutETag` to ensure that the system retries without the If-None-Match header after a 304 response, and correctly collects prefixes on subsequent successful requests.
- Updated `cachedCDNPrefixRows` function to improve handling of cached prefixes during CDN source processing.
- Modified `RefreshModuleIngest` to utilize prior snapshots when collecting module prefix rows.
This commit is contained in:
Denozordec
2026-05-19 14:26:49 +07:00
parent 765a8052da
commit a536a2d5eb
3 changed files with 133 additions and 4 deletions
+5 -1
View File
@@ -53,7 +53,11 @@ func RefreshModuleIngest(ctx context.Context, st store.Backend, hc *http.Client,
return fmt.Errorf("module disabled")
}
rows, err := collectModulePrefixRows(ctx, st, hc, tenantID, mod, nil)
var prior []store.PrefixRow
if snap, ok, _ := st.GetModulePrefixSnapshot(tenantID, moduleID); ok && snap != nil {
prior = snap.Prefixes
}
rows, err := collectModulePrefixRows(ctx, st, hc, tenantID, mod, prior)
if err != nil {
return err
}