From 19bfad76ba0ea55fcc79c7e17398c1e64a996ab2 Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Mon, 22 Jun 2026 09:17:49 +0000 Subject: [PATCH] test(autoping): add test for autoping warning exclusion on subdomain services The new test verifies that disco#info responses from subdomain services (e.g., conference servers) do not trigger the autoping warning, ensuring the check is correctly restricted to the server's own domain. --- tests/functionaltests/functionaltests.c | 1 + tests/functionaltests/test_autoping.c | 22 ++++++++++++++++++++++ tests/functionaltests/test_autoping.h | 1 + 3 files changed, 24 insertions(+) diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index b42e3a21..394b31d9 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -156,6 +156,7 @@ main(int argc, char* argv[]) PROF_FUNC_TEST(autoping_warning_not_shown_when_autoping_enabled), PROF_FUNC_TEST(autoping_warning_not_shown_when_user_disabled), PROF_FUNC_TEST(autoping_warning_not_shown_for_user_jid), + PROF_FUNC_TEST(autoping_warning_not_shown_for_subdomain_service), /* Service Discovery - XEP-0030 */ PROF_FUNC_TEST(disco_info_shows_identity), diff --git a/tests/functionaltests/test_autoping.c b/tests/functionaltests/test_autoping.c index 070254ae..c8853af1 100644 --- a/tests/functionaltests/test_autoping.c +++ b/tests/functionaltests/test_autoping.c @@ -231,3 +231,25 @@ autoping_warning_not_shown_for_user_jid(void** state) prof_timeout(NEGATIVE_ASSERT_TIMEOUT); assert_false(prof_output_regex(AUTOPING_WARNING_MATCH)); } + +void +autoping_warning_not_shown_for_subdomain_service(void** state) +{ + // disco#info from a subdomain service should not trigger the warning, only the server's own domain should + stbbr_for_query("http://jabber.org/protocol/disco#info", + "" + "" + "" + "" + "" + "" + ); + + prof_input("/autoping set 0"); + assert_true(prof_output_exact("Autoping disabled.")); + + prof_connect(); + + prof_timeout(NEGATIVE_ASSERT_TIMEOUT); + assert_false(prof_output_regex(AUTOPING_WARNING_MATCH)); +} diff --git a/tests/functionaltests/test_autoping.h b/tests/functionaltests/test_autoping.h index 73d29931..3226f9ee 100644 --- a/tests/functionaltests/test_autoping.h +++ b/tests/functionaltests/test_autoping.h @@ -9,3 +9,4 @@ void autoping_warning_not_shown_when_server_unsupported(void** state); void autoping_warning_not_shown_when_autoping_enabled(void** state); void autoping_warning_not_shown_when_user_disabled(void** state); void autoping_warning_not_shown_for_user_jid(void** state); +void autoping_warning_not_shown_for_subdomain_service(void** state);