mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +02:00
remove benchmark
This commit is contained in:
parent
334c0756be
commit
0919f63aaa
1 changed files with 0 additions and 41 deletions
|
@ -1,41 +0,0 @@
|
||||||
package evaluator
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/pomerium/pomerium/authorize/internal/store"
|
|
||||||
"github.com/pomerium/pomerium/config"
|
|
||||||
"github.com/pomerium/pomerium/pkg/policy"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func BenchmarkRegoCompiler_CompilePolicyQuery(b *testing.B) {
|
|
||||||
compiler := NewRegoCompiler(store.New())
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
route := &config.Policy{
|
|
||||||
From: fmt.Sprintf("https://from-%d.example.com", i),
|
|
||||||
To: mustParseWeightedURLs(b, "https://to.example.com"),
|
|
||||||
AllowedUsers: []string{fmt.Sprintf("user-%d", i)},
|
|
||||||
}
|
|
||||||
ppl := route.ToPPL()
|
|
||||||
rego, err := policy.GenerateRegoFromPolicy(ppl)
|
|
||||||
require.NoError(b, err)
|
|
||||||
|
|
||||||
q, err := compiler.CompilePolicyQuery(context.Background(), rego)
|
|
||||||
require.NoError(b, err)
|
|
||||||
_ = q
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func mustParseWeightedURLs(t interface {
|
|
||||||
require.TestingT
|
|
||||||
Helper()
|
|
||||||
}, urls ...string) []config.WeightedURL {
|
|
||||||
t.Helper()
|
|
||||||
|
|
||||||
wu, err := config.ParseWeightedUrls(urls...)
|
|
||||||
require.NoError(t, err)
|
|
||||||
return wu
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue