git » gofer » commit 5eef47a

server: Add test for raw connections to TLS backends

author Alberto Bertogli
2022-10-15 12:43:34 UTC
committer Alberto Bertogli
2022-10-15 12:43:34 UTC
parent f3bc736501007e3dc1ba8ecc0e16232e6a8a2d3e

server: Add test for raw connections to TLS backends

This patch adds a test for a raw connection against a TLS backend.

test/01-fe.yaml +6 -0
test/test.sh +4 -2

diff --git a/test/01-fe.yaml b/test/01-fe.yaml
index 2073b27..b7f4234 100644
--- a/test/01-fe.yaml
+++ b/test/01-fe.yaml
@@ -62,3 +62,9 @@ raw:
   ":8447":
     to: "localhost:0"
     reqlog: "requests"
+
+  # Raw proxy to ourselves over https, to test having a TLS backend.
+  ":8448":
+    to: "localhost:8442"
+    to_tls: true
+    reqlog: "requests"
diff --git a/test/test.sh b/test/test.sh
index fa4cbe2..b105cfd 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -21,9 +21,10 @@ gofer_bg -v=1 -logfile=.01-be.log -configfile=01-be.yaml
 BE_PID=$PID
 wait_until_ready 8450
 
-# Launch the test instance.
+# Launch the frontend. Tell it to accept the generated cert as a valid root.
 generate_certs
-gofer_bg -v=1 -logfile=.01-fe.log -configfile=01-fe.yaml
+SSL_CERT_FILE=".certs/localhost/fullchain.pem" \
+    gofer_bg -v=1 -logfile=.01-fe.log -configfile=01-fe.yaml
 FE_PID=$PID
 wait_until_ready 8441  # http
 wait_until_ready 8442  # https (cert files)
@@ -240,6 +241,7 @@ exp "http://127.0.0.1:8459/notexists" -status 404
 echo "### Raw proxying"
 exp http://localhost:8445/file -body "ñaca\n"
 exp https://localhost:8446/file -body "ñaca\n"
+exp http://localhost:8448/file -body "ñaca\n"
 
 true < /dev/tcp/localhost/8447
 if ! waitgrep -q ":8447 = 500" .01-fe.requests.log; then