summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-11-11 17:14:30 +0100
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-11-16 00:24:31 +0100
commit62033732542d7effaf8b40fbe9df79f69a3e59d3 (patch)
treeebb41a4513c5818a67ff0d4b51d818b153fc19b0 /tests
parentba5db440c07c3f8c76622dd955f9d6429809cde2 (diff)
downloaddconf-62033732542d7effaf8b40fbe9df79f69a3e59d3.tar.gz
engine: Limit the number of in-flight requests to one
Reduce the number of in-flight requests to one, so as to increase chances of merging pending requests. Drop the in-flight queue since it is no longer useful, replacing it with optional changeset.
Diffstat (limited to 'tests')
-rw-r--r--tests/client.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/tests/client.c b/tests/client.c
index 25f99f3..1773ed1 100644
--- a/tests/client.c
+++ b/tests/client.c
@@ -58,7 +58,7 @@ queue_up_100_writes (DConfClient *client)
gint i;
/* We send 100 writes, letting them pile up.
- * At no time should there be more than 2 writes on the wire.
+ * At no time should there be more than one write on the wire.
*/
for (i = 0; i < 100; i++)
{
@@ -71,7 +71,7 @@ queue_up_100_writes (DConfClient *client)
check_and_free (dconf_client_read_full (client, "/test/value", DCONF_READ_DEFAULT_VALUE, NULL), NULL);
}
- g_assert_cmpint (g_queue_get_length (&dconf_mock_dbus_outstanding_call_handles), ==, 2);
+ g_assert_cmpint (g_queue_get_length (&dconf_mock_dbus_outstanding_call_handles), ==, 1);
}
static void
@@ -108,7 +108,6 @@ static void
test_fast (void)
{
DConfClient *client;
- gint i;
g_log_set_writer_func (log_writer_cb, NULL, NULL);
@@ -119,30 +118,23 @@ test_fast (void)
/* Start indicating that the writes failed.
*
- * For the first failures, we should continue to see the most recently
- * written value (99).
- *
- * After we fail that last one, we should see NULL returned.
+ * Because of the pending-merge logic, we should only have had to fail two calls.
*
* Each time, we should see a change notify.
*/
- for (i = 0; g_queue_get_length (&dconf_mock_dbus_outstanding_call_handles) > 1; i++)
- {
- changed_was_called = FALSE;
- fail_one_call ();
- g_assert (changed_was_called);
+ g_assert_cmpint (g_queue_get_length (&dconf_mock_dbus_outstanding_call_handles), == , 1);
- check_and_free (dconf_client_read (client, "/test/value"), g_variant_new_int32 (99));
- check_and_free (dconf_client_read_full (client, "/test/value", DCONF_READ_DEFAULT_VALUE, NULL), NULL);
- }
+ changed_was_called = FALSE;
+ fail_one_call ();
+ g_assert (changed_was_called);
- /* Because of the pending-merging logic, we should only have had to
- * fail two calls.
- */
- g_assert (i == 2);
+ /* For the first failure, we should continue to see the most recently written value (99) */
+ check_and_free (dconf_client_read (client, "/test/value"), g_variant_new_int32 (99));
+ check_and_free (dconf_client_read_full (client, "/test/value", DCONF_READ_DEFAULT_VALUE, NULL), NULL);
+
+ g_assert_cmpint (g_queue_get_length (&dconf_mock_dbus_outstanding_call_handles), == , 1);
- /* Fail the last call. */
changed_was_called = FALSE;
fail_one_call ();
g_assert (changed_was_called);
@@ -228,9 +220,8 @@ test_coalesce (void)
dconf_mock_dbus_async_reply (g_variant_new ("(s)", "1"), NULL);
dconf_mock_dbus_async_reply (g_variant_new ("(s)", "2"), NULL);
- dconf_mock_dbus_async_reply (g_variant_new ("(s)", "3"), NULL);
- /* There should be no more requests since all but first two have been
+ /* There should be no more requests since all but first have been
* coalesced together. */
dconf_mock_dbus_assert_no_async ();