9 . "github.com/onsi/ginkgo/v2"
12 // These correspond to names used in yaml config
14 vppProxyContainerName = "vpp-proxy"
15 nginxProxyContainerName = "nginx-proxy"
16 nginxServerContainerName = "nginx-server"
17 mirroringClientInterfaceName = "hstcln"
18 mirroringServerInterfaceName = "hstsrv"
21 var nginxTests = []func(s *NginxSuite){}
22 var nginxSoloTests = []func(s *NginxSuite){}
24 type NginxSuite struct {
28 func registerNginxTests(tests ...func(s *NginxSuite)) {
29 nginxTests = append(nginxTests, tests...)
31 func registerNginxSoloTests(tests ...func(s *NginxSuite)) {
32 nginxSoloTests = append(nginxSoloTests, tests...)
35 func (s *NginxSuite) SetupSuite() {
36 s.HstSuite.SetupSuite()
37 s.loadNetworkTopology("2taps")
38 s.loadContainerTopology("nginxProxyAndServer")
41 func (s *NginxSuite) SetupTest() {
42 s.HstSuite.SetupTest()
44 // Setup test conditions
45 var sessionConfig Stanza
49 append("use-app-socket-api").close()
51 cpus := s.AllocateCpus()
53 vppProxyContainer := s.getContainerByName(vppProxyContainerName)
54 proxyVpp, _ := vppProxyContainer.newVppInstance(cpus, sessionConfig)
55 s.assertNil(proxyVpp.start())
57 clientInterface := s.getInterfaceByName(mirroringClientInterfaceName)
58 s.assertNil(proxyVpp.createTap(clientInterface, 1))
60 serverInterface := s.getInterfaceByName(mirroringServerInterfaceName)
61 s.assertNil(proxyVpp.createTap(serverInterface, 2))
63 nginxContainer := s.getTransientContainerByName(nginxProxyContainerName)
64 nginxContainer.create()
70 Proxy: clientInterface.peer.ip4AddressString(),
71 Server: serverInterface.ip4AddressString(),
73 nginxContainer.createConfig(
75 "./resources/nginx/nginx_proxy_mirroring.conf",
78 s.assertNil(nginxContainer.start())
80 proxyVpp.waitForApp("nginx-", 5)
83 var _ = Describe("NginxSuite", Ordered, ContinueOnFailure, func() {
97 for _, test := range nginxTests {
99 pc := reflect.ValueOf(test).Pointer()
100 funcValue := runtime.FuncForPC(pc)
101 It(strings.Split(funcValue.Name(), ".")[2], func(ctx SpecContext) {
103 }, SpecTimeout(time.Minute*5))
107 var _ = Describe("NginxSuiteSolo", Ordered, ContinueOnFailure, Serial, func() {
121 for _, test := range nginxSoloTests {
123 pc := reflect.ValueOf(test).Pointer()
124 funcValue := runtime.FuncForPC(pc)
125 It(strings.Split(funcValue.Name(), ".")[2], Label("SOLO"), func(ctx SpecContext) {
127 }, SpecTimeout(time.Minute*5))