Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lhanjian committed Dec 19, 2024
1 parent 1181873 commit a028af9
Showing 1 changed file with 44 additions and 43 deletions.
87 changes: 44 additions & 43 deletions spec/02-integration/09-hybrid_mode/11-status_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,60 +108,61 @@ for _, strategy in helpers.each_strategy() do

-- now dp receive config from cp, so dp should be ready

skip_rpc_sync("should return 200 on data plane after configuring", function()
helpers.wait_until(function()
local http_client = helpers.http_client('127.0.0.1', dp_status_port)

local res = http_client:send({
method = "GET",
path = "/status/ready",
})
if rpc_sync == "off" then
it("should return 200 on data plane after configuring", function()
helpers.wait_until(function()
local http_client = helpers.http_client('127.0.0.1', dp_status_port)

local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)
local res = http_client:send({
method = "GET",
path = "/status/ready",
})

assert(helpers.stop_kong("serve_cp", nil, nil, "QUIT", false))
local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)

-- DP should keep return 200 after CP is shut down
helpers.wait_until(function()
assert(helpers.stop_kong("serve_cp", nil, nil, "QUIT", false))

local http_client = helpers.http_client('127.0.0.1', dp_status_port)
-- DP should keep return 200 after CP is shut down
helpers.wait_until(function()

local res = http_client:send({
method = "GET",
path = "/status/ready",
})
local http_client = helpers.http_client('127.0.0.1', dp_status_port)

local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)
local res = http_client:send({
method = "GET",
path = "/status/ready",
})

-- recovery state between tests
assert(start_kong_cp())
local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)

helpers.wait_until(function()
local http_client = helpers.http_client('127.0.0.1', dp_status_port)
-- recovery state between tests
assert(start_kong_cp())

local res = http_client:send({
method = "GET",
path = "/status/ready",
})
helpers.wait_until(function()
local http_client = helpers.http_client('127.0.0.1', dp_status_port)

local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)
local res = http_client:send({
method = "GET",
path = "/status/ready",
})

end)
local status = res and res.status
http_client:close()
if status == 200 then
return true
end
end, 10)
end)
end
end)

if rpc == "on" and rpc_sync == "on" then
Expand Down

0 comments on commit a028af9

Please sign in to comment.