mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
Preparing for v1 API
Moving (most) source to v1 root package to prepare for v0/v1 API separation. Signed-off-by: Johan Fylling <johan.dev@fylling.se>
This commit is contained in:
@@ -233,7 +233,7 @@ wasm-lib-clean:
|
||||
|
||||
.PHONY: wasm-rego-testgen-install
|
||||
wasm-rego-testgen-install:
|
||||
$(GO) install ./test/wasm/cmd/wasm-rego-testgen
|
||||
$(GO) install ./v1/test/wasm/cmd/wasm-rego-testgen
|
||||
|
||||
######################################################
|
||||
#
|
||||
|
||||
@@ -12,7 +12,7 @@ set -ex
|
||||
GOVERSION=${GOVERSION:?"You must set the GOVERSION environment variable."}
|
||||
DOCKER_UID=${DOCKER_UID:-$(id -u)}
|
||||
DOCKER_GID=${DOCKER_GID:-$(id -g)}
|
||||
ASSETS=${ASSETS:-"$PWD/test/wasm/assets"}
|
||||
ASSETS=${ASSETS:-"$PWD/v1/test/wasm/assets"}
|
||||
VERBOSE=${VERBOSE:-"0"}
|
||||
TESTGEN_CONTAINER_NAME="opa-wasm-testgen-container"
|
||||
TESTRUN_CONTAINER_NAME="opa-wasm-testrun-container"
|
||||
@@ -61,7 +61,7 @@ function generate_testcases {
|
||||
sh -c 'git config --global --add safe.directory /src && make wasm-rego-testgen-install \
|
||||
&& wasm-rego-testgen \
|
||||
--input-dir=/assets \
|
||||
--runner=/src/test/wasm/assets/test.js \
|
||||
--runner=/src/v1/test/wasm/assets/test.js \
|
||||
--output=/src/.go/cache/testcases.tar.gz'
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -19,22 +19,22 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
|
||||
"github.com/open-policy-agent/opa/server/types"
|
||||
"github.com/open-policy-agent/opa/v1/server/types"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/runtime"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/runtime"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/compile"
|
||||
"github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/compile"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
// benchmarkCommandParams are a superset of evalCommandParams
|
||||
|
||||
+5
-5
@@ -15,12 +15,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
// Minimize the number of tests that *actually* run the benchmarks, they are pretty slow.
|
||||
|
||||
+5
-5
@@ -14,12 +14,12 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/compile"
|
||||
"github.com/open-policy-agent/opa/keys"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/compile"
|
||||
"github.com/open-policy-agent/opa/v1/keys"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
const defaultPublicKeyID = "default"
|
||||
|
||||
+4
-4
@@ -13,11 +13,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestBuildProducesBundle(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -9,8 +9,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestCapabilitiesNoArgs(t *testing.T) {
|
||||
|
||||
+3
-3
@@ -12,11 +12,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
pr "github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type checkParams struct {
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestCheckRespectsCapabilities(t *testing.T) {
|
||||
|
||||
+4
-4
@@ -10,15 +10,15 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/open-policy-agent/opa/dependencies"
|
||||
"github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/v1/dependencies"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type depsCommandParams struct {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestDepsCompatibleFlags(t *testing.T) {
|
||||
|
||||
+12
-12
@@ -17,22 +17,22 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ast/location"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/compile"
|
||||
"github.com/open-policy-agent/opa/cover"
|
||||
fileurl "github.com/open-policy-agent/opa/internal/file/url"
|
||||
pr "github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/internal/runtime"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/profiler"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/topdown/lineage"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast/location"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/compile"
|
||||
"github.com/open-policy-agent/opa/v1/cover"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/profiler"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/topdown"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/lineage"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+7
-7
@@ -19,14 +19,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/topdown"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestEvalWithIllegalUnknownArgs(t *testing.T) {
|
||||
@@ -1833,7 +1833,7 @@ func TestResetExprLocations(t *testing.T) {
|
||||
}
|
||||
func kubeSchemaServer(t *testing.T) *httptest.Server {
|
||||
t.Helper()
|
||||
bs, err := os.ReadFile("../ast/testdata/_definitions.json")
|
||||
bs, err := os.ReadFile("../v1/ast/testdata/_definitions.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
+8
-8
@@ -15,14 +15,14 @@ import (
|
||||
"github.com/open-policy-agent/opa/cmd/internal/exec"
|
||||
"github.com/open-policy-agent/opa/internal/config"
|
||||
internal_logging "github.com/open-policy-agent/opa/internal/logging"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/plugins"
|
||||
"github.com/open-policy-agent/opa/plugins/bundle"
|
||||
"github.com/open-policy-agent/opa/plugins/discovery"
|
||||
"github.com/open-policy-agent/opa/plugins/logs"
|
||||
"github.com/open-policy-agent/opa/plugins/status"
|
||||
"github.com/open-policy-agent/opa/sdk"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/plugins"
|
||||
"github.com/open-policy-agent/opa/v1/plugins/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/plugins/discovery"
|
||||
"github.com/open-policy-agent/opa/v1/plugins/logs"
|
||||
"github.com/open-policy-agent/opa/v1/plugins/status"
|
||||
"github.com/open-policy-agent/opa/v1/sdk"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
+5
-5
@@ -12,13 +12,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/exec"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
loggingtest "github.com/open-policy-agent/opa/logging/test"
|
||||
sdk_test "github.com/open-policy-agent/opa/sdk/test"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
loggingtest "github.com/open-policy-agent/opa/v1/logging/test"
|
||||
sdk_test "github.com/open-policy-agent/opa/v1/sdk/test"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestExecBasic(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import _ "github.com/open-policy-agent/opa/features/wasm"
|
||||
import _ "github.com/open-policy-agent/opa/v1/features/wasm"
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
)
|
||||
|
||||
type loaderFilter struct {
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
func addConfigFileFlag(fs *pflag.FlagSet, file *string) {
|
||||
|
||||
+2
-2
@@ -14,10 +14,10 @@ import (
|
||||
"github.com/sergi/go-diff/diffmatchpatch"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/format"
|
||||
fileurl "github.com/open-policy-agent/opa/internal/file/url"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/format"
|
||||
)
|
||||
|
||||
type fmtCommandParams struct {
|
||||
|
||||
+3
-3
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/format"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/format"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
const formattedV0 = `package test
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
ib "github.com/open-policy-agent/opa/internal/bundle/inspect"
|
||||
pr "github.com/open-policy-agent/opa/internal/presentation"
|
||||
iStrs "github.com/open-policy-agent/opa/internal/strings"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestDoInspect(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/sdk"
|
||||
"github.com/open-policy-agent/opa/v1/sdk"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/sdk"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/sdk"
|
||||
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/sdk"
|
||||
"github.com/open-policy-agent/opa/v1/sdk"
|
||||
)
|
||||
|
||||
type result struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/sdk"
|
||||
"github.com/open-policy-agent/opa/v1/sdk"
|
||||
)
|
||||
|
||||
func TestJsonReporter_Close(t *testing.T) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type Params struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package exec
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type parser interface {
|
||||
|
||||
+3
-3
@@ -14,12 +14,12 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/internal/oracle"
|
||||
"github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
)
|
||||
|
||||
type findDefinitionParams struct {
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestOracleFindDefinition(t *testing.T) {
|
||||
|
||||
+4
-4
@@ -13,12 +13,12 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
astJSON "github.com/open-policy-agent/opa/ast/json"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
pr "github.com/open-policy-agent/opa/internal/presentation"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
astJSON "github.com/open-policy-agent/opa/v1/ast/json"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestParseExit0(t *testing.T) {
|
||||
|
||||
+4
-4
@@ -13,12 +13,12 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/format"
|
||||
fileurl "github.com/open-policy-agent/opa/internal/file/url"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/refactor"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/format"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/refactor"
|
||||
)
|
||||
|
||||
type moveCommandParams struct {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/format"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/format"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestDoMoveRenamePackage(t *testing.T) {
|
||||
|
||||
+3
-3
@@ -17,9 +17,9 @@ import (
|
||||
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
fileurl "github.com/open-policy-agent/opa/internal/file/url"
|
||||
"github.com/open-policy-agent/opa/runtime"
|
||||
"github.com/open-policy-agent/opa/server"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/runtime"
|
||||
"github.com/open-policy-agent/opa/v1/server"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+3
-3
@@ -16,9 +16,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/test/e2e"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/test/e2e"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
initload "github.com/open-policy-agent/opa/internal/runtime/init"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type signCmdParams struct {
|
||||
|
||||
+3
-3
@@ -11,10 +11,10 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/keys"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/keys"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestWriteTokenToFile(t *testing.T) {
|
||||
|
||||
+11
-11
@@ -18,21 +18,21 @@ import (
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/open-policy-agent/opa/internal/pathwatcher"
|
||||
initload "github.com/open-policy-agent/opa/internal/runtime/init"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/compile"
|
||||
"github.com/open-policy-agent/opa/cover"
|
||||
"github.com/open-policy-agent/opa/internal/runtime"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/storage/inmem"
|
||||
"github.com/open-policy-agent/opa/tester"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/topdown/lineage"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/compile"
|
||||
"github.com/open-policy-agent/opa/v1/cover"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
"github.com/open-policy-agent/opa/v1/storage/inmem"
|
||||
"github.com/open-policy-agent/opa/v1/tester"
|
||||
"github.com/open-policy-agent/opa/v1/topdown"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/lineage"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+5
-5
@@ -14,12 +14,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/topdown"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestFilterTraceDefault(t *testing.T) {
|
||||
|
||||
+8
-8
@@ -11,12 +11,12 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
version2 "github.com/open-policy-agent/opa/version"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/open-policy-agent/opa/cmd/internal/env"
|
||||
"github.com/open-policy-agent/opa/internal/report"
|
||||
"github.com/open-policy-agent/opa/internal/uuid"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,16 +41,16 @@ func init() {
|
||||
}
|
||||
|
||||
func generateCmdOutput(out io.Writer, check bool) {
|
||||
fmt.Fprintln(out, "Version: "+version.Version)
|
||||
fmt.Fprintln(out, "Build Commit: "+version.Vcs)
|
||||
fmt.Fprintln(out, "Build Timestamp: "+version.Timestamp)
|
||||
fmt.Fprintln(out, "Build Hostname: "+version.Hostname)
|
||||
fmt.Fprintln(out, "Go Version: "+version.GoVersion)
|
||||
fmt.Fprintln(out, "Platform: "+version.Platform)
|
||||
fmt.Fprintln(out, "Version: "+version2.Version)
|
||||
fmt.Fprintln(out, "Build Commit: "+version2.Vcs)
|
||||
fmt.Fprintln(out, "Build Timestamp: "+version2.Timestamp)
|
||||
fmt.Fprintln(out, "Build Hostname: "+version2.Hostname)
|
||||
fmt.Fprintln(out, "Go Version: "+version2.GoVersion)
|
||||
fmt.Fprintln(out, "Platform: "+version2.Platform)
|
||||
|
||||
var wasmAvailable string
|
||||
|
||||
if version.WasmRuntimeAvailable() {
|
||||
if version2.WasmRuntimeAvailable() {
|
||||
wasmAvailable = "available"
|
||||
} else {
|
||||
wasmAvailable = "unavailable"
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package peoplefinder.DELETE.api.users.__id
|
||||
|
||||
import rego.v1
|
||||
import input.user.attributes.properties as user_props
|
||||
|
||||
default allowed = false
|
||||
|
||||
default visible = false
|
||||
|
||||
default enabled = false
|
||||
|
||||
allowed if {
|
||||
user_props.department == "Operations"
|
||||
user_props.title == "IT Manager"
|
||||
}
|
||||
|
||||
visible if {
|
||||
user_props.department == "Operations"
|
||||
}
|
||||
|
||||
enabled if {
|
||||
allowed
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package peoplefinder.GET.api.users.__id
|
||||
|
||||
default allowed = true
|
||||
|
||||
default visible = true
|
||||
|
||||
default enabled = true
|
||||
@@ -1,18 +0,0 @@
|
||||
package peoplefinder.POST.api.users.__id
|
||||
|
||||
import rego.v1
|
||||
import input.user.attributes.properties as user_props
|
||||
|
||||
default allowed = false
|
||||
|
||||
default visible = true
|
||||
|
||||
default enabled = false
|
||||
|
||||
allowed if {
|
||||
user_props.department == "Operations"
|
||||
}
|
||||
|
||||
enabled if {
|
||||
allowed
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package peoplefinder.PUT.api.users.__id
|
||||
|
||||
import rego.v1
|
||||
import input.user.attributes.properties as user_props
|
||||
|
||||
default allowed = false
|
||||
|
||||
default visible = true
|
||||
|
||||
default enabled = true
|
||||
|
||||
allowed if {
|
||||
user_props.department == "Operations"
|
||||
}
|
||||
|
||||
allowed if {
|
||||
input.user.id == input.resource.id
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package peoplefinder.GET.api.users
|
||||
|
||||
default allowed = true
|
||||
|
||||
default visible = true
|
||||
|
||||
default enabled = true
|
||||
@@ -1,23 +0,0 @@
|
||||
package peoplefinder.POST.api.users
|
||||
|
||||
import rego.v1
|
||||
import input.user.attributes.properties as user_props
|
||||
|
||||
default allowed = false
|
||||
|
||||
default visible = false
|
||||
|
||||
default enabled = false
|
||||
|
||||
allowed if {
|
||||
user_props.department == "Operations"
|
||||
user_props.title == "IT Manager"
|
||||
}
|
||||
|
||||
visible if {
|
||||
allowed
|
||||
}
|
||||
|
||||
enabled if {
|
||||
allowed
|
||||
}
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ast/json"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
initload "github.com/open-policy-agent/opa/internal/runtime/init"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast/json"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
// Info represents information about a bundle.
|
||||
|
||||
@@ -14,10 +14,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestGenerateBundleInfoWithFileDir(t *testing.T) {
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/resolver/wasm"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/resolver/wasm"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
// LoadWasmResolversFromStore will lookup all Wasm modules from the store along with the
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/compiler/wasm"
|
||||
"github.com/open-policy-agent/opa/types"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/types"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/semver"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func minVersionIndex() ast.VersionIndex {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/schemas"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/schemas"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
type SchemaFile string
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func TestVerifyAuthorizationPolicySchema(t *testing.T) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/planner"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func TestRemoveUnusedCode(t *testing.T) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/compiler/wasm/opa"
|
||||
"github.com/open-policy-agent/opa/internal/debug"
|
||||
"github.com/open-policy-agent/opa/internal/wasm/encoding"
|
||||
@@ -20,8 +19,9 @@ import (
|
||||
"github.com/open-policy-agent/opa/internal/wasm/module"
|
||||
"github.com/open-policy-agent/opa/internal/wasm/types"
|
||||
"github.com/open-policy-agent/opa/internal/wasm/util"
|
||||
"github.com/open-policy-agent/opa/ir"
|
||||
opatypes "github.com/open-policy-agent/opa/types"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ir"
|
||||
opatypes "github.com/open-policy-agent/opa/v1/types"
|
||||
)
|
||||
|
||||
// Record Wasm ABI version in exported global variable
|
||||
|
||||
@@ -7,10 +7,10 @@ package wasm
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/planner"
|
||||
"github.com/open-policy-agent/opa/internal/wasm/instruction"
|
||||
"github.com/open-policy-agent/opa/internal/wasm/module"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func TestCompilerHelloWorld(t *testing.T) {
|
||||
|
||||
@@ -15,11 +15,11 @@ import (
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/open-policy-agent/opa/internal/strvals"
|
||||
"github.com/open-policy-agent/opa/keys"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/plugins/rest"
|
||||
"github.com/open-policy-agent/opa/tracing"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/keys"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/plugins/rest"
|
||||
"github.com/open-policy-agent/opa/v1/tracing"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
// ServiceOptions stores the options passed to ParseServicesConfig
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func setTestEnvVar(t *testing.T, name, value string) string {
|
||||
|
||||
@@ -22,14 +22,14 @@ import (
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
"github.com/open-policy-agent/opa/config"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/config"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
|
||||
// The import registers opentelemetry with the top-level `tracing` package,
|
||||
// so the latter can be used from rego/topdown without an explicit build-time
|
||||
// dependency.
|
||||
_ "github.com/open-policy-agent/opa/features/tracing"
|
||||
_ "github.com/open-policy-agent/opa/v1/features/tracing"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -151,8 +151,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/internal/edittree/bitvector"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
// Deletions are encoded with a nil value pointer.
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/topdown/builtins"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/builtins"
|
||||
)
|
||||
|
||||
// These test cases require malformed tree nodes or arguments,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package future
|
||||
|
||||
import "github.com/open-policy-agent/opa/ast"
|
||||
import "github.com/open-policy-agent/opa/v1/ast"
|
||||
|
||||
// FilterFutureImports filters OUT any future imports from the passed slice of
|
||||
// `*ast.Import`s.
|
||||
|
||||
@@ -7,7 +7,7 @@ package future
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
// ParserOptionsFromFutureImports transforms a slice of `ast.Import`s into the
|
||||
|
||||
@@ -7,7 +7,7 @@ package patch
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
// ParsePatchPathEscaped returns a new path for the given escaped str.
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
func TestParsePatchPathEscaped(t *testing.T) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
func GetLevel(level string) (logging.Level, error) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
func TestMergeDocs(t *testing.T) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package oracle
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
// Error defines the structure of errors returned by the oracle.
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func TestOracleFindDefinitionErrors(t *testing.T) {
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
initload "github.com/open-policy-agent/opa/internal/runtime/init"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
// CreatePathWatcher creates watchers to monitor for path changes
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
func TestWatchPaths(t *testing.T) {
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"io"
|
||||
"sort"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ast/location"
|
||||
"github.com/open-policy-agent/opa/internal/debug"
|
||||
"github.com/open-policy-agent/opa/ir"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast/location"
|
||||
"github.com/open-policy-agent/opa/v1/ir"
|
||||
)
|
||||
|
||||
// QuerySet represents the input to the planner.
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ir"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ir"
|
||||
)
|
||||
|
||||
func TestPlannerHelloWorld(t *testing.T) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
// funcstack implements a simple map structure used to keep track of virtual
|
||||
|
||||
@@ -7,7 +7,7 @@ package planner
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func TestFuncstack(t *testing.T) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
package planner
|
||||
|
||||
import (
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ir"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ir"
|
||||
)
|
||||
|
||||
type varstack []map[ast.Var]ir.Local
|
||||
|
||||
@@ -3,8 +3,8 @@ package planner
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/ir"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ir"
|
||||
)
|
||||
|
||||
func TestVarStackPushPop(t *testing.T) {
|
||||
|
||||
@@ -18,15 +18,15 @@ import (
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/cover"
|
||||
"github.com/open-policy-agent/opa/format"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/profiler"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/cover"
|
||||
"github.com/open-policy-agent/opa/v1/format"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/profiler"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
"github.com/open-policy-agent/opa/v1/topdown"
|
||||
)
|
||||
|
||||
// DefaultProfileSortOrder is the default ordering unless something is specified in the CLI
|
||||
|
||||
@@ -14,13 +14,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
inmem "github.com/open-policy-agent/opa/storage/inmem/test"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/rego"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
inmem "github.com/open-policy-agent/opa/v1/storage/inmem/test"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
)
|
||||
|
||||
type testErrorWithMarshaller struct {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
)
|
||||
|
||||
// Provider wraps a metrics.Metrics provider with a Prometheus registry that can
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
)
|
||||
|
||||
func TestJSONSerialization(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/internal/version"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
// Values taken from
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
func TestECR(t *testing.T) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/internal/version"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
// Values taken from
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
func mockPayload(request KMSSignRequest) string {
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
v4 "github.com/open-policy-agent/opa/internal/providers/aws/v4"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
)
|
||||
|
||||
func stringFromTerm(t *ast.Term) string {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
)
|
||||
|
||||
// DoRequestWithClient is a convenience function to get the body of an HTTP response with
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
// ParseDataPath returns a ref from the slash separated path s rooted at data.
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/topdown/builtins"
|
||||
"github.com/open-policy-agent/opa/topdown/cache"
|
||||
"github.com/open-policy-agent/opa/topdown/print"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/builtins"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/cache"
|
||||
"github.com/open-policy-agent/opa/v1/topdown/print"
|
||||
)
|
||||
|
||||
// Result holds the evaluation result.
|
||||
|
||||
@@ -17,12 +17,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/open-policy-agent/opa/keys"
|
||||
"github.com/open-policy-agent/opa/logging"
|
||||
|
||||
"github.com/open-policy-agent/opa/plugins/rest"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/keys"
|
||||
"github.com/open-policy-agent/opa/v1/logging"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
|
||||
"github.com/open-policy-agent/opa/v1/plugins/rest"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
)
|
||||
|
||||
// ExternalServiceURL is the base HTTP URL for a telemetry service.
|
||||
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
storedversion "github.com/open-policy-agent/opa/internal/version"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/metrics"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/metrics"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
)
|
||||
|
||||
// InsertAndCompileOptions contains the input for the operation.
|
||||
|
||||
@@ -16,14 +16,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/bundle"
|
||||
"github.com/open-policy-agent/opa/internal/file/archive"
|
||||
"github.com/open-policy-agent/opa/loader"
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
inmem "github.com/open-policy-agent/opa/storage/inmem/test"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/util/test"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/bundle"
|
||||
"github.com/open-policy-agent/opa/v1/loader"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
inmem "github.com/open-policy-agent/opa/v1/storage/inmem/test"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/v1/util/test"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/v1/ast"
|
||||
"github.com/open-policy-agent/opa/v1/util"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/storage/inmem"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
"github.com/open-policy-agent/opa/v1/storage/inmem"
|
||||
)
|
||||
|
||||
// Transaction is a mock storage.Transaction implementation for use in testing.
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/open-policy-agent/opa/storage"
|
||||
"github.com/open-policy-agent/opa/v1/storage"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Basic Wasm Module Evaluation Example
|
||||
====================================
|
||||
|
||||
The [main.go](./main.go) example demonstrates the loading and executing of OPA
|
||||
The [main.go](main.go) example demonstrates the loading and executing of OPA
|
||||
produced wasm policy binary.
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Loader Example
|
||||
==============
|
||||
|
||||
[main.go](./main.go) loads a bundle either from a file or HTTP server.
|
||||
[main.go](main.go) loads a bundle either from a file or HTTP server.
|
||||
|
||||
## Setup
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user