mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
committed by
Torin Sandall
parent
28ff5613ac
commit
2f1526c672
+1
-1
@@ -422,7 +422,7 @@ func TestCheckInferenceRules(t *testing.T) {
|
||||
// Check that prefixes that iterate fallback to any.
|
||||
{"prefix-iter", ruleset1, `data.prefix.i.j[k]`, types.A},
|
||||
|
||||
// Check that iteration targetting a rule (but nonetheless prefixed) falls back to any.
|
||||
// Check that iteration targeting a rule (but nonetheless prefixed) falls back to any.
|
||||
{"prefix-iter-2", ruleset1, `data.prefix.i.j[k].p`, types.A},
|
||||
|
||||
{"default-rule", ruleset1, "data.default_rule.x", types.NewAny(
|
||||
|
||||
+2
-2
@@ -236,8 +236,8 @@ func TestSetFail(t *testing.T) {
|
||||
|
||||
func TestEmptyComposites(t *testing.T) {
|
||||
assertParseOneTerm(t, "empty object", "{}", ObjectTerm())
|
||||
assertParseOneTerm(t, "emtpy array", "[]", ArrayTerm())
|
||||
assertParseOneTerm(t, "emtpy set", "set()", SetTerm())
|
||||
assertParseOneTerm(t, "empty array", "[]", ArrayTerm())
|
||||
assertParseOneTerm(t, "empty set", "set()", SetTerm())
|
||||
}
|
||||
|
||||
func TestNestedComposites(t *testing.T) {
|
||||
|
||||
@@ -32,7 +32,7 @@ foo(x) = y { split(x, "this", y) }
|
||||
}, module)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error during transfom: %v", err)
|
||||
t.Fatalf("Unexpected error during transform: %v", err)
|
||||
}
|
||||
|
||||
resultMod, ok := result.(*Module)
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@ func All(x interface{}) (resolved []ast.Ref, err error) {
|
||||
}
|
||||
|
||||
// The analysis will discard variables that are not used in
|
||||
// direct comparisions or in the output. Since lone Bodies are
|
||||
// direct comparisons or in the output. Since lone Bodies are
|
||||
// often queries, we want all the variables to be in the output.
|
||||
r := &ast.Rule{
|
||||
Head: &ast.Head{Name: ast.Var("_"), Value: ast.NewTerm(arr)},
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ func Bytes(src []byte) ([]byte, error) {
|
||||
return Ast(astElem)
|
||||
}
|
||||
|
||||
// Source formats a Rego source file. The bytes provided must decribe a complete
|
||||
// Source formats a Rego source file. The bytes provided must describe a complete
|
||||
// Rego module. If they don't, Source will return an error resulting from the attempt
|
||||
// to parse the bytes.
|
||||
func Source(filename string, src []byte) ([]byte, error) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ func (e loaderErrors) Error() string {
|
||||
for i := range buf {
|
||||
buf[i] = e[i].Error()
|
||||
}
|
||||
return fmt.Sprintf("%v errors occured during loading:\n", len(e)) + strings.Join(buf, "\n")
|
||||
return fmt.Sprintf("%v errors occurred during loading:\n", len(e)) + strings.Join(buf, "\n")
|
||||
}
|
||||
|
||||
func (e *loaderErrors) Add(err error) {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ const (
|
||||
RegoPartialEval = "rego_partial_eval"
|
||||
)
|
||||
|
||||
// Metrics defines the interface for a collection of perfomrance metrics in the
|
||||
// Metrics defines the interface for a collection of performance metrics in the
|
||||
// policy engine.
|
||||
type Metrics interface {
|
||||
Timer(name string) Timer
|
||||
|
||||
+1
-1
@@ -230,7 +230,7 @@ func TestDumpPath(t *testing.T) {
|
||||
|
||||
var result map[string]interface{}
|
||||
if err := util.UnmarshalJSON(bs, &result); err != nil {
|
||||
t.Fatalf("Expected json unmarhsal to suceed but got: %v", err)
|
||||
t.Fatalf("Expected json unmarshal to succeed but got: %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(data, result) {
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestDataV0(t *testing.T) {
|
||||
}
|
||||
|
||||
if err := f.v0(http.MethodPost, "/data/test/q/foo", `{"flag": true}`, 200, `[1,2,3,4]`); err != nil {
|
||||
t.Fatalf("Exepcted response [1,2,3,4] but got: %v", err)
|
||||
t.Fatalf("Expected response [1,2,3,4] but got: %v", err)
|
||||
}
|
||||
|
||||
req := newReqV0(http.MethodPost, "/data/test/q", "")
|
||||
@@ -1972,7 +1972,7 @@ func TestWatchParams(t *testing.T) {
|
||||
}
|
||||
explain := expl.([]interface{})
|
||||
if len(explain) != exp.explainLength {
|
||||
t.Fatalf("Expection %d explanations, got %d", exp.explainLength, len(explain))
|
||||
t.Fatalf("Expected %d explanations, got %d", exp.explainLength, len(explain))
|
||||
}
|
||||
|
||||
result, ok := m["result"].([]interface{})[0].(map[string]interface{})["bindings"]
|
||||
|
||||
@@ -140,7 +140,7 @@ func (e TriggerEvent) DataChanged() bool {
|
||||
// TriggerConfig contains the trigger registration configuration.
|
||||
type TriggerConfig struct {
|
||||
|
||||
// OnCommit is invoked when a transaction is succesfully committed. The
|
||||
// OnCommit is invoked when a transaction is successfully committed. The
|
||||
// callback is invoked with a handle to the write transaction that
|
||||
// successfully committed before other clients see the changes.
|
||||
OnCommit func(ctx context.Context, txn Transaction, event TriggerEvent)
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ func extractJSONObject(s string) (ast.Object, error) {
|
||||
// Object. If duplicate keys are present in a JWT, the last must be
|
||||
// used or the token rejected. Since detecting duplicates is tantamount
|
||||
// to parsing it ourselves, we're relying on the Go implementation
|
||||
// using the last occuring instance of the key, which is the behavior
|
||||
// using the last occurring instance of the key, which is the behavior
|
||||
// as of Go 1.8.1.
|
||||
v, err := builtinJSONUnmarshal(ast.String(s))
|
||||
if err != nil {
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/open-policy-agent/opa/topdown"
|
||||
)
|
||||
|
||||
// Watcher allows for watches to be registed on queries.
|
||||
// Watcher allows for watches to be registered on queries.
|
||||
type Watcher struct {
|
||||
store storage.Store
|
||||
compiler *ast.Compiler
|
||||
@@ -41,7 +41,7 @@ type Handle struct {
|
||||
query string // the original query, used for migration
|
||||
|
||||
out chan Event // out is the same channel as C, but without directional constraints
|
||||
notify signal // channel to recieve new data change alerts on.
|
||||
notify signal // channel to receive new data change alerts on.
|
||||
|
||||
done signal // closed by the watcher to signal the sending goroutine to stop sending query results.
|
||||
ack signal // closed by the sending goroutine to tell the watcher it has stopped sending query results.
|
||||
|
||||
+1
-1
@@ -420,7 +420,7 @@ func testWatchRandom(t *testing.T, watcher *Watcher, zero, one, two, three *Hand
|
||||
// all the queries results are linearly dependent on the
|
||||
// data they watch, the result should never increase. It
|
||||
// may stay the same or skip values due to multiple store
|
||||
// writes occuring after a notification is acted upon,
|
||||
// writes occurring after a notification is acted upon,
|
||||
// but while or before the new result is computed.
|
||||
if i < last {
|
||||
t.Errorf("query result decreased, last=%d, cur=%d", last, i)
|
||||
|
||||
Reference in New Issue
Block a user