gateway: the try a lost ping cut doesn't fail the upload test (#4033)
TestUploadStillUnderwayIsNotCutByHealthPing was red 3 of 3 on WSL (magpie-desktop) at7fe98c2afwith "the vendor reading the body: client disconnected", while the gateway got the vendor's right reply in 4.7s. Cause: the #3909 fix lets the first try be cut by the lost ping, then sends the body again. Both tries reach the vendor (counted on WSL and mote: tries=2 each run). The cut try's handler stays blocked reading, since the paced path never closes its vendor side, until the test's cleanup closes the path. On Linux that read then fails, and the handler's t.Errorf turned the test red. On macOS the abandoned try ends without an error. The test asserted something the fix doesn't promise. The reply's byte count still proves one try read the whole body. What was run at this change on origin/main7fe98c2af: - gofmt -l internal/gateway: nothing; go vet ./internal/gateway/ (mote): ok. - WSL: TestUploadStillUnderwayIsNotCutByHealthPing, TestSlowUplinkSkipsTheLostTry, TestLargeBodyOnSilentConnectionIsSentAgain -count=5: ok (70.6s). Before the change the first was red 3 of 3. - mote: the same three, -race -count=3: ok. Windows (xiaomi-gpu): -count=3: ok. - Broken by hand (the lostPing retry turned off), WSL: the test FAILs in 0.56s with "http2: client connection lost; want the vendor's reply". Rebased ontoe1721d640(a GUI routing change only): the three tests again on WSL -count=3 and mote -count=2: ok.
This commit is contained in:
@@ -112,7 +112,9 @@ func TestUploadStillUnderwayIsNotCutByHealthPing(t *testing.T) {
|
||||
vendor := h2Vendor(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
n, err := io.Copy(io.Discard, r.Body)
|
||||
if err != nil {
|
||||
t.Errorf("the vendor reading the body: %v", err)
|
||||
// the try the lost ping cut, given up for the one sent again;
|
||||
// it ends when the path closes, after the test (#4033)
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(w, "%s %d", r.Proto, n)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user