aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/infra/suite_nginx_proxy.go
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-09-19 17:19:39 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-10-03 19:23:49 +0000
commit46ab0b22bb2915c28ae30d26501ea4cfa1f9b577 (patch)
treea6a7e803fd0665c8b6ac0b27d2eb09cea1965b98 /extras/hs-test/infra/suite_nginx_proxy.go
parentfae41c678320f4e63896d52e942cea59a44d9168 (diff)
hs-test: added nginx multi-thread tests
- added Dockerfile.envoy - removed nginx vcl.conf file as it's created by the framework now Type: test Change-Id: I5f2be015c864c8d2aa938a22b1abece64989999b Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/suite_nginx_proxy.go')
-rw-r--r--extras/hs-test/infra/suite_nginx_proxy.go75
1 files changed, 55 insertions, 20 deletions
diff --git a/extras/hs-test/infra/suite_nginx_proxy.go b/extras/hs-test/infra/suite_nginx_proxy.go
index 75215cfc78d..93a9635f938 100644
--- a/extras/hs-test/infra/suite_nginx_proxy.go
+++ b/extras/hs-test/infra/suite_nginx_proxy.go
@@ -65,26 +65,9 @@ func (s *NginxProxySuite) SetupTest() {
s.AssertNil(vpp.createTap(serverInterface, 2))
// nginx proxy
- nginxProxyContainer := s.GetTransientContainerByName(NginxProxyContainerName)
+ nginxProxyContainer := s.GetContainerByName(NginxProxyContainerName)
s.AssertNil(nginxProxyContainer.Create())
s.proxyPort = 80
- values := struct {
- LogPrefix string
- Proxy string
- Server string
- Port uint16
- }{
- LogPrefix: nginxProxyContainer.Name,
- Proxy: clientInterface.Peer.Ip4AddressString(),
- Server: serverInterface.Ip4AddressString(),
- Port: s.proxyPort,
- }
- nginxProxyContainer.CreateConfig(
- "/nginx.conf",
- "./resources/nginx/nginx_proxy_mirroring.conf",
- values,
- )
- s.AssertNil(nginxProxyContainer.Start())
// nginx HTTP server
nginxServerContainer := s.GetTransientContainerByName(NginxServerContainerName)
@@ -104,8 +87,6 @@ func (s *NginxProxySuite) SetupTest() {
nginxSettings,
)
s.AssertNil(nginxServerContainer.Start())
-
- vpp.WaitForApp("nginx-", 5)
}
func (s *NginxProxySuite) TearDownTest() {
@@ -116,6 +97,35 @@ func (s *NginxProxySuite) TearDownTest() {
s.HstSuite.TearDownTest()
}
+func (s *NginxProxySuite) CreateNginxProxyConfig(container *Container, multiThreadWorkers bool) {
+ clientInterface := s.GetInterfaceByName(MirroringClientInterfaceName)
+ serverInterface := s.GetInterfaceByName(MirroringServerInterfaceName)
+ var workers uint8
+ if multiThreadWorkers {
+ workers = 2
+ } else {
+ workers = 1
+ }
+ values := struct {
+ Workers uint8
+ LogPrefix string
+ Proxy string
+ Server string
+ Port uint16
+ }{
+ Workers: workers,
+ LogPrefix: container.Name,
+ Proxy: clientInterface.Peer.Ip4AddressString(),
+ Server: serverInterface.Ip4AddressString(),
+ Port: s.proxyPort,
+ }
+ container.CreateConfig(
+ "/nginx.conf",
+ "./resources/nginx/nginx_proxy_mirroring.conf",
+ values,
+ )
+}
+
func (s *NginxProxySuite) ProxyPort() uint16 {
return s.proxyPort
}
@@ -132,6 +142,31 @@ func (s *NginxProxySuite) CurlDownloadResource(uri string) {
s.AssertNotContains(log, "Operation timed out")
}
+func (s *NginxProxySuite) AddVclConfig(container *Container, multiThreadWorkers bool) {
+ var vclConf Stanza
+ vclFileName := container.GetHostWorkDir() + "/vcl.conf"
+
+ appSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
+ container.GetContainerWorkDir())
+
+ vclConf.
+ NewStanza("vcl").
+ Append("heapsize 64M").
+ Append("rx-fifo-size 4000000").
+ Append("tx-fifo-size 4000000").
+ Append("segment-size 4000000000").
+ Append("add-segment-size 4000000000").
+ Append("event-queue-size 100000").
+ Append("use-mq-eventfd").
+ Append(appSocketApi)
+ if multiThreadWorkers {
+ vclConf.Append("multi-thread-workers")
+ }
+
+ err := vclConf.Close().SaveToFile(vclFileName)
+ s.AssertNil(err, fmt.Sprint(err))
+}
+
var _ = Describe("NginxProxySuite", Ordered, ContinueOnFailure, func() {
var s NginxProxySuite
BeforeAll(func() {