k8s-operator/sessionrecording/spdy: remove dead error check in test helper (#22728)

The err check after writeHeaderValueBlock in payload could never fire.
It tested the error from zlib.NewWriterLevelDict, which payload already
checks, and writeHeaderValueBlock calls t.Fatalf itself on a write
error. The nilness analyser in go vet flags it as an impossible
condition.

Remove the len(headerM) guard too, because payload returns early when
headerM is empty, and check the error from w.Flush, which was ignored.

Updates #22652

Change-Id: I23ec131d88a599b37364706dd2226f1456574461

Signed-off-by: David Bond <[email protected]>
This commit is contained in:
David Bond authored and GitHub committed 2026-11-30 13:26:38 +00:00
1 parent af75ded1cd
commit 2bebbebc9b
1 file changed
+3 -6
@@ -451,13 +451,10 @@ func payload(t *testing.T, headerM map[string]string, typ ControlFrameType, stre
if err != nil {
t.Fatalf("error creating new zlib writer: %v", err)
}
if len(headerM) != 0 {
writeHeaderValueBlock(t, w, headerM)
writeHeaderValueBlock(t, w, headerM)
if err := w.Flush(); err != nil {
t.Fatalf("error flushing zlib writer: %v", err)
}
if err != nil {
t.Fatalf("error writing headers: %v", err)
}
w.Flush()
return buf.Bytes()
}