Total priority buffer overflow check

This commit is contained in:
ravisantoshgudimetla
2017-04-28 16:31:53 -04:00
parent dbce213ea6
commit 7ae3136f5d
5 changed files with 75 additions and 5 deletions

View File

@@ -51,6 +51,13 @@ func TestValidatePriorityWithNegativeWeight(t *testing.T) {
}
}
func TestValidatePriorityWithOverFlowWeight(t *testing.T) {
policy := api.Policy{Priorities: []api.PriorityPolicy{{Name: "WeightPriority", Weight: api.MaxWeight}}}
if ValidatePolicy(policy) == nil {
t.Errorf("Expected error about priority weight not being overflown.")
}
}
func TestValidateExtenderWithNonNegativeWeight(t *testing.T) {
extenderPolicy := api.Policy{ExtenderConfigs: []api.ExtenderConfig{{URLPrefix: "http://127.0.0.1:8081/extender", FilterVerb: "filter", Weight: 2}}}
errs := ValidatePolicy(extenderPolicy)