@@ -825,14 +825,11 @@ func (s *USMHTTP2Suite) TestHTTP2KernelTelemetry() {
825
825
},
826
826
827
827
expectedTelemetry : & usmhttp2.HTTP2Telemetry {
828
- Request_seen : 8 ,
829
- Response_seen : 8 ,
830
- End_of_stream : 16 ,
831
- End_of_stream_rst : 0 ,
832
- Path_exceeds_frame : 0 ,
833
- Exceeding_max_interesting_frames : 0 ,
834
- Exceeding_max_frames_to_filter : 0 ,
835
- Path_size_bucket : [8 ]uint64 {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 },
828
+ Request_seen : 8 ,
829
+ Response_seen : 8 ,
830
+ End_of_stream : 16 ,
831
+ End_of_stream_rst : 0 ,
832
+ Path_size_bucket : [8 ]uint64 {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 },
836
833
},
837
834
},
838
835
}
@@ -845,11 +842,22 @@ func (s *USMHTTP2Suite) TestHTTP2KernelTelemetry() {
845
842
846
843
tt .runClients (t , 1 )
847
844
845
+ // We cannot predict if the client will send an RST frame or not, thus we cannot predict the number of
846
+ // frames with EOS or RST frames, which leads into a flaking test. Therefore, we are asserting that the
847
+ // gotten number of EOS or RST frames is at least the number of expected EOS frames.
848
+ expectedEOSOrRST := tt .expectedTelemetry .End_of_stream + tt .expectedTelemetry .End_of_stream_rst
848
849
var telemetry * usmhttp2.HTTP2Telemetry
849
850
assert .Eventually (t , func () bool {
850
851
telemetry , err = usmhttp2 .Spec .Instance .(* usmhttp2.Protocol ).GetHTTP2KernelTelemetry ()
851
852
require .NoError (t , err )
852
- return reflect .DeepEqual (tt .expectedTelemetry , telemetry )
853
+
854
+ return telemetry .Request_seen == tt .expectedTelemetry .Request_seen &&
855
+ telemetry .Response_seen == tt .expectedTelemetry .Response_seen &&
856
+ telemetry .Path_exceeds_frame == tt .expectedTelemetry .Path_exceeds_frame &&
857
+ telemetry .Exceeding_max_interesting_frames == tt .expectedTelemetry .Exceeding_max_interesting_frames &&
858
+ telemetry .Exceeding_max_frames_to_filter == tt .expectedTelemetry .Exceeding_max_frames_to_filter &&
859
+ telemetry .End_of_stream + telemetry .End_of_stream_rst >= expectedEOSOrRST &&
860
+ reflect .DeepEqual (telemetry .Path_size_bucket , tt .expectedTelemetry .Path_size_bucket )
853
861
}, time .Second * 5 , time .Millisecond * 100 )
854
862
if t .Failed () {
855
863
t .Logf ("expected telemetry: %+v;\n got: %+v" , tt .expectedTelemetry , telemetry )
0 commit comments