[glib-networking/mcatanzaro/session-resumption] Improve reliability of client auth failure tests



commit a7b7f6e4683d02a6d9cce333cd768b7ed8c3d756
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 6 20:29:59 2019 -0500

    Improve reliability of client auth failure tests

 tls/tests/connection.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index eed4785..652585e 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -1114,7 +1114,12 @@ test_client_auth_failure (TestConnection *test,
   g_main_loop_run (test->loop);
   wait_until_server_finished (test);
 
-  g_assert_error (test->read_error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED);
+  /* FIXME: Too many possible timing-dependent errors here. */
+  if (!g_error_matches (test->read_error, G_TLS_ERROR, G_TLS_ERROR_NOT_TLS) &&
+      !g_error_matches (test->read_error, G_TLS_ERROR, G_TLS_ERROR_EOF))
+    {
+      g_assert_error (test->read_error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED);
+    }
   g_assert_error (test->server_error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED);
 
   g_assert_true (accepted_changed);
@@ -1305,10 +1310,15 @@ test_client_auth_request_fail (TestConnection *test,
   g_main_loop_run (test->loop);
   wait_until_server_finished (test);
 
-  /* G_FILE_ERROR_ACCES is the error returned by our mock interaction object
-   * when the GTlsInteraction's certificate request fails.
-   */
-  g_assert_error (test->read_error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+  /* FIXME: Too many possible timing-dependent errors here. */
+  if (!g_error_matches (test->read_error, G_TLS_ERROR, G_TLS_ERROR_NOT_TLS) &&
+      !g_error_matches (test->read_error, G_TLS_ERROR, G_TLS_ERROR_EOF))
+    {
+      /* G_FILE_ERROR_ACCES is the error returned by our mock interaction object
+       * when the GTlsInteraction's certificate request fails.
+       */
+      g_assert_error (test->read_error, G_FILE_ERROR, G_FILE_ERROR_ACCES);
+    }
   g_assert_error (test->server_error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED);
 
   g_io_stream_close (test->server_connection, NULL, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]