Verify member save requests owner shutdown if rollback remains open
This commit is contained in:
1 parent
fc5c0d0919
commit
b7b64233c7
1 file changed
+11
@@ -666,6 +666,17 @@ static void member_save_faults(struct UTUN_INSTANCE* inst) {
|
||||
assert(sqlite3_exec(inst->topo_sqlite_db, "BEGIN", NULL, NULL, NULL) == SQLITE_OK);
|
||||
assert(chat_core_save_member(inst, channel, inst->node_id, "foreign", "") < 0 && !sqlite3_get_autocommit(inst->topo_sqlite_db));
|
||||
assert(sqlite3_exec(inst->topo_sqlite_db, "ROLLBACK", NULL, NULL, NULL) == SQLITE_OK);
|
||||
for (int owner = 0; owner < 2; owner++) {
|
||||
uint8_t before[32], after[32]; snapshot(reader, before); int running = inst->running;
|
||||
target = owner ? "COMMIT /* tags */" : "COMMIT /* nickname */";
|
||||
fault = F_EXEC; fail_rollback = 1; inst->running = 1;
|
||||
assert(chat_core_save_member(inst, channel, inst->node_id, "failed rollback",
|
||||
owner ? "{\"owner_test\":\"failed rollback\"}" : "") < 0);
|
||||
assert(fault == F_NONE && !fail_rollback && !inst->running && !sqlite3_get_autocommit(inst->topo_sqlite_db));
|
||||
snapshot(reader, after); assert(!memcmp(before, after, sizeof(before)));
|
||||
target = NULL; assert(sqlite3_exec(inst->topo_sqlite_db, "ROLLBACK", NULL, NULL, NULL) == SQLITE_OK);
|
||||
inst->running = running;
|
||||
}
|
||||
printf("PASS member save:%u SQL failures/retries preserve nickname,owner signature and Merkle atomically\n", cases);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user