hs-test: http_static wrk tests

Type: test

Change-Id: I87cddb88f2a62e79d66832827134ddaa95740839
Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:
Matus Fabian
2024-10-08 13:58:37 +02:00
committed by Florin Coras
parent 5c8ddd54c1
commit 6885d5f9eb
2 changed files with 54 additions and 7 deletions

View File

@ -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")
}