Skip to content

Commit

Permalink
tests(db): move the db:schema_reset to get_db_utils to allow some spe…
Browse files Browse the repository at this point in the history
…cial use cases.
  • Loading branch information
Oyami-Srk committed Oct 30, 2024
1 parent 1bc8986 commit b9e6e55
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions spec/02-integration/03-db/08-declarative_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ for _, strategy in helpers.each_strategy() do
local _
_, db = helpers.get_db_utils(strategy)

-- This is a special case, where some DB states could be corrupted by DB truncation in `lazy_teardown()`.
-- We manually bootstrap the DB here to ensure the creation of a table is done correctly
db:schema_reset()
helpers.bootstrap_database(db)

_G.kong.db = db
assert(helpers.start_kong({
database = strategy,
Expand Down
4 changes: 2 additions & 2 deletions spec/internal/db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ end


local function bootstrap_database(db)
-- Drop all schema and data
assert(db:schema_reset())
local schema_state = assert(db:schema_state())

if schema_state.needs_bootstrap then
Expand Down Expand Up @@ -317,6 +315,8 @@ local function get_db_utils(strategy, tables, plugins, vaults, skip_migrations)
assert(db:init_connector())

if not skip_migrations then
-- Drop all schema and data
assert(db:schema_reset())
bootstrap_database(db)
end

Expand Down

0 comments on commit b9e6e55

Please sign in to comment.