add integration test for https IP address route (#4476)

Update the integration test libsonnet templates to assign a fixed IP 
address to the trusted-httpdetails service. This requires also assigning
a fixed IP subnet to the docker network.

Configure a route with a 'to' URL using https and this fixed IP address. 
Add a corresponding certificate with the IP address. Finally, add a test
case that makes a request to this route.
This commit is contained in:
Kenneth Jenkins 2023-08-18 09:32:21 -07:00 committed by GitHub
parent c6b7927e1c
commit 379abecab1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 217 additions and 115 deletions

View file

@ -567,3 +567,20 @@ func rawJWTPayload(t *testing.T, jwt string) map[string]interface{} {
require.NoError(t, err, "JWT payload could not be deserialized")
return decoded
}
func TestUpstreamViaIPAddress(t *testing.T) {
// Verify that we can make a successful request to a route with a 'to' URL
// that uses https with an IP address.
client := getClient(t)
res, err := client.Get("https://httpdetails-ip-address.localhost.pomerium.io/")
require.NoError(t, err, "unexpected http error")
defer res.Body.Close()
var result struct {
Headers map[string]string `json:"headers"`
Protocol string `json:"protocol"`
}
err = json.NewDecoder(res.Body).Decode(&result)
require.NoError(t, err)
assert.Equal(t, "https", result.Protocol)
}