2022-08-09 14:44:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-06-14 09:32:39 +02:00
|
|
|
. "fd.io/hs-test/infra"
|
2022-08-09 14:44:47 +00:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-03-14 11:42:55 -04:00
|
|
|
func init() {
|
2024-08-14 12:38:20 +02:00
|
|
|
RegisterVppProxyTests(VppProxyHttpTcpTest, VppProxyHttpTlsTest)
|
|
|
|
RegisterEnvoyProxyTests(EnvoyProxyHttpTcpTest)
|
2024-08-21 17:25:41 +02:00
|
|
|
RegisterNginxProxyTests(NginxMirroringTest)
|
2024-03-14 11:42:55 -04:00
|
|
|
}
|
|
|
|
|
2024-08-14 12:38:20 +02:00
|
|
|
func configureVppProxy(s *VppProxySuite, proto string, proxyPort uint16) {
|
|
|
|
vppProxy := s.GetContainerByName(VppProxyContainerName).VppInstance
|
|
|
|
output := vppProxy.Vppctl(
|
|
|
|
"test proxy server server-uri %s://%s/%d client-uri tcp://%s/%d",
|
2023-11-29 07:40:18 +01:00
|
|
|
proto,
|
2024-08-14 12:38:20 +02:00
|
|
|
s.VppProxyAddr(),
|
|
|
|
proxyPort,
|
|
|
|
s.NginxAddr(),
|
|
|
|
s.NginxPort(),
|
2023-02-02 08:58:04 +01:00
|
|
|
)
|
2024-06-14 09:32:39 +02:00
|
|
|
s.Log("proxy configured: " + output)
|
2022-08-09 14:44:47 +00:00
|
|
|
}
|
|
|
|
|
2024-08-14 12:38:20 +02:00
|
|
|
func VppProxyHttpTcpTest(s *VppProxySuite) {
|
|
|
|
var proxyPort uint16 = 8080
|
|
|
|
configureVppProxy(s, "tcp", proxyPort)
|
|
|
|
uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.VppProxyAddr(), proxyPort)
|
|
|
|
s.CurlDownloadResource(uri)
|
2023-11-29 07:40:18 +01:00
|
|
|
}
|
|
|
|
|
2024-08-14 12:38:20 +02:00
|
|
|
func VppProxyHttpTlsTest(s *VppProxySuite) {
|
|
|
|
var proxyPort uint16 = 8080
|
|
|
|
configureVppProxy(s, "tls", proxyPort)
|
|
|
|
uri := fmt.Sprintf("https://%s:%d/httpTestFile", s.VppProxyAddr(), proxyPort)
|
|
|
|
s.CurlDownloadResource(uri)
|
2022-12-14 16:30:04 +01:00
|
|
|
}
|
|
|
|
|
2024-08-14 12:38:20 +02:00
|
|
|
func EnvoyProxyHttpTcpTest(s *EnvoyProxySuite) {
|
|
|
|
uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.ProxyAddr(), s.ProxyPort())
|
|
|
|
s.CurlDownloadResource(uri)
|
2022-08-09 14:44:47 +00:00
|
|
|
}
|
2024-08-21 17:25:41 +02:00
|
|
|
|
|
|
|
// broken when CPUS > 1
|
|
|
|
func NginxMirroringTest(s *NginxProxySuite) {
|
|
|
|
s.SkipIfMultiWorker()
|
|
|
|
uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.ProxyAddr(), s.ProxyPort())
|
|
|
|
s.CurlDownloadResource(uri)
|
|
|
|
}
|