Require role subscription and initialize real chat test contexts
This commit is contained in:
1 parent
14b01964b1
commit
d6d8ffc4a8
3 files changed
+15
-6
No files matched your search
@@ -14,8 +14,8 @@
|
||||
// 4. Второй клиент n2 скачивает медиа «по запросу» и собирает файл.
|
||||
//
|
||||
// Используется настоящий db_sync для доставки сообщения и настоящий media-движок
|
||||
// для доставки блоков. chat_core НЕ используется (он — глобальный синглтон на процесс),
|
||||
// поэтому связка «сообщение → auto-download» воспроизведена локальным insert-callback'ом.
|
||||
// для доставки блоков. Связка «сообщение → auto-download» задаётся тестовым insert-callback'ом;
|
||||
// per-instance chat_core хранит подписки на роли и общую БД каждого узла.
|
||||
|
||||
#include "media_delivery.h"
|
||||
#include <assert.h>
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "media_download.h"
|
||||
#include "media_index.h"
|
||||
#include "member_sync.h"
|
||||
#include "../chat/chat_core.h"
|
||||
#include "db_sync.h"
|
||||
#include "../routing_layer/topo_node_sqlite.h"
|
||||
#include "../utun_instance.h"
|
||||
@@ -479,7 +480,7 @@ static void setup_chat_group(void) {
|
||||
|
||||
TEST("automatic SYNC s1<->s2 (via CHAT)"); {
|
||||
int a = 0, ok = 0;
|
||||
while (a < 1000) {
|
||||
while (a < 4000) {
|
||||
ok = db_count(g_inst[I_S1]->md.db, "super_sync", "group_id", g_group_id) > 0
|
||||
&& db_count(g_inst[I_S2]->md.db, "super_sync", "group_id", g_group_id) > 0;
|
||||
if (ok) break;
|
||||
@@ -571,8 +572,10 @@ int main(void) {
|
||||
test_etcp_set_peer(g_inst[i], peer, g_inst[j], "s1");
|
||||
}
|
||||
utun_instance_init(g_inst[i]);
|
||||
media_delivery_init(g_inst[i]);
|
||||
member_sync_init(g_inst[i]);
|
||||
char chat_db[512]; snprintf(chat_db, sizeof(chat_db), "%s/chats.db", g_db_dir[i]);
|
||||
if (chat_core_init(g_inst[i], chat_db) || member_sync_init(g_inst[i]) || media_delivery_init(g_inst[i])) {
|
||||
FAIL("chat/media initialization n%d", i); goto done;
|
||||
}
|
||||
}
|
||||
|
||||
mon(NULL);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "media_download.h"
|
||||
#include "media_index.h"
|
||||
#include "member_sync.h"
|
||||
#include "../chat/chat_core.h"
|
||||
#include "../routing_layer/topo_node_sqlite.h"
|
||||
#include "../utun_instance.h"
|
||||
#include "../transport_layer/etcp.h"
|
||||
@@ -447,6 +448,8 @@ int main(void) {
|
||||
test_etcp_set_peer(g_inst[i], peer, g_inst[i - 1], "s1");
|
||||
}
|
||||
utun_instance_init(g_inst[i]);
|
||||
char chat_db[512]; snprintf(chat_db, sizeof(chat_db), "%s/chats.db", g_db_dir[i]);
|
||||
if (chat_core_init(g_inst[i], chat_db)) { FAIL("chat_core_init n%d", i); goto done; }
|
||||
if (member_sync_init(g_inst[i]) < 0) { FAIL("member_sync_init n%d", i); goto done; }
|
||||
assert(!media_index_init(g_inst[i]->topo_sqlite_db));
|
||||
assert(!media_delivery_init(g_inst[i]));
|
||||
|
||||
Reference in new issue
Block a user