pomerium/integration/benchmark_test.go
Caleb Doxsey 57217af7dd
authenticate: implement hpke-based login flow (#3779)
* urlutil: add time validation functions

* authenticate: implement hpke-based login flow

* fix import cycle

* fix tests

* log error

* fix callback url

* add idp param

* fix test

* fix test
2022-12-05 15:31:07 -07:00

43 lines
1.1 KiB
Go

package main
import (
"context"
"net/http"
"testing"
"github.com/stretchr/testify/require"
"github.com/pomerium/pomerium/integration/flows"
)
func BenchmarkLoggedInUserAccess(b *testing.B) {
ctx := context.Background()
client := getClient(b)
res, err := flows.Authenticate(ctx, client, mustParseURL("https://httpdetails.localhost.pomerium.io/by-domain"),
flows.WithEmail("user1@dogs.test"))
require.NoError(b, err)
_ = res.Body.Close()
b.ResetTimer()
for i := 0; i < b.N; i++ {
req, err := http.NewRequestWithContext(ctx, "GET", "https://httpdetails.localhost.pomerium.io/by-domain", nil)
require.NoError(b, err)
res, err := client.Do(req)
require.NoError(b, err)
res.Body.Close()
}
}
func BenchmarkLoggedOutUserAccess(b *testing.B) {
ctx := context.Background()
client := getClient(b)
b.ResetTimer()
for i := 0; i < b.N; i++ {
req, err := http.NewRequestWithContext(ctx, "GET", "https://httpdetails.localhost.pomerium.io/by-domain", nil)
require.NoError(b, err)
res, err := client.Do(req)
require.NoError(b, err)
res.Body.Close()
}
}