test(chat): give diagnostic links a valid empty ACK queue

This commit is contained in:
evgeny committed 2026-10-27 05:35:27 +01:00
1 parent a9bc410aad
commit fd4c13f219
1 file changed
+5 -2
+5 -2
View File
@@ -214,7 +214,10 @@ static void details(struct UTUN_INSTANCE* inst) {
static void diagnostics(struct UTUN_INSTANCE* inst) {
struct ETCP_CONN connection = {.instance = inst, .peer_node_id = 9, .unacked_bytes = UINT32_MAX};
struct ETCP_LINK* links = u_calloc(300, sizeof(*links)); assert(links); connection.links = links;
for (int i = 0; i < 300; i++) { links[i].etcp = &connection; links[i].next = i < 299 ? links + i + 1 : NULL; }
struct ll_queue* acks = queue_new(inst->ua, 0, 0, 0, "member_test_acks"); assert(acks);
for (int i = 0; i < 300; i++) {
links[i].etcp = &connection; links[i].ack_q = acks; links[i].next = i < 299 ? links + i + 1 : NULL;
}
struct ll_entry* entry = queue_entry_new(sizeof(struct conn_queue_entry)); assert(entry);
struct conn_queue_entry* item = (struct conn_queue_entry*)entry->data; item->peer_node_id = 9; item->conn = &connection;
assert(!queue_data_put_with_index(inst->connections, entry)); expect_large_text = 1; unsigned before = text_events;
@@ -223,7 +226,7 @@ static void diagnostics(struct UTUN_INSTANCE* inst) {
assert(text_events == before + 2);
target = "strbuf.c"; fault = F_REALLOCATE; chat_core_collect_status_trampoline(inst); assert(fault == F_NONE && text_events == before + 2);
chat_core_collect_status_trampoline(inst); assert(text_events == before + 3); expect_large_text = 0;
queue_remove_data(inst->connections, entry); queue_entry_free(entry); u_free(links);
queue_remove_data(inst->connections, entry); queue_entry_free(entry); u_free(links); queue_free(acks);
if (SIZE_MAX > UINT32_MAX) {
size_t baseline = u_get_allocated_count(); struct strbuf text; strbuf_init(&text, (size_t)UINT32_MAX + 1);
assert(!text.buf && !text.cap && !text.len && u_get_allocated_count() == baseline);