Skip to content

Commit

Permalink
tests(key-auth): remove the use of mockbin.com during tests (#12017)
Browse files Browse the repository at this point in the history
mockbin.com redirects to insomnia official site and could trigger a security policy, which makes tests failing.

KAG-3091
  • Loading branch information
StarlightIbuki authored Nov 15, 2023
1 parent 4d1fbba commit 31f0cc9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions spec/03-plugins/09-key-auth/02-access_spec.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
local helpers = require "spec.helpers"
local cjson = require "cjson"
local meta = require "kong.meta"
local utils = require "kong.tools.utils"
local helpers = require "spec.helpers"
local cjson = require "cjson"
local meta = require "kong.meta"
local utils = require "kong.tools.utils"
local http_mock = require "spec.helpers.http_mock"

local MOCK_PORT = helpers.get_available_port()

for _, strategy in helpers.each_strategy() do
describe("Plugin: key-auth (access) [#" .. strategy .. "]", function()
local proxy_client
local mock, proxy_client
local kong_cred

lazy_setup(function()
mock = http_mock.new(MOCK_PORT)
mock:start()
local bp = helpers.get_db_utils(strategy, {
"routes",
"services",
Expand Down Expand Up @@ -51,8 +56,8 @@ for _, strategy in helpers.each_strategy() do

local service7 = bp.services:insert{
protocol = "http",
port = 80,
host = "mockbin.com",
port = MOCK_PORT,
host = "localhost",
}

local route7 = bp.routes:insert {
Expand Down Expand Up @@ -183,6 +188,7 @@ for _, strategy in helpers.each_strategy() do
end

helpers.stop_kong()
mock:stop()
end)

describe("Unauthorized", function()
Expand Down

1 comment on commit 31f0cc9

@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:31f0cc9ff21c2c73cedc6991b0a4976d204df9d2
Artifacts available https://github.com/Kong/kong/actions/runs/6872861421

Please sign in to comment.