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

test(ai-proxy): fix red test due to other feature break http protocol behavior #13848

Merged
merged 1 commit into from
Nov 7, 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
14 changes: 3 additions & 11 deletions spec/03-plugins/38-ai-proxy/02-openai_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ local _EXPECTED_CHAT_STATS = {
},
}

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -826,13 +825,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
-- Note: if file is removed instead of trunacted, file-log ends writing to a unlinked file handle
truncate_file(FILE_LOG_PATH_STATS_ONLY)
truncate_file(FILE_LOG_PATH_NO_LOGS)
Expand Down Expand Up @@ -1701,5 +1694,4 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)
end)

end end
end -- for _, client_protocol
end end
14 changes: 3 additions & 11 deletions spec/03-plugins/38-ai-proxy/03-anthropic_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ local deepcompare = require("pl.tablex").deepcompare
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -516,13 +515,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, true)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -787,5 +780,4 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)
end)

end end
end -- for _, client_protocol
end end
14 changes: 3 additions & 11 deletions spec/03-plugins/38-ai-proxy/04-cohere_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ local pl_file = require "pl.file"
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function() local client
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function() local client

lazy_setup(function()
local bp = helpers.get_db_utils(strategy == "off" and "postgres" or strategy, nil, { PLUGIN_NAME })
Expand Down Expand Up @@ -390,13 +389,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -629,5 +622,4 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)
end)

end end
end -- for _, client_protocol
end end
14 changes: 3 additions & 11 deletions spec/03-plugins/38-ai-proxy/05-azure_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ local pl_file = require "pl.file"
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -408,13 +407,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -656,5 +649,4 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)
end)

end end
end -- for _, client_protocol
end end
12 changes: 2 additions & 10 deletions spec/03-plugins/38-ai-proxy/06-mistral_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ local pl_file = require "pl.file"
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -344,13 +343,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -519,4 +512,3 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

end end
end -- for _, client_protocol
14 changes: 3 additions & 11 deletions spec/03-plugins/38-ai-proxy/07-llama2_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ local pl_file = require "pl.file"
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do

for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -193,13 +192,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -450,5 +443,4 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)
end)

end end
end -- for _, client_protocol
end end
12 changes: 2 additions & 10 deletions spec/03-plugins/38-ai-proxy/08-encoding_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ local plugin_conf = {
},
}

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -242,13 +241,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -376,4 +369,3 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
----

end end
end -- for _, client_protocol
12 changes: 2 additions & 10 deletions spec/03-plugins/38-ai-proxy/09-streaming_integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ local http = require("resty.http")
local PLUGIN_NAME = "ai-proxy"
local MOCK_PORT = helpers.get_available_port()

for _, client_protocol in ipairs({ "http", "https", "http2" }) do
for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "] [#" .. client_protocol .. "]", function()
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client

lazy_setup(function()
Expand Down Expand Up @@ -501,13 +500,7 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

before_each(function()
if client_protocol == "http" then
client = helpers.proxy_client()
elseif client_protocol == "https" then
client = helpers.proxy_ssl_client()
elseif client_protocol == "http2" then
client = helpers.proxy_ssl_client(nil, nil, 2)
end
client = helpers.proxy_client()
end)

after_each(function()
Expand Down Expand Up @@ -819,4 +812,3 @@ for _, strategy in helpers.all_strategies() do if strategy ~= "cassandra" then
end)

end end
end -- for _, client_protocol
Loading