From c6c22a469bbcc1cd76f19bb9f2c71981b68c698c Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 9 Nov 2024 09:26:33 +0800 Subject: [PATCH] check log file --- .../19-incrmental_sync/01-sync_spec.lua | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/spec/02-integration/19-incrmental_sync/01-sync_spec.lua b/spec/02-integration/19-incrmental_sync/01-sync_spec.lua index ac5dcef2f5df..3b1af4f02e21 100644 --- a/spec/02-integration/19-incrmental_sync/01-sync_spec.lua +++ b/spec/02-integration/19-incrmental_sync/01-sync_spec.lua @@ -76,6 +76,11 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) end) it("update route on CP", function() @@ -133,6 +138,11 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) end) it("delete route on CP", function() @@ -170,6 +180,11 @@ describe("Incremental Sync RPC #" .. strategy, function() end end, 10) + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) + res = assert(admin_client:delete("/services/service-003/routes/" .. route_id)) assert.res_status(204, res) @@ -187,6 +202,8 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] delete entity", true) end) it("update route on CP with name", function() @@ -243,6 +260,11 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) end) it("delete route on CP with name", function() @@ -279,6 +301,11 @@ describe("Incremental Sync RPC #" .. strategy, function() end end, 10) + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) + res = assert(admin_client:delete("/services/service-005/routes/route-005")) assert.res_status(204, res) @@ -296,6 +323,8 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] delete entity", true) end) it("cascade delete on CP", function() @@ -335,6 +364,11 @@ describe("Incremental Sync RPC #" .. strategy, function() end end, 10) + assert.logfile().has.line("[kong.sync.v2] config push (connected client)", true) + assert.logfile().has.no.line("unable to update clustering data plane status", true) + + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] update entity", true) + -- create consumer and key-auth res = assert(admin_client:post("/consumers", { @@ -393,6 +427,9 @@ describe("Incremental Sync RPC #" .. strategy, function() return true end end, 10) + + assert.logfile().has.line("[kong.sync.v2] new delta due to cascade deleting", true) + assert.logfile("servroot2/logs/error.log").has.line("[kong.sync.v2] delete entity", true) end) end)