From 8b2a67c8f3977291fbafca37a435b5cd1ef4c214 Mon Sep 17 00:00:00 2001 From: Adrian Villin Date: Fri, 6 Dec 2024 16:00:25 +0100 Subject: hs-test: improved iperf testing - set iperf to json output - added iperf json parsing function - we can now check if iperf transferred more than X megabytes (other asserts can be added) Type: test Change-Id: I560104a153456b46f22a1affee4301018063b99d Signed-off-by: Adrian Villin --- extras/hs-test/infra/hst_suite.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'extras/hs-test/infra/hst_suite.go') diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index 0513e86e47b..9a3a3c9c8f6 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -364,6 +364,15 @@ func (s *HstSuite) AssertChannelClosed(timeout time.Duration, channel chan error EventuallyWithOffset(2, channel).WithTimeout(timeout).Should(BeClosed()) } +// Pass the parsed result struct and the minimum amount of data transferred in MB +func (s *HstSuite) AssertIperfMinTransfer(result IPerfResult, minTransferred int) { + if result.Start.Details.Protocol == "TCP" { + s.AssertGreaterThan(result.End.TcpReceived.MBytes, minTransferred) + } else { + s.AssertGreaterThan(result.End.Udp.MBytes, minTransferred) + } +} + func (s *HstSuite) CreateLogger() { suiteName := s.GetCurrentSuiteName() var err error -- cgit 1.2.3-korg