blob: 1cbddec9e767377edefd6d634416517d6f7b53c9 [file] [log] [blame]
Filip Tehlarb15a0002022-11-10 12:34:17 +01001package main
2
Filip Tehlarb15a0002022-11-10 12:34:17 +01003func (s *NsSuite) TestHttpTps() {
4 t := s.T()
5 finished := make(chan error, 1)
6 server_ip := "10.0.0.2"
7 port := "8080"
Maros Ondrejickadb823ed2022-12-14 16:30:04 +01008
9 container := s.getContainerByName("vpp")
Filip Tehlarb15a0002022-11-10 12:34:17 +010010
11 t.Log("starting vpp..")
12
Filip Tehlarb15a0002022-11-10 12:34:17 +010013 // start & configure vpp in the container
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010014 _, err := container.execAction("ConfigureHttpTps")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010015 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010016
17 go startWget(finished, server_ip, port, "client")
18 // wait for client
19 err = <-finished
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010020 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010021}
22
Maros Ondrejicka11a03e92022-12-01 09:56:37 +010023func (s *VethsSuite) TestHttpCli() {
Filip Tehlarb15a0002022-11-10 12:34:17 +010024 t := s.T()
25
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010026 serverContainer := s.getContainerByName("server-vpp")
27 clientContainer := s.getContainerByName("client-vpp")
Filip Tehlarb15a0002022-11-10 12:34:17 +010028
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010029 _, err := serverContainer.execAction("Configure2Veths srv")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010030 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010031
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010032 _, err = clientContainer.execAction("Configure2Veths cln")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010033 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010034
35 t.Log("configured IPs...")
36
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010037 _, err = serverContainer.execAction("RunHttpCliSrv")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010038 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010039
40 t.Log("configured http server")
41
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010042 o, err := clientContainer.execAction("RunHttpCliCln /show/version")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010043 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010044
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010045 s.assertContains(o, "<html>", "<html> not found in the result!")
Filip Tehlarb15a0002022-11-10 12:34:17 +010046}