mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 00:51:28 +02:00
TestPriceChangeUpdatesRecordedCost drives requests in a loop until one is priced at the new rate, because the price push and the proxy's chain rebuild are async. The loop could not actually retry: it looked the row up through findAccessLogBySession, which fails the test outright when no row lands within 30s, so the first post-update request that produced no row ended the run instead of yielding to the next attempt. That is the observed failure — the nightly run has been red on this test roughly half the time, always with "session id ...-reprice-b-... must be recorded in an access-log row" after ~41s: container setup, one request, one 30s wait, dead. A missing row there is expected rather than exceptional. The provider update rebuilds the middleware chain, and a request served mid-rebuild can complete without a resolved provider: 200 to the caller, nothing to attribute, so no row is ever written for it. Split the polling helper into a non-fatal lookup and keep the fail-fast wrapper for callers whose row must exist, then treat a miss in the loop like any other not-yet-repriced iteration. Only the outer deadline is fatal. Shorten the per-attempt wait to 20s and raise the overall deadline to 180s so several attempts fit where before the budget allowed barely one.