aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/infra/suite_no_topo.go
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/infra/suite_no_topo.go')
-rw-r--r--extras/hs-test/infra/suite_no_topo.go78
1 files changed, 74 insertions, 4 deletions
diff --git a/extras/hs-test/infra/suite_no_topo.go b/extras/hs-test/infra/suite_no_topo.go
index 9b4998a77a1..068c43b14d0 100644
--- a/extras/hs-test/infra/suite_no_topo.go
+++ b/extras/hs-test/infra/suite_no_topo.go
@@ -1,6 +1,7 @@
package hst
import (
+ "fmt"
"reflect"
"runtime"
"strings"
@@ -12,6 +13,7 @@ const (
SingleTopoContainerVpp = "vpp"
SingleTopoContainerNginx = "nginx"
TapInterfaceName = "htaphost"
+ NginxHttp3ContainerName = "nginx-http3"
)
var noTopoTests = map[string][]func(s *NoTopoSuite){}
@@ -53,11 +55,66 @@ func (s *NoTopoSuite) SetupTest() {
container := s.GetContainerByName(SingleTopoContainerVpp)
vpp, _ := container.newVppInstance(container.AllocatedCpus, sessionConfig)
- s.AssertNil(vpp.Start())
+ s.AssertNil(vpp.Start())
tapInterface := s.GetInterfaceByName(TapInterfaceName)
-
s.AssertNil(vpp.createTap(tapInterface), "failed to create tap interface")
+
+ if *DryRun {
+ s.LogStartedContainers()
+ s.Skip("Dry run mode = true")
+ }
+}
+
+func (s *NoTopoSuite) TearDownTest() {
+ if CurrentSpecReport().Failed() {
+ s.CollectNginxLogs(NginxHttp3ContainerName)
+ }
+ s.HstSuite.TearDownTest()
+}
+
+func (s *NoTopoSuite) CreateNginxConfig(container *Container, multiThreadWorkers bool) {
+ var workers uint8
+ if multiThreadWorkers {
+ workers = 2
+ } else {
+ workers = 1
+ }
+ values := struct {
+ Workers uint8
+ }{
+ Workers: workers,
+ }
+ container.CreateConfigFromTemplate(
+ "/nginx.conf",
+ "./resources/nginx/nginx.conf",
+ values,
+ )
+}
+
+func (s *NoTopoSuite) AddNginxVclConfig(multiThreadWorkers bool) {
+ nginxCont := s.GetContainerByName(SingleTopoContainerNginx)
+ vclFileName := nginxCont.GetHostWorkDir() + "/vcl.conf"
+ appSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/default",
+ nginxCont.GetContainerWorkDir())
+
+ var vclConf Stanza
+ 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))
}
func (s *NoTopoSuite) VppAddr() string {
@@ -72,6 +129,19 @@ func (s *NoTopoSuite) HostAddr() string {
return s.GetInterfaceByName(TapInterfaceName).Ip4AddressString()
}
+func (s *NoTopoSuite) CreateNginxHttp3Config(container *Container) {
+ nginxSettings := struct {
+ LogPrefix string
+ }{
+ LogPrefix: container.Name,
+ }
+ container.CreateConfigFromTemplate(
+ "/nginx.conf",
+ "./resources/nginx/nginx_http3.conf",
+ nginxSettings,
+ )
+}
+
var _ = Describe("NoTopoSuite", Ordered, ContinueOnFailure, func() {
var s NoTopoSuite
BeforeAll(func() {
@@ -96,7 +166,7 @@ var _ = Describe("NoTopoSuite", Ordered, ContinueOnFailure, func() {
It(testName, func(ctx SpecContext) {
s.Log(testName + ": BEGIN")
test(&s)
- }, SpecTimeout(SuiteTimeout))
+ }, SpecTimeout(TestTimeout))
}
}
})
@@ -125,7 +195,7 @@ var _ = Describe("NoTopoSuiteSolo", Ordered, ContinueOnFailure, Serial, func() {
It(testName, Label("SOLO"), func(ctx SpecContext) {
s.Log(testName + ": BEGIN")
test(&s)
- }, SpecTimeout(SuiteTimeout))
+ }, SpecTimeout(TestTimeout))
}
}
})