From 6885d5f9ebd97e19d520280a2a85a4081e8ad060 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Tue, 8 Oct 2024 13:58:37 +0200 Subject: hs-test: http_static wrk tests Type: test Change-Id: I87cddb88f2a62e79d66832827134ddaa95740839 Signed-off-by: Matus Fabian --- extras/hs-test/http_test.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'extras/hs-test/http_test.go') diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index 9e52e961d28..f4aec142a78 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -31,7 +31,8 @@ func init() { HttpStaticMacTimeTest, HttpStaticBuildInUrlGetVersionVerboseTest, HttpVersionNotSupportedTest, HttpInvalidContentLengthTest, HttpInvalidTargetSyntaxTest, HttpStaticPathTraversalTest, HttpUriDecodeTest, HttpHeadersTest, HttpStaticFileHandlerTest, HttpStaticFileHandlerDefaultMaxAgeTest, HttpClientTest, HttpClientErrRespTest, HttpClientPostFormTest, - HttpClientPostFileTest, HttpClientPostFilePtrTest, AuthorityFormTargetTest, HttpRequestLineTest) + HttpClientPostFileTest, HttpClientPostFilePtrTest, AuthorityFormTargetTest, HttpRequestLineTest, + HttpStaticFileHandlerWrkTest, HttpStaticUrlHandlerWrkTest) RegisterNoTopoSoloTests(HttpStaticPromTest, HttpGetTpsTest, HttpGetTpsInterruptModeTest, PromConcurrentConnectionsTest, PromMemLeakTest, HttpClientPostMemLeakTest, HttpInvalidClientRequestMemLeakTest, HttpPostTpsTest, HttpPostTpsInterruptModeTest, PromConsecutiveConnectionsTest) @@ -594,6 +595,39 @@ func HttpInvalidClientRequestMemLeakTest(s *NoTopoSuite) { } +func runWrkPerf(s *NoTopoSuite) { + nConnections := 1000 + serverAddress := s.VppAddr() + + wrkCont := s.GetContainerByName("wrk") + args := fmt.Sprintf("-c %d -t 2 -d 30s http://%s:80/64B", nConnections, serverAddress) + wrkCont.ExtraRunningArgs = args + wrkCont.Run() + s.Log("Please wait for 30s, test is running.") + o, err := wrkCont.GetOutput() + s.Log(o) + s.AssertEmpty(err, "err: '%s'", err) +} + +func HttpStaticFileHandlerWrkTest(s *NoTopoSuite) { + vpp := s.GetContainerByName("vpp").VppInstance + serverAddress := s.VppAddr() + vpp.Container.Exec("mkdir -p " + wwwRootPath) + content := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + err := vpp.Container.CreateFile(wwwRootPath+"/64B", content) + s.AssertNil(err, fmt.Sprint(err)) + s.Log(vpp.Vppctl("http static server www-root " + wwwRootPath + " uri tcp://" + serverAddress + "/80 private-segment-size 256m")) + runWrkPerf(s) +} + +func HttpStaticUrlHandlerWrkTest(s *NoTopoSuite) { + vpp := s.GetContainerByName("vpp").VppInstance + serverAddress := s.VppAddr() + s.Log(vpp.Vppctl("http static server uri tcp://" + serverAddress + "/80 url-handlers private-segment-size 256m")) + s.Log(vpp.Vppctl("test-url-handler enable")) + runWrkPerf(s) +} + func HttpStaticFileHandlerDefaultMaxAgeTest(s *NoTopoSuite) { HttpStaticFileHandlerTestFunction(s, "default") } -- cgit 1.2.3-korg