Skip to content

skonto/test-reverse-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test fix for reverse proxy

For more see: golang/go#40747 and knative/serving#12387. Make sure you use go 1.21 and it contains the fix.

Scenario: Http Client -> Envoy (10000) -> Http Reverse Proxy -> Test Echo Server (random port)

  1. On one terminal run the app
$ go run ./cmd/echo-rp/
2023/10/19 18:36:54 Proxy listening to :http:https://127.0.0.1:34423
  1. Patch config.yaml with the port output: port_value: 34423.

  2. On another terminal run envoy

$docker run --rm -it --net=host \
-v $(pwd)/config.yaml:/config.yaml \
-p 9901:9901 \
-p 10000:10000 \
envoyproxy/envoy:v1.28-latest \
-c /config.yaml
  1. Test end-to-end connectivity (envoy is listening to 10000 by default):
curl -X POST http:https://0.0.0.0:10000  -d "data"
data
  1. Run Tests:
$ go test -run TestProxyBehindEnvoy ./pkg/rp/...
ok  	github.com/skonto/test-reverse-proxy/pkg/rp	12.262s

If you uncomment code in the test that uses no fullduplex then it should fail even with go 1.21:

$ go test -run TestProxyBehindEnvoy ./pkg/rp/...
--- FAIL: TestProxyBehindEnvoy (12.42s)
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
    envoy_test.go:30: error during request: failed to read body: unexpected EOF
FAIL
FAIL	github.com/skonto/test-reverse-proxy/pkg/rp	12.428s
FAIL

Test with Knative Serving

# export your cluster entrypoint, bellow is the expossed ingress url from a minikube cluster
export INGRESS_URL=http:https://192.168.39.97:30765
export REQUEST_HOST=helloworld-go.default.example.com
for i in {1..10}; do go clean -cache; go test -v -run TestProxyBehindEnvoy ./pkg/rp/...; done

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages