Skip to content

Commit

Permalink
fix: cleanup [1316]
Browse files Browse the repository at this point in the history
```
$ make busted-util
/usr/local/openresty/luajit/bin/rover exec bin/busted "spec/threescale_utils_spec.lua"
●●●
3 successes / 0 failures / 0 errors / 0 pending : 0.023738 seconds
```
  • Loading branch information
abarrak committed Feb 10, 2022
1 parent ad69ecc commit faf8d62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gateway/src/apicast/threescale_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function _M.connect_redis(options)
local opts = {}

local url = options and options.url or env.get('REDIS_URL')
local resilient = options.resilient or false
local resilient = options.resilient

if url then
url = resty_url.split(url, 'redis')
Expand Down Expand Up @@ -194,7 +194,7 @@ function _M.error(resilient, ...)
else
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.say(...)
if not resilient or resilient == nil then
if not resilient then
ngx.exit(ngx.status)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/threescale_utils_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('3scale utils', function()
stub(ngx, 'say', function(...) return nil end)
local exit = spy.on(ngx, 'exit', function(s) return 'exited!' end)

local error = _M.error(false, 'cache issue ' .. 'host:' .. 6379)
local error = _M.error(nil, 'cache issue ' .. 'host:' .. 6379)

assert.spy(ngx.exit).was_called(1)
assert.spy(ngx.say).was.called_with('cache issue ' .. 'host:' .. 6379)
Expand Down

0 comments on commit faf8d62

Please sign in to comment.