Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 1 | package main |
| 2 | |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 3 | func (s *NsSuite) TestHttpTps() { |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 4 | finished := make(chan error, 1) |
| 5 | server_ip := "10.0.0.2" |
| 6 | port := "8080" |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 7 | |
| 8 | container := s.getContainerByName("vpp") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 9 | |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 10 | s.log("starting vpp..") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 11 | |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 12 | // start & configure vpp in the container |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 13 | _, err := container.execAction("ConfigureHttpTps") |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 14 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 15 | |
| 16 | go startWget(finished, server_ip, port, "client") |
| 17 | // wait for client |
| 18 | err = <-finished |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 19 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 20 | } |
| 21 | |
Maros Ondrejicka | 11a03e9 | 2022-12-01 09:56:37 +0100 | [diff] [blame] | 22 | func (s *VethsSuite) TestHttpCli() { |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 23 | serverContainer := s.getContainerByName("server-vpp") |
| 24 | clientContainer := s.getContainerByName("client-vpp") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 25 | |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 26 | _, err := serverContainer.execAction("Configure2Veths srv") |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 27 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 28 | |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 29 | _, err = clientContainer.execAction("Configure2Veths cln") |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 30 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 31 | |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 32 | s.log("configured IPs...") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 33 | |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 34 | _, err = serverContainer.execAction("RunHttpCliSrv") |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 35 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 36 | |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 37 | s.log("configured http server") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 38 | |
Maros Ondrejicka | db823ed | 2022-12-14 16:30:04 +0100 | [diff] [blame] | 39 | o, err := clientContainer.execAction("RunHttpCliCln /show/version") |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 40 | s.assertNil(err) |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 41 | |
Maros Ondrejicka | 98a91e8 | 2022-12-06 15:38:05 +0100 | [diff] [blame] | 42 | s.assertContains(o, "<html>", "<html> not found in the result!") |
Filip Tehlar | b15a000 | 2022-11-10 12:34:17 +0100 | [diff] [blame] | 43 | } |