From a3f004772a917e467ab46c22d3c2b09cc162571b Mon Sep 17 00:00:00 2001 From: evgeny Date: Sat, 24 Oct 2026 20:20:09 +0200 Subject: [PATCH] Align ETCP fixtures with NCD identity and failed-open contracts --- tests/test_etcp_connect.c | 4 ++-- tests/test_etcp_stcp.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_etcp_connect.c b/tests/test_etcp_connect.c index 67904869..8da1c19c 100644 --- a/tests/test_etcp_connect.c +++ b/tests/test_etcp_connect.c @@ -118,7 +118,7 @@ static void test3(void* arg) { (void)arg; if (result) return; fprintf(stderr, "Test 3: unreachable node → error\n"); fflush(stderr); struct SC_MYKEYS fk; sc_generate_keypair(&fk); - uint64_t fnid = 0xF000000000000001ULL; + uint64_t fnid = sc_derive_node_id_from_pubkey(fk.public_key); struct TOPO_GROUP_NODE* fn = mknode(g_a, fnid, fk.public_key, 127,0,0,1, 49999); if (!fn) { fail("mknode failed"); return; } queue_data_put_with_index(topo_groups_get_default(g_a->topo_groups)->nodes, &fn->ll); @@ -148,7 +148,7 @@ static void test5(void* arg) { (void)arg; if (result) return; fprintf(stderr, "Test 5: double connect to unreachable → both callbacks\n"); fflush(stderr); struct SC_MYKEYS fk; sc_generate_keypair(&fk); - uint64_t fnid = 0xF000000000000002ULL; + uint64_t fnid = sc_derive_node_id_from_pubkey(fk.public_key); struct TOPO_GROUP_NODE* fn = mknode(g_a, fnid, fk.public_key, 127,0,0,1, 49998); if (!fn) { fail("mknode failed"); return; } queue_data_put_with_index(topo_groups_get_default(g_a->topo_groups)->nodes, &fn->ll); diff --git a/tests/test_etcp_stcp.c b/tests/test_etcp_stcp.c index 5f1eb996..bd5f5a5c 100644 --- a/tests/test_etcp_stcp.c +++ b/tests/test_etcp_stcp.c @@ -437,7 +437,8 @@ static void tcp_creation_case(int reality, int side, unsigned action) { else etcp_add_link_status_cbk(inst, cancel_tcp_creation, &test); int result = node_conn_direct_open_node(endpoints[0].inst, peer->node_id, NULL, NULL, &endpoints[0].owner, peer, NULL); - CHECK(result >= 0 || (side == 0 && (action == 2 || action == 4))); + if (side == 0 && action != 3) CHECK(result == NCD_ERR && !endpoints[0].owner); + else CHECK(result >= 0 && endpoints[0].owner); uint64_t deadline = get_time_tb() + 30000; while (!test.fired && get_time_tb() < deadline) test_clock_poll(ua, 100); CHECK(test.fired == 1);