Skip to content

Commit

Permalink
Close/cleanup mock OPA control planes and decision consumers
Browse files Browse the repository at this point in the history
Signed-off-by: Farasath Ahamed <[email protected]>
  • Loading branch information
Farasath Ahamed committed Feb 6, 2025
1 parent d01b9cf commit 14d2113
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions filters/openpolicyagent/opaauthorizerequest/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func BenchmarkMinimalPolicy(b *testing.B) {
`,
}),
)
defer opaControlPlane.Stop()

filterOpts := NewFilterOptionsWithDefaults(opaControlPlane.URL())
f, err := createOpaFilter(filterOpts)
Expand Down Expand Up @@ -104,8 +105,11 @@ func BenchmarkMinimalPolicyWithDecisionLogs(b *testing.B) {
`,
}),
)
defer opaControlPlane.Stop()

decisionLogsConsumer := newDecisionConsumer()
defer decisionLogsConsumer.Close()

filterOpts := FilterOptions{
OpaControlPlaneUrl: opaControlPlane.URL(),
DecisionConsumerUrl: decisionLogsConsumer.URL,
Expand Down Expand Up @@ -153,6 +157,7 @@ func BenchmarkAllowWithReqBody(b *testing.B) {
`,
}),
)
defer opaControlPlane.Stop()

filterOpts := NewFilterOptionsWithDefaults(opaControlPlane.URL())
f, err := createBodyBasedOpaFilter(filterOpts)
Expand Down Expand Up @@ -221,6 +226,7 @@ func BenchmarkJwtValidation(b *testing.B) {
`, publicKey),
}),
)
defer opaControlPlane.Stop()

filterOpts := NewFilterOptionsWithDefaults(opaControlPlane.URL())
f, err := createOpaFilter(filterOpts)
Expand Down Expand Up @@ -294,6 +300,7 @@ func BenchmarkMinimalPolicyBundle(b *testing.B) {
bundlePath := fmt.Sprintf("../../../skptesting/%s", bundleName)

opaControlPlane := newOpaControlPlaneServingBundle(bundlePath, bundleName, b)
defer opaControlPlane.Close()

filterOpts := FilterOptions{
OpaControlPlaneUrl: opaControlPlane.URL,
Expand Down

0 comments on commit 14d2113

Please sign in to comment.