Skip to content

Commit

Permalink
Modify opa
Browse files Browse the repository at this point in the history
  • Loading branch information
p53 committed Feb 8, 2025
1 parent 9a76009 commit 4653a5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions pkg/authorization/external_opa.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"time"

"github.com/gogatekeeper/gatekeeper/pkg/constant"
"github.com/open-policy-agent/opa/plugins"
opaserver "github.com/open-policy-agent/opa/server"
opastorage "github.com/open-policy-agent/opa/storage"
"github.com/open-policy-agent/opa/storage/inmem"
"github.com/open-policy-agent/opa/v1/plugins"
opaserver "github.com/open-policy-agent/opa/v1/server"
opastorage "github.com/open-policy-agent/opa/v1/storage"
"github.com/open-policy-agent/opa/v1/storage/inmem"
)

type OpaInput struct {
Expand Down
10 changes: 5 additions & 5 deletions pkg/authorization/external_opa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"

"github.com/gogatekeeper/gatekeeper/pkg/authorization"
opaserver "github.com/open-policy-agent/opa/server"
opaserver "github.com/open-policy-agent/opa/v1/server"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestExternalOpa(t *testing.T) {
default allow := false
body := json.unmarshal(input.body)
allow {
allow if {
body.name = "Test"
}
`,
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestExternalOpa(t *testing.T) {
default allow := false
body := json.unmarshal(input.body)
allow {
allow if {
body.name = "Tester"
}
`,
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestExternalOpa(t *testing.T) {
default allow := false
body := yaml.unmarshal(input.body)
allow {
allow if {
body.name = "Test"
}
`,
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestExternalOpa(t *testing.T) {
default allow := false
body := yaml.unmarshal(input.body)
allow {
allow if {
body.name = "Test"
input.headers["X-Custom"][0] = "TESTVALUE"
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/testsuite/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/gogatekeeper/gatekeeper/pkg/proxy/models"
"github.com/gogatekeeper/gatekeeper/pkg/proxy/session"
"github.com/gogatekeeper/gatekeeper/pkg/utils"
opaserver "github.com/open-policy-agent/opa/server"
opaserver "github.com/open-policy-agent/opa/v1/server"
"github.com/rs/cors"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
Expand Down Expand Up @@ -2648,7 +2648,7 @@ func TestEnableOpa(t *testing.T) {
default allow := false
allow {
allow if {
input.method = "POST"
input.path = FakeTestURL
contains(input.body, "Whatever")
Expand Down Expand Up @@ -2682,7 +2682,7 @@ func TestEnableOpa(t *testing.T) {
default allow := false
allow {
allow if {
input.method = "GETTT"
input.path = FakeTestURL
}
Expand Down Expand Up @@ -2826,7 +2826,7 @@ func TestEnableOpa(t *testing.T) {
default allow := false
allow {
allow if {
input.method = "GET"
input.path = FakeTestURL
}
Expand Down

0 comments on commit 4653a5c

Please sign in to comment.