mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
296578a456
* create interpreter once and reuse across searches Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix excessive logs Signed-off-by: Jim Bugwadia <jim@nirmata.com> * refactor(jmespath): reuse fCall instead of intr Signed-off-by: Khaled Emara <khaled.emara@nirmata.com> * refactor(jmespath): use new api Use the new JMESPath API to decouple Interpreter from FunctionCaller Signed-off-by: Khaled Emara <khaled.emara@nirmata.com> * chore: bump go-jmespath Signed-off-by: Khaled Emara <khaled.emara@nirmata.com> * fix(jmespath): test case using older API Signed-off-by: Khaled Emara <khaled.emara@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Signed-off-by: Khaled Emara <khaled.emara@nirmata.com> Co-authored-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: Khaled Emara <khaled.emara@nirmata.com> Co-authored-by: Khaled Emara <KhaledEmaraDev@gmail.com>
35 lines
531 B
Go
35 lines
531 B
Go
package jmespath
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
type args struct {
|
|
query string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
wantErr bool
|
|
}{
|
|
{
|
|
wantErr: true,
|
|
},
|
|
{
|
|
args: args{
|
|
query: "object.something",
|
|
},
|
|
wantErr: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
_, err := jmespathInterface.Query(tt.args.query)
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
})
|
|
}
|
|
}
|