blob: ae1c8b82e5aff808f6f202052e5d7aaf80532e9e [file] [log] [blame]
Filip Tehlarb15a0002022-11-10 12:34:17 +01001package main
2
Filip Tehlarb15a0002022-11-10 12:34:17 +01003func (s *NsSuite) TestHttpTps() {
Filip Tehlarb15a0002022-11-10 12:34:17 +01004 finished := make(chan error, 1)
5 server_ip := "10.0.0.2"
6 port := "8080"
Maros Ondrejickadb823ed2022-12-14 16:30:04 +01007
8 container := s.getContainerByName("vpp")
Filip Tehlarb15a0002022-11-10 12:34:17 +01009
Maros Ondrejicka87531802022-12-19 20:35:27 +010010 s.log("starting vpp..")
Filip Tehlarb15a0002022-11-10 12:34:17 +010011
Filip Tehlarb15a0002022-11-10 12:34:17 +010012 // start & configure vpp in the container
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010013 _, err := container.execAction("ConfigureHttpTps")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010014 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010015
16 go startWget(finished, server_ip, port, "client")
17 // wait for client
18 err = <-finished
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010019 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010020}
21
Maros Ondrejicka11a03e92022-12-01 09:56:37 +010022func (s *VethsSuite) TestHttpCli() {
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010023 serverContainer := s.getContainerByName("server-vpp")
24 clientContainer := s.getContainerByName("client-vpp")
Filip Tehlarb15a0002022-11-10 12:34:17 +010025
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010026 _, err := serverContainer.execAction("Configure2Veths srv")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010027 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010028
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010029 _, err = clientContainer.execAction("Configure2Veths cln")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010030 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010031
Maros Ondrejicka87531802022-12-19 20:35:27 +010032 s.log("configured IPs...")
Filip Tehlarb15a0002022-11-10 12:34:17 +010033
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010034 _, err = serverContainer.execAction("RunHttpCliSrv")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010035 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010036
Maros Ondrejicka87531802022-12-19 20:35:27 +010037 s.log("configured http server")
Filip Tehlarb15a0002022-11-10 12:34:17 +010038
Maros Ondrejickadb823ed2022-12-14 16:30:04 +010039 o, err := clientContainer.execAction("RunHttpCliCln /show/version")
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010040 s.assertNil(err)
Filip Tehlarb15a0002022-11-10 12:34:17 +010041
Maros Ondrejicka98a91e82022-12-06 15:38:05 +010042 s.assertContains(o, "<html>", "<html> not found in the result!")
Filip Tehlarb15a0002022-11-10 12:34:17 +010043}