diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-08-06 15:55:26 +0200 |
---|---|---|
committer | Matus Fabian <matfabia@cisco.com> | 2024-08-16 13:36:34 +0200 |
commit | 5546755d1a76be9bb3b6a98fb8280f8e9a17ffd1 (patch) | |
tree | bf08e2ce2cf76830e0db75f777f1e22065794461 /extras/hs-test/http_test.go | |
parent | f02e7467856f20d479784e0a5e73e45d3ac8db51 (diff) |
http: http_read_message improvement
Use svm_fifo_peek in http_read_message and advance rx fifo head by
amount of bytes send to app, since not always you won't or can't
send all bytes.
Type: improvement
Change-Id: I84348c9df5c77ba386c9738a754295bb9ea0f7ef
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/http_test.go')
-rw-r--r-- | extras/hs-test/http_test.go | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index 8f8946fa32e..1f3a5f35b74 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -31,7 +31,7 @@ func init() { HttpHeadersTest, HttpStaticFileHandlerTest, HttpClientTest, HttpClientErrRespTest, HttpClientPostFormTest, HttpClientPostFileTest, HttpClientPostFilePtrTest, AuthorityFormTargetTest) RegisterNoTopoSoloTests(HttpStaticPromTest, HttpTpsTest, HttpTpsInterruptModeTest, PromConcurrentConnectionsTest, - PromMemLeakTest, HttpClientPostMemLeakTest) + PromMemLeakTest, HttpClientPostMemLeakTest, HttpInvalidClientRequestMemLeakTest) } const wwwRootPath = "/tmp/www_root" @@ -501,6 +501,40 @@ func HttpClientPostMemLeakTest(s *NoTopoSuite) { vpp.MemLeakCheck(traces1, traces2) } +func HttpInvalidClientRequestMemLeakTest(s *NoTopoSuite) { + s.SkipUnlessLeakCheck() + + vpp := s.GetContainerByName("vpp").VppInstance + serverAddress := s.GetInterfaceByName(TapInterfaceName).Peer.Ip4AddressString() + + /* no goVPP less noise */ + vpp.Disconnect() + + vpp.Vppctl("http cli server") + + /* warmup request (FIB) */ + _, err := TcpSendReceive(serverAddress+":80", "GET / HTTP/1.1\r\n") + s.AssertNil(err, fmt.Sprint(err)) + + /* let's give it some time to clean up sessions, so local port can be reused and we have less noise */ + time.Sleep(time.Second * 12) + + vpp.EnableMemoryTrace() + traces1, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + + _, err = TcpSendReceive(serverAddress+":80", "GET / HTTP/1.1\r\n") + s.AssertNil(err, fmt.Sprint(err)) + + /* let's give it some time to clean up sessions */ + time.Sleep(time.Second * 12) + + traces2, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + vpp.MemLeakCheck(traces1, traces2) + +} + func HttpStaticFileHandlerTest(s *NoTopoSuite) { content := "<html><body><p>Hello</p></body></html>" content2 := "<html><body><p>Page</p></body></html>" |