diff --git a/spec/02-integration/09-hybrid_mode/11-status_spec.lua b/spec/02-integration/09-hybrid_mode/11-status_spec.lua index 86cd8941819..7db58b87777 100644 --- a/spec/02-integration/09-hybrid_mode/11-status_spec.lua +++ b/spec/02-integration/09-hybrid_mode/11-status_spec.lua @@ -74,9 +74,6 @@ for _, strategy in helpers.each_strategy() do end) describe("dp status ready endpoint for no config", function() - -- XXX FIXME - local skip_rpc_sync = rpc_sync == "on" and pending or it - lazy_setup(function() assert(start_kong_cp()) assert(start_kong_dp()) @@ -107,8 +104,8 @@ for _, strategy in helpers.each_strategy() do end) -- now dp receive config from cp, so dp should be ready - - skip_rpc_sync("should return 200 on data plane after configuring", function() + local it_rpc_sync_off= rpc_sync == "off" and it or pending + it_rpc_sync_off("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) @@ -160,10 +157,59 @@ for _, strategy in helpers.each_strategy() do return true end end, 10) - end) end) + local describe_rpc_sync_on = rpc == "on" and rpc_sync == "on" and describe or pending + describe_rpc_sync_on("dp status ready when rpc_sync == on", function() + lazy_setup(function() + assert(start_kong_cp()) + assert(start_kong_dp()) + end) + + lazy_teardown(function() + assert(helpers.stop_kong("serve_cp")) + assert(helpers.stop_kong("serve_dp")) + end) + + it("should return 200 on data plane after configuring when rpc_sync == on", function() + -- insert one entity to make dp ready for incremental sync + + local http_client = helpers.http_client('127.0.0.1', dp_status_port) + + local res = http_client:send({ + method = "GET", + path = "/status/ready", + }) + http_client:close() + assert.equal(503, res.status) + + 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() + + 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() + + if status == 200 then + return true + end + end, 10) + end) + end) end) end -- for _, strategy end -- for rpc_sync