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

[backport -> release/3.6.x] tests: fix flakiness #12581

Merged
merged 4 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions spec/02-integration/07-sdk/03-cluster_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
local helpers = require("spec.helpers")
local CP_MOCK_PORT = helpers.get_available_port()
local DP_MOCK_PORT = helpers.get_available_port()

local uuid_pattern = "^" .. ("%x"):rep(8) .. "%-" .. ("%x"):rep(4) .. "%-"
.. ("%x"):rep(4) .. "%-" .. ("%x"):rep(4) .. "%-"
Expand All @@ -10,7 +12,7 @@ local fixtures_dp = {
fixtures_dp.http_mock.my_server_block = [[
server {
server_name my_server;
listen 62349;
listen ]] .. DP_MOCK_PORT .. [[;

location = "/hello" {
content_by_lua_block {
Expand All @@ -28,7 +30,7 @@ local fixtures_cp = {
fixtures_cp.http_mock.my_server_block = [[
server {
server_name my_server;
listen 62350;
listen ]] .. CP_MOCK_PORT .. [[;

location = "/hello" {
content_by_lua_block {
Expand Down Expand Up @@ -83,7 +85,7 @@ for _, strategy in helpers.each_strategy() do
end)

it("kong.cluster.get_id() in Hybrid mode", function()
proxy_client = helpers.http_client(helpers.get_proxy_ip(false), 62350)
proxy_client = helpers.http_client(helpers.get_proxy_ip(false), CP_MOCK_PORT)

local res = proxy_client:get("/hello")
local cp_cluster_id = assert.response(res).has_status(200)
Expand All @@ -93,7 +95,7 @@ for _, strategy in helpers.each_strategy() do
proxy_client:close()

helpers.wait_until(function()
proxy_client = helpers.http_client(helpers.get_proxy_ip(false), 62349)
proxy_client = helpers.http_client(helpers.get_proxy_ip(false), DP_MOCK_PORT)
local res = proxy_client:get("/hello")
local body = assert.response(res).has_status(200)
proxy_client:close()
Expand Down
7 changes: 5 additions & 2 deletions spec/02-integration/09-hybrid_mode/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ end)
describe("when CP exits before DP", function()
local need_exit = true

setup(function()
lazy_setup(function()
-- reset and bootstrap DB before starting CP
helpers.get_db_utils(nil)

assert(helpers.start_kong({
role = "control_plane",
prefix = "servroot1",
Expand All @@ -179,7 +182,7 @@ describe("when CP exits before DP", function()
}))
end)

teardown(function()
lazy_teardown(function()
if need_exit then
helpers.stop_kong("servroot1")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/38-ai-proxy/02-openai_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/38-ai-proxy/04-cohere_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/38-ai-proxy/05-azure_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/38-ai-proxy/07-llama2_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local pl_file = require "pl.file"

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local cjson = require "cjson"
local inflate_gzip = require("kong.tools.gzip").inflate_gzip

local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = 62349
local MOCK_PORT = helpers.get_available_port()

local openai_driver = require("kong.llm.drivers.openai")

Expand Down
Loading
Loading