Avoid random HEX substring collisions in config updater assertions

This commit is contained in:
evgeny committed 2026-10-21 23:12:12 +02:00
1 parent 7c473dd500
commit 1d7e12c562
1 file changed
+3 -2
+3 -2
View File
@@ -230,7 +230,7 @@ static void test_identity_and_text(void) {
assert(!config_ensure_keys_and_node_id(path));
check_identity(NULL);
read_text(before, sizeof(before));
assert(!strstr(before, "bad"));
assert(!strstr(before, "my_private_key=bad\n") && !strstr(before, "my_private_key=still_bad\n"));
assert(!config_ensure_keys_and_node_id(path));
read_text(text, sizeof(text));
assert(!strcmp(before, text));
@@ -259,7 +259,8 @@ static void test_reality_and_validation(void) {
assert(config && config->global.reality.has_private_key && config->global.reality.short_id_count == 4);
free_config(config);
read_text(before, sizeof(before));
assert(!strstr(before, "bad") && !strstr(before, invalid_hex));
// Случайный корректный HEX может содержать "bad"; проверяем удаление исходного неверного значения целиком.
assert(!strstr(before, "short_ids=0102030405060708,bad\n") && !strstr(before, invalid_hex));
assert(!config_ensure_keys_and_node_id(path));
read_text(text, sizeof(text));
assert(!strcmp(before, text));