mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-18 17:18:16 +02:00
envoy: verify helathcheck enpoints (#725)
* envoy: verify helathcheck enpoints Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
ca499ac9be
commit
c85b12a137
1 changed files with 31 additions and 19 deletions
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -54,13 +55,22 @@ func TestHealth(t *testing.T) {
|
||||||
ctx := mainCtx
|
ctx := mainCtx
|
||||||
ctx, clearTimeout := context.WithTimeout(ctx, time.Second*30)
|
ctx, clearTimeout := context.WithTimeout(ctx, time.Second*30)
|
||||||
defer clearTimeout()
|
defer clearTimeout()
|
||||||
|
pomeriumRoutes := []string{
|
||||||
|
"https://authenticate.localhost.pomerium.io",
|
||||||
|
"https://forward-authenticate.localhost.pomerium.io",
|
||||||
|
"https://httpdetails.localhost.pomerium.io",
|
||||||
|
"https://restricted-httpdetails.localhost.pomerium.io",
|
||||||
|
}
|
||||||
|
endpoints := []string{"healthz", "ping"}
|
||||||
|
|
||||||
for _, endpoint := range []string{"healthz", "ping"} {
|
for _, route := range pomeriumRoutes {
|
||||||
|
route := route
|
||||||
|
for _, endpoint := range endpoints {
|
||||||
endpoint := endpoint
|
endpoint := endpoint
|
||||||
t.Run(endpoint, func(t *testing.T) {
|
routeToCheck := fmt.Sprintf("%s/%s", route, endpoint)
|
||||||
|
t.Run(routeToCheck, func(t *testing.T) {
|
||||||
client := testcluster.NewHTTPClient()
|
client := testcluster.NewHTTPClient()
|
||||||
|
req, err := http.NewRequestWithContext(ctx, "GET", routeToCheck, nil)
|
||||||
req, err := http.NewRequestWithContext(ctx, "GET", "https://restricted-httpdetails.localhost.pomerium.io/"+endpoint, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -74,4 +84,6 @@ func TestHealth(t *testing.T) {
|
||||||
assert.Equal(t, http.StatusOK, res.StatusCode, "unexpected status code")
|
assert.Equal(t, http.StatusOK, res.StatusCode, "unexpected status code")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue