hs-test: abstract away topology from test cases
[vpp.git] / extras / hs-test / http_test.go
1 package main
2
3 func (s *NsSuite) TestHttpTps() {
4         t := s.T()
5         finished := make(chan error, 1)
6         server_ip := "10.0.0.2"
7         port := "8080"
8
9         container := s.getContainerByName("vpp")
10
11         t.Log("starting vpp..")
12
13         // start & configure vpp in the container
14         _, err := container.execAction("ConfigureHttpTps")
15         s.assertNil(err)
16
17         go startWget(finished, server_ip, port, "client")
18         // wait for client
19         err = <-finished
20         s.assertNil(err)
21 }
22
23 func (s *VethsSuite) TestHttpCli() {
24         t := s.T()
25
26         serverContainer := s.getContainerByName("server-vpp")
27         clientContainer := s.getContainerByName("client-vpp")
28
29         _, err := serverContainer.execAction("Configure2Veths srv")
30         s.assertNil(err)
31
32         _, err = clientContainer.execAction("Configure2Veths cln")
33         s.assertNil(err)
34
35         t.Log("configured IPs...")
36
37         _, err = serverContainer.execAction("RunHttpCliSrv")
38         s.assertNil(err)
39
40         t.Log("configured http server")
41
42         o, err := clientContainer.execAction("RunHttpCliCln /show/version")
43         s.assertNil(err)
44
45         s.assertContains(o, "<html>", "<html> not found in the result!")
46 }