Skip to content

Commit

Permalink
tests(*): yet another compilation of flakiness fixes (#11522)
Browse files Browse the repository at this point in the history
* chore(tests): update time for time sensitive tests

* chore(tests): wait_until for flaky test
  • Loading branch information
StarlightIbuki authored Sep 8, 2023
1 parent fd64029 commit 9b39c5b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ for _, strategy in helpers.each_strategy() do
end)

it("broadcasts an event with a delay", function()
ngx.update_time()
local cluster_events_1 = assert(kong_cluster_events.new {
db = db,
node_id = uuid_1,
Expand Down
25 changes: 17 additions & 8 deletions spec/03-plugins/25-oauth2/04-invalidations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,23 @@ for _, strategy in helpers.each_strategy() do
})
assert.res_status(200, res)

-- Check that cache is populated
local cache_key = db.oauth2_tokens:cache_key(token.access_token)
local res = assert(admin_client:send {
method = "GET",
path = "/cache/" .. cache_key,
headers = {}
})
assert.res_status(200, res)
local cache_key
helpers.wait_until(function()
-- Check that cache is populated
cache_key = db.oauth2_tokens:cache_key(token.access_token)
local res = assert(admin_client:send {
method = "GET",
path = "/cache/" .. cache_key,
headers = {}
})

-- Discard body in case we need to retry. Otherwise the connection will mess up.
res:read_body()
if res.status ~= 200 then
assert.logfile().has.no.line("[error]", true)
end
return 200 == res.status
end, 5)

local res = db.oauth2_tokens:select_by_access_token(token.access_token)
local token_id = res.id
Expand Down

1 comment on commit 9b39c5b

@khcp-gha-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:9b39c5bdbc13867919f7ab9ad770decee88abb4d
Artifacts available https://github.com/Kong/kong/actions/runs/6117611207

Please sign in to comment.