Skip to content

Commit

Permalink
Merge pull request #111964 from DangerOnTheRanger/cel-estimate-fix-up…
Browse files Browse the repository at this point in the history
…date

Fix CEL size estimation
  • Loading branch information
k8s-ci-robot committed Aug 29, 2022
2 parents 891cbed + 9509cb2 commit 3a4e3a0
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 169 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ require (
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.12.4 // indirect
github.com/google/cel-go v0.12.5 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
Expand Down Expand Up @@ -376,7 +376,7 @@ replace (
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 => github.com/golang-jwt/jwt/v4 v4.2.0
github.com/golang/freetype => github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/golang/glog => github.com/golang/glog v1.0.0
github.com/golang/glog => github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache => github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/golang/mock => github.com/golang/mock v1.6.0
github.com/golang/protobuf => github.com/golang/protobuf v1.5.2
Expand All @@ -386,7 +386,7 @@ replace (
github.com/golangplus/testing => github.com/golangplus/testing v1.0.0
github.com/google/btree => github.com/google/btree v1.0.1
github.com/google/cadvisor => github.com/google/cadvisor v0.45.0
github.com/google/cel-go => github.com/google/cel-go v0.12.4
github.com/google/cel-go => github.com/google/cel-go v0.12.5
github.com/google/gnostic => github.com/google/gnostic v0.5.7-v3refs
github.com/google/go-cmp => github.com/google/go-cmp v0.5.8
github.com/google/gofuzz => github.com/google/gofuzz v1.1.0
Expand Down
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69
github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU=
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
Expand All @@ -215,8 +215,8 @@ github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
github.com/google/cadvisor v0.45.0 h1:bXQze1sd8srZiQwiQ19Qaq/AoMIZS8YceBXrIaEvkX0=
github.com/google/cadvisor v0.45.0/go.mod h1:vsMT3Uv2XjQ8M7WUtKARV74mU/HN64C4XtM1bJhUKcU=
github.com/google/cel-go v0.12.4 h1:YINKfuHZ8n72tPOqSPZBwGiDpew2CJS48mdM5W8LZQU=
github.com/google/cel-go v0.12.4/go.mod h1:Av7CU6r6X3YmcHR9GXqVDaEJYfEtSxl6wvIjUQTriCw=
github.com/google/cel-go v0.12.5 h1:DmzaiSgoaqGCjtpPQWl26/gND+yRpim56H1jCVev6d8=
github.com/google/cel-go v0.12.5/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
Expand Down
2 changes: 1 addition & 1 deletion staging/src/k8s.io/apiextensions-apiserver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.19
require (
github.com/emicklei/go-restful/v3 v3.8.0
github.com/gogo/protobuf v1.3.2
github.com/google/cel-go v0.12.4
github.com/google/cel-go v0.12.5
github.com/google/gnostic v0.5.7-v3refs
github.com/google/go-cmp v0.5.8
github.com/google/gofuzz v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions staging/src/k8s.io/apiextensions-apiserver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,27 @@ func TestCostEstimation(t *testing.T) {
setMaxElements: 10,
expectedSetCost: 6,
},
{
name: "check cost of size call",
schemaGenerator: genMapWithRule("integer", "oldSelf.size() == self.size()"),
expectedCalcCost: 5,
setMaxElements: 10,
expectedSetCost: 5,
},
{
name: "check cost of timestamp comparison",
schemaGenerator: genMapWithRule("date-time", `self["a"] == self["b"]`),
expectedCalcCost: 8,
setMaxElements: 7,
expectedSetCost: 8,
},
{
name: "check cost of duration comparison",
schemaGenerator: genMapWithRule("duration", `self["c"] == self["d"]`),
expectedCalcCost: 8,
setMaxElements: 42,
expectedSetCost: 8,
},
}
for _, testCase := range cases {
t.Run(testCase.name, func(t *testing.T) {
Expand Down
65 changes: 30 additions & 35 deletions vendor/github.com/google/cel-go/checker/checker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 34 additions & 8 deletions vendor/github.com/google/cel-go/checker/cost.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3a4e3a0

Please sign in to comment.