summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/http_test.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <maros.ondrejicka@pantheon.tech>2023-02-02 08:58:04 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-02-10 05:23:19 +0000
commit2908f8cf07c21f385f80d83fdad826a0eea98977 (patch)
tree6391c5b989f2a7800958489feb1d7f460a87e850 /extras/hs-test/http_test.go
parent0a192ea93df9d1cd4d7777bcc5418a2f9e861a6c (diff)
hs-test: refactor test cases from ns suite
This converts more tests to configure VPP from test context. Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: Idf26b0c16f87e87c97b198412af39b99d947ced6
Diffstat (limited to 'extras/hs-test/http_test.go')
-rw-r--r--extras/hs-test/http_test.go31
1 files changed, 12 insertions, 19 deletions
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index 52b7c39fa77..912c98283b1 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -9,21 +9,19 @@ import (
)
func (s *NsSuite) TestHttpTps() {
- finished := make(chan error, 1)
- server_ip := "10.0.0.2"
+ iface := s.netInterfaces[clientInterface]
+ client_ip := iface.Ip4AddressString()
port := "8080"
+ finished := make(chan error, 1)
container := s.getContainerByName("vpp")
- s.log("starting vpp..")
-
- // start & configure vpp in the container
- _, err := container.execAction("ConfigureHttpTps")
- s.assertNil(err)
+ // configure vpp in the container
+ container.vppInstance.vppctl("http tps uri tcp://0.0.0.0/8080")
- go startWget(finished, server_ip, port, "test_file_10M", "client")
+ go startWget(finished, client_ip, port, "test_file_10M", "client")
// wait for client
- err = <-finished
+ err := <-finished
s.assertNil(err)
}
@@ -31,16 +29,14 @@ func (s *VethsSuite) TestHttpCli() {
serverContainer := s.getContainerByName("server-vpp")
clientContainer := s.getContainerByName("client-vpp")
- serverVeth := s.veths["vppsrv"]
+ serverVeth := s.netInterfaces[serverInterfaceName]
- _, err := serverContainer.vppInstance.vppctl("http cli server")
- s.assertNil(err)
+ serverContainer.vppInstance.vppctl("http cli server")
- uri := "http://" + serverVeth.Address() + "/80"
+ uri := "http://" + serverVeth.Ip4AddressString() + "/80"
- o, err := clientContainer.vppInstance.vppctl("http cli client" +
+ o := clientContainer.vppInstance.vppctl("http cli client" +
" uri " + uri + " query /show/version")
- s.assertNil(err)
s.log(o)
s.assertContains(o, "<html>", "<html> not found in the result!")
@@ -48,10 +44,7 @@ func (s *VethsSuite) TestHttpCli() {
func waitForApp(vppInst *VppInstance, appName string, timeout int) error {
for i := 0; i < timeout; i++ {
- o, err := vppInst.vppctl("show app")
- if err != nil {
- return fmt.Errorf("Error ocurred during 'show app'")
- }
+ o := vppInst.vppctl("show app")
if strings.Contains(o, appName) {
return nil
}