mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-29 22:48:15 +02:00
## Summary Some test improvements: - disable the race detector on macos, which currently results in a ton of linking errors, and I think doing race detection on linux is sufficient to find stuff - add build tags to the `integration` folder so it's not included by default when running `go test ./...` - remove some unused stuff in the Makefile - change the file `testenv` searches for from `.git` to `go.mod` which allows test caching to work more reliably - remove the test for orphaned connections in postgres. It doesn't actually make sense because we have listener connections in the background. I think it was racy. - fix yarn caching ## Checklist - [ ] reference any related issues - [x] updated unit tests - [x] add appropriate label (`enhancement`, `bug`, `breaking`, `dependencies`, `ci`) - [x] ready for review
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
//go:build integration
|
|
|
|
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/pomerium/pomerium/integration/flows"
|
|
)
|
|
|
|
func BenchmarkLoggedInUserAccess(b *testing.B) {
|
|
ctx := b.Context()
|
|
client := getClient(b, false)
|
|
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, http.MethodGet, "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 := b.Context()
|
|
client := getClient(b, false)
|
|
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://httpdetails.localhost.pomerium.io/by-domain", nil)
|
|
require.NoError(b, err)
|
|
res, err := client.Do(req)
|
|
require.NoError(b, err)
|
|
res.Body.Close()
|
|
}
|
|
}
|