Skip to content

Commit

Permalink
Fix issues with the new jsonschema
Browse files Browse the repository at this point in the history
With the update, exclusiveM* functions are now checked and some unit
tests failed due to invalid data.

Also set window to min 0, because test: `TEST 22: Window is set to 0 and
default is 1.` is already checking this.

Signed-off-by: Eloy Coto <[email protected]>
  • Loading branch information
eloycoto committed Apr 2, 2020
1 parent 3b73569 commit 378b601
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gateway/src/apicast/policy/rate_limit/apicast-policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"window": {
"type": "integer",
"description": "The time window in seconds before the request count is reset",
"exclusiveMinimum": 0,
"minimum": 0,
"default": 1
}
}
Expand Down
8 changes: 4 additions & 4 deletions spec/policy/rate_limit/rate_limit_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ describe('Rate limit policy', function()
it('does not crash', function()
local rate_limit_policy = RateLimitPolicy.new({
connection_limiters = {
{ key = { name = 'test1', scope = 'global' }, conn = 0, burst = 0, delay = 0 }
{ key = { name = 'test1', scope = 'global' }, conn = 1, burst = 0, delay = 0.5 }
},
leaky_bucket_limiters = {
{ key = { name = 'test2', scope = 'global' }, rate = 0, burst = 0 }
{ key = { name = 'test2', scope = 'global' }, rate = 1, burst = 0 }
},
fixed_window_limiters = {
{ key = { name = 'test3', scope = 'global' }, count = 0, window = 0 }
{ key = { name = 'test3', scope = 'global' }, count = 1, window = 1 }
},
})

Expand All @@ -98,7 +98,7 @@ describe('Rate limit policy', function()
it('works with multiple limiters', function()
local rate_limit_policy = RateLimitPolicy.new({
connection_limiters = {
{ key = { name = 'test1', scope = 'global' }, conn = 20, burst = 10, delay = 0.5 }
{ key = { name = 'test1', scope = 'global' }, conn = 20, burst = 10, delay = 0.4 }
},
leaky_bucket_limiters = {
{ key = { name = 'test2', scope = 'global' }, rate = 18, burst = 9 }
Expand Down

0 comments on commit 378b601

Please sign in to comment.