Skip to content

Commit

Permalink
tests(dao): ignore updated_at field during comparison of the update a…
Browse files Browse the repository at this point in the history
…nd upsert operations (#10767)

* tests(dao): ignore updated_at field during comparison of the update and upsert operations

* tests(dao): verify updated_at for update and upsert operations
  • Loading branch information
AndyZhang0707 authored Nov 20, 2024
1 parent 28da712 commit fa0ad5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/02-integration/03-db/14-dao_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ for _, strategy in helpers.all_strategies() do

local read_plugin, err = kong.db.plugins:update_by_instance_name(plugin2.instance_name, updated_plugin)
assert.is_nil(err)
-- skip the updated_at field during comparison as it is updated during the update operation
assert.is_true(read_plugin.updated_at >= plugin2.updated_at);
updated_plugin.updated_at = read_plugin.updated_at
assert.same(updated_plugin, read_plugin)
end)

Expand All @@ -167,6 +170,9 @@ for _, strategy in helpers.all_strategies() do

local read_plugin, err = kong.db.plugins:upsert_by_instance_name(plugin2.instance_name, updated_plugin)
assert.is_nil(err)
-- skip the updated_at field during comparison as it is updated during the upsert operation
assert.is_true(read_plugin.updated_at >= plugin2.updated_at);
updated_plugin.updated_at = read_plugin.updated_at
assert.same(updated_plugin, read_plugin)

-- new plugin upsert (insert part of upsert)
Expand Down

0 comments on commit fa0ad5f

Please sign in to comment.