Initialize media test dependencies and await committed sync
This commit is contained in:
1 parent
7fb9b43e9e
commit
14b01964b1
2 files changed
+11
-4
No files matched your search
@@ -185,9 +185,13 @@ static void phase_a1_super_hello(void) {
|
||||
if (g_inst[2]->md.is_supernode && g_inst[3]->md.is_supernode) OK(); else FAIL();
|
||||
}
|
||||
TEST("automatic CHAT replication s1↔s2"); {
|
||||
int a = 0; while (a < 500) { uasync_poll(g_ua, POLL_MS); a++; }
|
||||
int ok1 = g_inst[2]->md.super_peers && g_inst[2]->md.super_peers->head != NULL;
|
||||
int ok2 = g_inst[3]->md.super_peers && g_inst[3]->md.super_peers->head != NULL;
|
||||
int a = 0, ok1 = 0, ok2 = 0;
|
||||
while (a++ < 4000) {
|
||||
ok1 = db_count(g_inst[2]->md.db, "super_sync", "group_id", g_group_id) > 0;
|
||||
ok2 = db_count(g_inst[3]->md.db, "super_sync", "group_id", g_group_id) > 0;
|
||||
if (ok1 && ok2) break;
|
||||
uasync_poll(g_ua, POLL_MS);
|
||||
}
|
||||
if (ok1 && ok2) OK(); else FAIL("s1=%d s2=%d", ok1, ok2);
|
||||
}
|
||||
}
|
||||
@@ -443,8 +447,9 @@ int main(void) {
|
||||
test_etcp_set_peer(g_inst[i], peer, g_inst[i - 1], "s1");
|
||||
}
|
||||
utun_instance_init(g_inst[i]);
|
||||
media_delivery_init(g_inst[i]);
|
||||
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]));
|
||||
}
|
||||
|
||||
mon(NULL);
|
||||
|
||||
@@ -64,6 +64,8 @@ static void test_paging(void) {
|
||||
static void test_holder_selection(void) {
|
||||
reset(); struct UTUN_INSTANCE* s = instance(SERVER); struct UTUN_INSTANCE* c = instance(CLIENT);
|
||||
struct media_index_result r = result(2); seed(s, &r, 2, 6, 0);
|
||||
/* Нулевой держатель запрещён схемой; для защиты QUERY от повреждённой БД отключаем CHECK только в стенде. */
|
||||
REQUIRE(sqlite3_exec(s->topo_sqlite_db, "PRAGMA ignore_check_constraints=ON", NULL, NULL, NULL) == SQLITE_OK);
|
||||
REQUIRE(sqlite3_exec(s->topo_sqlite_db,
|
||||
"UPDATE block_availability SET group_id=112 WHERE node_id=1000;"
|
||||
"INSERT INTO block_availability(block_uuid,group_id,node_id,chunk,timestamp,status)"
|
||||
|
||||
Reference in new issue
Block a user