aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-08-15 12:28:58 +0200
committerKim Alvefur <zash@zash.se>2021-08-15 12:28:58 +0200
commitf679f0b26eb20b702dd274b136e21218c73bc3de (patch)
treed49d73c4f65edd5d8783cab7b9619e9bf5a24d1f
parentd4b9f814fe698f60a2b08f27f45d2aab4d2523e7 (diff)
downloadprosody-f679f0b26eb20b702dd274b136e21218c73bc3de.tar.gz
prosody-f679f0b26eb20b702dd274b136e21218c73bc3de.zip
core.storagemanager: Respect archive ids issued by storage drivers in tests
Storage drivers may issue their own IDs tho none of the included ones do this atm, but the 3rd party module mod_storage_xmlarchive has its special format.
-rw-r--r--spec/core_storagemanager_spec.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/core_storagemanager_spec.lua b/spec/core_storagemanager_spec.lua
index b8f6db31..e8d9fc97 100644
--- a/spec/core_storagemanager_spec.lua
+++ b/spec/core_storagemanager_spec.lua
@@ -497,8 +497,9 @@ describe("storagemanager", function ()
it("overwrites existing keys with new data", function ()
local prefix = ("a"):rep(50);
local username = "user-overwrite";
- assert(archive:append(username, prefix.."-1", test_stanza, test_time, "contact@example.com"));
- assert(archive:append(username, prefix.."-2", test_stanza, test_time, "contact@example.com"));
+ local a1 = assert(archive:append(username, prefix.."-1", test_stanza, test_time, "contact@example.com"));
+ local a2 = assert(archive:append(username, prefix.."-2", test_stanza, test_time, "contact@example.com"));
+ local ids = { a1, a2, };
do
local data = assert(archive:find(username, {}));
@@ -506,7 +507,7 @@ describe("storagemanager", function ()
for id, item, when in data do --luacheck: ignore 213/when
count = count + 1;
assert.truthy(id);
- assert.equals(("%s-%d"):format(prefix, count), id);
+ assert.equals(ids[count], id);
assert(st.is_stanza(item));
end
assert.equal(2, count);
@@ -514,7 +515,7 @@ describe("storagemanager", function ()
local new_stanza = st.clone(test_stanza);
new_stanza.attr.foo = "bar";
- assert(archive:append(username, prefix.."-2", new_stanza, test_time+1, "contact2@example.com"));
+ assert(archive:append(username, a2, new_stanza, test_time+1, "contact2@example.com"));
do
local data = assert(archive:find(username, {}));
@@ -522,7 +523,7 @@ describe("storagemanager", function ()
for id, item, when in data do
count = count + 1;
assert.truthy(id);
- assert.equals(("%s-%d"):format(prefix, count), id);
+ assert.equals(ids[count], id);
assert(st.is_stanza(item));
if count == 2 then
assert.equals(test_time+1, when);