vpp/extras/hs-test/proxy_test.go
Matus Fabian 7301abe9ba hs-test: nginx proxy/mirroring test cleanup
- test moved to proxy_test.go
- topology and suite updated to be vpp/envoy proxy compliant

Type: test
Change-Id: Iabee50b76bb8d96851f831c0b57d0e98dc4b3a5f
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2024-08-22 07:08:20 +00:00

52 lines
1.4 KiB
Go

package main
import (
. "fd.io/hs-test/infra"
"fmt"
)
func init() {
RegisterVppProxyTests(VppProxyHttpTcpTest, VppProxyHttpTlsTest)
RegisterEnvoyProxyTests(EnvoyProxyHttpTcpTest)
RegisterNginxProxyTests(NginxMirroringTest)
}
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",
proto,
s.VppProxyAddr(),
proxyPort,
s.NginxAddr(),
s.NginxPort(),
)
s.Log("proxy configured: " + output)
}
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)
}
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)
}
func EnvoyProxyHttpTcpTest(s *EnvoyProxySuite) {
uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.ProxyAddr(), s.ProxyPort())
s.CurlDownloadResource(uri)
}
// broken when CPUS > 1
func NginxMirroringTest(s *NginxProxySuite) {
s.SkipIfMultiWorker()
uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.ProxyAddr(), s.ProxyPort())
s.CurlDownloadResource(uri)
}