Skip to content

Commit

Permalink
spec/policy/3scale_batcher: adapt specs to use TimerTask
Browse files Browse the repository at this point in the history
  • Loading branch information
davidor committed Jun 28, 2018
1 parent 39b00af commit 11ccd3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/policy/3scale_batcher/3scale_batcher_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ local Transaction = require('apicast.policy.3scale_batcher.transaction')
local Usage = require('apicast.usage')
local configuration = require('apicast.configuration')
local lrucache = require('resty.lrucache')
local TimerTask = require('resty.concurrent.timer_task')

describe('3scale batcher policy', function()
before_each(function()
TimerTask.active_tasks = {}
end)

describe('.new', function()
it('allows to configure the batching period', function()
local test_batching_period = 3
Expand Down Expand Up @@ -42,6 +47,10 @@ describe('3scale batcher policy', function()
batcher_policy.auths_cache = AuthsCache.new(lrucache.new(10), 10)
stub(batcher_policy.reports_batcher, 'add')

-- if a report job executes, by default, stub the batcher so it returns
-- no pending reports.
stub(batcher_policy.reports_batcher, 'get_all').returns({})

stub(batcher_policy, 'backend_downtime_cache')

context = {
Expand Down

0 comments on commit 11ccd3d

Please sign in to comment.