Make streaming refill probe latency-independent

This commit is contained in:
ms2k 2026-08-15 21:51:56 +09:00
commit 30ae88f8a3

View file

@ -199,8 +199,11 @@ verifyThrottle context session directory = do
verifyRefill :: ProbeContext -> Session -> FilePath -> IO ()
verifyRefill context session directory = do
let bodyPath = directory <> "/refill-upload.bin"
refillPath = directory <> "/refill-byte.bin"
writeZeros bodyPath 65536
BS.writeFile refillPath "x"
digest <- hashFile bodyPath
refillDigest <- hashFile refillPath
initial <- curlUploadFileDeclared
context session "refill-initial.bin"
"72000000-0000-4000-8000-000000000001"
@ -215,7 +218,7 @@ verifyRefill context session directory = do
refilled <- curlUploadFileDeclared
context session "refill-refilled.bin"
"72000000-0000-4000-8000-000000000002"
65536 digest bodyPath
1 refillDigest refillPath
requireSucceeded "refilled token bucket" refilled
putStrLn "Token-bucket refill behavior passed"