Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
chobits committed Dec 11, 2024
1 parent 599b970 commit 55453de
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions spec/02-integration/09-hybrid_mode/11-status_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ local helpers = require "spec.helpers"
local cp_status_port = helpers.get_available_port()
local dp_status_port = 8100

for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
--for _, v in ipairs({ {"off", "off"}, {"on", "off"}, {"on", "on"}, }) do
for _, v in ipairs({ {"on", "on"}, }) do
local rpc, inc_sync = v[1], v[2]

for _, strategy in helpers.each_strategy() do
Expand Down Expand Up @@ -105,7 +106,7 @@ for _, strategy in helpers.each_strategy() do

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

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

Expand Down Expand Up @@ -165,9 +166,40 @@ for _, strategy in helpers.each_strategy() do
return true
end
end, 10)

-- insert one entity to make dp ready for incremental sync
if inc_sync == "on" then
ngx.sleep(1)
print("+++++ post /services")
local admin_client = helpers.admin_client(10000)
local res = assert(admin_client:post("/services", {
body = { name = "service-001", url = "https://127.0.0.1:15556/request", },
headers = {["Content-Type"] = "application/json"}
}))
assert.res_status(201, res)
admin_client:close()

print("++++++= sleep")
--ngx.sleep(1000000)
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",
})

local status = res and res.status
http_client:close()
-- print("++++++++++" .. status)

if status == 200 then
return true
end
end, 10)
end
end)
end)
end)

end)
end -- for _, strategy
end -- for inc_sync

0 comments on commit 55453de

Please sign in to comment.