Skip to content

Commit

Permalink
tests(db/declarative): fix corrupted parameters table
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed May 10, 2024
1 parent 03f056c commit f922754
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/02-integration/03-db/08-declarative_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ for _, strategy in helpers.each_strategy() do
password = crypto.hash(consumer_def.id, "MI6"),
}

local function ensure_cluster_id_exists()
local res = db.parameters:select({ key = "cluster_id", })

-- table is broken for some unknown reason
if not res then
db.connector:query(
"BEGIN;\n" ..
"INSERT INTO parameters (key, value) VALUES('cluster_id', 'fake-cluster-id');" ..
"COMMIT;\n"
)
end

res = db.parameters:select({ key = "cluster_id", })
assert(res and res.value)
end

before_each(function()
db.acls:truncate()
db.basicauth_credentials:truncate()
Expand All @@ -205,6 +221,8 @@ for _, strategy in helpers.each_strategy() do
db.certificates:truncate()
db.consumers:truncate()

ensure_cluster_id_exists()

assert(declarative.load_into_db({
snis = { [sni_def.id] = sni_def },
certificates = { [certificate_def.id] = certificate_def },
Expand Down

0 comments on commit f922754

Please sign in to comment.