[jsonrpc-glib] tests: be more lenient giving async processing



commit b4e39f80c38e28ca290df6b63875ee503673f79d
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 12 20:24:25 2018 +0200

    tests: be more lenient giving async processing
    
    We can't exactly guarantee things with buffering and what not from the
    underlying streams. So make this more tolerant of that to hopefully reduce
    some transient test failures.

 tests/test-gauntlet.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/tests/test-gauntlet.c b/tests/test-gauntlet.c
index 73cff9f..e7d2a63 100644
--- a/tests/test-gauntlet.c
+++ b/tests/test-gauntlet.c
@@ -52,14 +52,17 @@ call_cb (GObject      *object,
   gboolean r;
 
   r = jsonrpc_client_call_finish (JSONRPC_CLIENT (object), result, &res, &error);
-  g_assert_cmpint (error->domain, ==, G_IO_ERROR);
+
+  if (r == FALSE)
+    {
+      g_assert_cmpint (error->domain, ==, G_IO_ERROR);
 #if 0
-  /* We can't really guarantee this, given the ways the socket errors
-   * can be propagated.
-   */
-  g_assert (error->code == 0 || error->code == G_IO_ERROR_NOT_CONNECTED);
+      /* We can't really guarantee this, given the ways the socket errors
+       * can be propagated.
+       */
+      g_assert (error->code == 0 || error->code == G_IO_ERROR_NOT_CONNECTED);
 #endif
-  g_assert_false (r);
+    }
 
   g_main_loop_quit (main_loop);
 }


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