diff --git a/changedetectionio/tests/test_errorhandling.py b/changedetectionio/tests/test_errorhandling.py index f37d99d6..40c89242 100644 --- a/changedetectionio/tests/test_errorhandling.py +++ b/changedetectionio/tests/test_errorhandling.py @@ -5,8 +5,6 @@ import time from flask import url_for from .util import live_server_setup, wait_for_all_checks -from ..html_tools import * - def test_setup(live_server): live_server_setup(live_server) @@ -79,7 +77,14 @@ def test_DNS_errors(client, live_server, measure_memory_usage): wait_for_all_checks(client) res = client.get(url_for("watchlist.index")) - found_name_resolution_error = b"No address found" in res.data or b"Name or service not known" in res.data + found_name_resolution_error = ( + b"No address found" in res.data or + b"Name or service not known" in res.data or + b"nodename nor servname provided" in res.data or + b"Temporary failure in name resolution" in res.data or + b"Failed to establish a new connection" in res.data or + b"Connection error occurred" in res.data + ) assert found_name_resolution_error # Should always record that we tried assert bytes("just now".encode('utf-8')) in res.data @@ -108,7 +113,14 @@ def test_low_level_errors_clear_correctly(client, live_server, measure_memory_us # We should see the DNS error res = client.get(url_for("watchlist.index")) - found_name_resolution_error = b"No address found" in res.data or b"Name or service not known" in res.data + found_name_resolution_error = ( + b"No address found" in res.data or + b"Name or service not known" in res.data or + b"nodename nor servname provided" in res.data or + b"Temporary failure in name resolution" in res.data or + b"Failed to establish a new connection" in res.data or + b"Connection error occurred" in res.data + ) assert found_name_resolution_error # Update with what should work @@ -123,7 +135,14 @@ def test_low_level_errors_clear_correctly(client, live_server, measure_memory_us # Now the error should be gone wait_for_all_checks(client) res = client.get(url_for("watchlist.index")) - found_name_resolution_error = b"No address found" in res.data or b"Name or service not known" in res.data + found_name_resolution_error = ( + b"No address found" in res.data or + b"Name or service not known" in res.data or + b"nodename nor servname provided" in res.data or + b"Temporary failure in name resolution" in res.data or + b"Failed to establish a new connection" in res.data or + b"Connection error occurred" in res.data + ) assert not found_name_resolution_error res = client.get(url_for("ui.form_delete", uuid="all"), follow_redirects=True) diff --git a/changedetectionio/tests/test_notification_errors.py b/changedetectionio/tests/test_notification_errors.py index 97215aaa..3861df83 100644 --- a/changedetectionio/tests/test_notification_errors.py +++ b/changedetectionio/tests/test_notification_errors.py @@ -60,7 +60,15 @@ def test_check_notification_error_handling(client, live_server, measure_memory_u # The error should show in the notification logs res = client.get( url_for("settings.notification_logs")) - found_name_resolution_error = b"No address found" in res.data or b"Name or service not known" in res.data + # Check for various DNS/connection error patterns that may appear in different environments + found_name_resolution_error = ( + b"No address found" in res.data or + b"Name or service not known" in res.data or + b"nodename nor servname provided" in res.data or + b"Temporary failure in name resolution" in res.data or + b"Failed to establish a new connection" in res.data or + b"Connection error occurred" in res.data + ) assert found_name_resolution_error # And the working one, which is after the 'broken' one should still have fired