From 4d1c3e64abfe5f70a644e54feb813cbc01785fad Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Thu, 2 Nov 2023 15:12:18 +0100 Subject: [PATCH] fix busted tests: spec/policy/apicast/apicast_spec.lua --- spec/policy/apicast/apicast_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/policy/apicast/apicast_spec.lua b/spec/policy/apicast/apicast_spec.lua index 304ae7483..f1ea05310 100644 --- a/spec/policy/apicast/apicast_spec.lua +++ b/spec/policy/apicast/apicast_spec.lua @@ -1,6 +1,16 @@ local _M = require 'apicast.policy.apicast' describe('APIcast policy', function() + local ngx_on_abort_stub + + before_each(function() + -- .access calls ngx.on_abort + -- busted tests are called in the context of ngx.timer + -- and that API ngx.on_abort is disabled in that context. + -- this stub is mocking the call + -- to prevent the internal error: API disabled in the context of ngx.timer + ngx_on_abort_stub = stub(ngx, 'on_abort') + end) it('has a name', function() assert.truthy(_M._NAME)