mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 15:47:36 +02:00
add benchmark (#3433)
* add benchmark * add benchmark github action * commit * permissions
This commit is contained in:
parent
1134244075
commit
64def90532
2 changed files with 111 additions and 0 deletions
43
integration/benchmark_test.go
Normal file
43
integration/benchmark_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
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()
|
||||
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.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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue