From 1ce15913a6d6ec7c3663ef2a70c1034ebc0e268c Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 6 Feb 2025 10:34:47 +0800 Subject: [PATCH] more tests --- .../18-hybrid_rpc/10-validate_deltas_spec.lua | 6 ++++++ .../kong/plugins/rpc-validation-test/handler.lua | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/spec/02-integration/18-hybrid_rpc/10-validate_deltas_spec.lua b/spec/02-integration/18-hybrid_rpc/10-validate_deltas_spec.lua index 354ccbe47ae..269c492dda8 100644 --- a/spec/02-integration/18-hybrid_rpc/10-validate_deltas_spec.lua +++ b/spec/02-integration/18-hybrid_rpc/10-validate_deltas_spec.lua @@ -55,6 +55,7 @@ for _, strategy in helpers.each_strategy() do "[error]", true, 10) assert.logfile(name).has.line( "unable to create worker mutex and sync", true, 10) + assert.logfile(name).has.line( "'name': required field missing", true, 10) assert.logfile(name).has.line( @@ -62,6 +63,11 @@ for _, strategy in helpers.each_strategy() do assert.logfile(name).has.line( "'config': expected a record", true, 10) + assert.logfile(name).has.line( + "'key': expected a string", true, 10) + assert.logfile(name).has.line( + "'value': expected a string", true, 10) + local name = nil -- cp logs diff --git a/spec/fixtures/custom_plugins/kong/plugins/rpc-validation-test/handler.lua b/spec/fixtures/custom_plugins/kong/plugins/rpc-validation-test/handler.lua index d73b7b542dc..9bd56f38f2f 100644 --- a/spec/fixtures/custom_plugins/kong/plugins/rpc-validation-test/handler.lua +++ b/spec/fixtures/custom_plugins/kong/plugins/rpc-validation-test/handler.lua @@ -28,6 +28,15 @@ function RpcSyncV2ValidationHandler:init_worker() version = latest_version, ws_id = fake_uuid, }, + { + entity = { + key = 100, -- should be a string + value = {}, -- should be a string + }, + type = "parameters", + version = latest_version, + ws_id = fake_uuid, + }, } ngx.log(ngx.DEBUG, "kong.sync.v2.get_delta ok")