Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(correlation-id): fix flaky test #14176

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions spec/03-plugins/11-correlation-id/02-schema_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
},
}
local sql = render([[
UPDATE plugins SET route_id='$(ROUTE_ID)',
protocols=ARRAY['grpc','grpcs','http','https'],
cache_key='$(CACHE_KEY)'
UPDATE plugins SET route_id='$(ROUTE_ID)',
protocols=ARRAY['grpc','grpcs','http','https'],
cache_key='$(CACHE_KEY)'
WHERE id='$(ID)';
COMMIT;
]], {
Expand Down Expand Up @@ -174,16 +174,19 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
assert.equals("uuid#counter", res.config.generator)

local proxy_client = helpers.proxy_client(20000, 9002, "127.0.0.1")
res = assert(proxy_client:send {
method = "GET",
path = "/",
headers = {
["Host"] = "example.com",
}
})
assert.res_status(200, res)
assert.is_not_nil(res.headers["Kong-Request-ID"])
helpers.pwait_until(function()
res = assert(proxy_client:send {
method = "GET",
path = "/",
headers = {
["Host"] = "example.com",
}
})
assert.res_status(200, res)
assert.is_not_nil(res.headers["Kong-Request-ID"])
end, 10)
proxy_client:close()

end)
end)
end -- for rpc_sync
Expand Down
Loading