Comparison

spec/core_storagemanager_spec.lua @ 13243:c5ccdfbbe9c1

tests: Update storagemanager tests for prosody.* namespace change Part of an attempt to make these tests work again. Previously they would just explode in a million luarocks stack overflows
author Kim Alvefur <zash@zash.se>
date Sat, 22 Jul 2023 16:17:13 +0200
parent 13133:3692265becb7
child 13244:2902c54f45a6
comparison
equal deleted inserted replaced
13242:0d3881bf29a8 13243:c5ccdfbbe9c1
1 local unpack = table.unpack; 1 local unpack = table.unpack;
2 local server = require "net.server_select"; 2
3 package.loaded["net.server"] = server; 3 local st = require "prosody.util.stanza";
4
5 local st = require "util.stanza";
6 4
7 local function mock_prosody() 5 local function mock_prosody()
8 _G.prosody = { 6 _G.prosody = {
9 core_post_stanza = function () end; 7 core_post_stanza = function () end;
10 events = require "util.events".new(); 8 events = require "prosody.util.events".new();
11 hosts = {}; 9 hosts = {};
12 paths = { 10 paths = {
13 data = "./data"; 11 data = "./data";
14 }; 12 };
15 }; 13 };
45 tagged_name = tagged_name.." #"..backend_config.storage; 43 tagged_name = tagged_name.." #"..backend_config.storage;
46 end 44 end
47 insulate(tagged_name.." #storage backend", function () 45 insulate(tagged_name.." #storage backend", function ()
48 mock_prosody(); 46 mock_prosody();
49 47
50 local config = require "core.configmanager"; 48 local config = require "prosody.core.configmanager";
51 local sm = require "core.storagemanager"; 49 local sm = require "prosody.core.storagemanager";
52 local hm = require "core.hostmanager"; 50 local hm = require "prosody.core.hostmanager";
53 local mm = require "core.modulemanager"; 51 local mm = require "prosody.core.modulemanager";
54 52
55 -- Simple check to ensure insulation is working correctly 53 -- Simple check to ensure insulation is working correctly
56 assert.is_nil(config.get(test_host, "storage")); 54 assert.is_nil(config.get(test_host, "storage"));
57 55
58 for k, v in pairs(backend_config) do 56 for k, v in pairs(backend_config) do