hs-test: allow nginx suite to unconfigure topology
[vpp.git] / extras / hs-test / suite_nginx_test.go
1 package main
2
3 const (
4         // These correspond to names used in yaml config
5         mirroringClientInterfaceName = "hst_client"
6         mirroringServerInterfaceName = "hst_server"
7         vppProxyContainerName        = "vpp-proxy"
8         nginxProxyContainerName      = "nginx-proxy"
9         nginxServerContainerName     = "nginx-server"
10 )
11
12 type NginxSuite struct {
13         HstSuite
14 }
15
16 func (s *NginxSuite) SetupSuite() {
17         s.loadNetworkTopology("2taps")
18
19         s.loadContainerTopology("nginxProxyAndServer")
20 }
21
22 func (s *NginxSuite) SetupTest() {
23         s.skipIfUnconfiguring()
24
25         s.SetupVolumes()
26         s.SetupContainers()
27
28         // Setup test conditions
29         var startupConfig Stanza
30         startupConfig.
31                 NewStanza("session").
32                 Append("enable").
33                 Append("use-app-socket-api").Close()
34
35         // ... for proxy
36         vppProxyContainer := s.getContainerByName(vppProxyContainerName)
37         proxyVpp, _ := vppProxyContainer.newVppInstance(startupConfig)
38         proxyVpp.start()
39
40         clientInterface := s.netInterfaces[mirroringClientInterfaceName]
41         proxyVpp.createTap(clientInterface, 1)
42
43         serverInterface := s.netInterfaces[mirroringServerInterfaceName]
44         proxyVpp.createTap(serverInterface, 2)
45
46         nginxContainer := s.getTransientContainerByName(nginxProxyContainerName)
47         nginxContainer.create()
48         nginxContainer.copy("./resources/nginx/nginx_proxy_mirroring.conf", "/nginx.conf")
49         nginxContainer.start()
50
51         proxyVpp.waitForApp("-app", 5)
52 }