mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Add unit tests.
This commit is contained in:
parent
4a703d6cbc
commit
6042d781f5
@ -1593,6 +1593,27 @@ func TestCostEstimation(t *testing.T) {
|
|||||||
setMaxElements: 10,
|
setMaxElements: 10,
|
||||||
expectedSetCost: 6,
|
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 {
|
for _, testCase := range cases {
|
||||||
t.Run(testCase.name, func(t *testing.T) {
|
t.Run(testCase.name, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user