summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-06-17 09:18:14 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-06-17 09:18:14 +0100
commit5fe655759f0e43a57f77ab4bb910112c09c9cdb9 (patch)
treeb1880d11cd393899ccfc4ebde409a8ae9f549278
parentb5070cec811e68f5b8f8029119a059d3c3eb2ce9 (diff)
downloadfolks-5fe655759f0e43a57f77ab4bb910112c09c9cdb9.tar.gz
tests: Fix a race condition in setting up for EDS tests
Previously, we spawned the EDS source registry process, then created a .source file to it to use. However, it looks like sometimes it can notice the file part-way through us writing to it, load it, then fail to parse it. Fix that by writing out the file before spawning the EDS source registry process.
-rw-r--r--tests/lib/eds/backend.vala7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/lib/eds/backend.vala b/tests/lib/eds/backend.vala
index 7ec57b56..675fa5c0 100644
--- a/tests/lib/eds/backend.vala
+++ b/tests/lib/eds/backend.vala
@@ -158,6 +158,9 @@ public class EdsTest.Backend
"[Address Book]\n" +
"BackendName=local\n").printf (this._addressbook_name);
+ yield source_file.replace_contents_async (source_file_content.data, null,
+ false, FileCreateFlags.NONE, null, null);
+
/* Build a SourceRegistry to manage the sources. */
var source_registry = yield create_source_registry (null);
this._source_registry = source_registry;
@@ -170,9 +173,7 @@ public class EdsTest.Backend
this._prepare_source_async.callback ();
});
- /* Perform the write and then wait for the SourceRegistry to notify. */
- yield source_file.replace_contents_async (source_file_content.data, null,
- false, FileCreateFlags.NONE, null, null);
+ /* Wait for the SourceRegistry to notify if it hasn’t already. */
this._source = source_registry.ref_source (this._addressbook_name);
if (this._source == null)
{