aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/http_test.go
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-10-08 13:58:37 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-10-14 17:05:49 +0000
commit6885d5f9ebd97e19d520280a2a85a4081e8ad060 (patch)
tree26d0345b66fdc3d6d0f4169a256c42ab6d86e928 /extras/hs-test/http_test.go
parent5c8ddd54c12e05db233173e890152ecda4c27888 (diff)
hs-test: http_static wrk tests
Type: test Change-Id: I87cddb88f2a62e79d66832827134ddaa95740839 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.go36
1 files changed, 35 insertions, 1 deletions
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")
}