Skip to content

Commit

Permalink
Fix various failing CI tests (#3535)
Browse files Browse the repository at this point in the history
* Increased timeouts

* Adding waiting for initial sync to be finished

* Corrected queries tests

* Fixed timeouts

* Corrected test

* Corrections
  • Loading branch information
papafe authored Feb 26, 2024
1 parent 777d1a0 commit cc1a1ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Tests/Realm.Tests/Sync/SessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ public void Session_WaitForUpload_CanBeCancelled()

sw.Stop();

Assert.That(sw.ElapsedMilliseconds, Is.LessThan(5));
Assert.That(sw.ElapsedMilliseconds, Is.LessThan(30));
});
}

Expand Down Expand Up @@ -1377,7 +1377,7 @@ public void Session_WaitForDownload_CanBeCancelled()

sw.Stop();

Assert.That(sw.ElapsedMilliseconds, Is.LessThan(5));
Assert.That(sw.ElapsedMilliseconds, Is.LessThan(30));
Assert.That(readerRealm.All<SyncAllTypesObject>().Count(), Is.Zero);

await GetSession(readerRealm).WaitForDownloadAsync();
Expand Down
8 changes: 4 additions & 4 deletions Tests/Realm.Tests/Sync/StaticQueriesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData<LinksObject> testCase
var linkObjs = await realm.All<LinksObject>().SubscribeAsync();

await realm.SyncSession.WaitForDownloadAsync();
await linkObjs.WaitForEventAsync((sender, _) => sender.Count >= totalCount);
await linkObjs.WaitForEventAsync((sender, _) => sender.Count >= totalCount && realm.Find<LinksObject>(obj.Id) != null);

var linkObj = realm.Find<LinksObject>(obj.Id);

Expand Down Expand Up @@ -752,7 +752,7 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData<RealmValueO
var realmObjs = await realm.All<RealmValueObject>().SubscribeAsync();

await intObjs.WaitForEventAsync((sender, _) => sender.Count >= totalCount);
await realmObjs.WaitForEventAsync((sender, _) => sender.Count >= 1);
await realmObjs.WaitForEventAsync((sender, _) => sender.Count == 1 && realm.Find<RealmValueObject>(obj.Id) != null);

var realmValObj = realm.Find<RealmValueObject>(obj.Id);

Expand Down Expand Up @@ -1257,7 +1257,7 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized()

SyncConfigurationBase config = appConfigType == AppConfigType.FlexibleSync ? GetFLXIntegrationConfig(user) : GetIntegrationConfig(user);

using var realm = await GetRealmAsync(config);
using var realm = await GetRealmAsync(config, true);
var client = user.GetMongoClient(ServiceName);
var collection = client.GetCollection<T>();
await collection.DeleteManyAsync(new object());
Expand All @@ -1272,7 +1272,7 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized()

SyncConfigurationBase config = appConfigType == AppConfigType.FlexibleSync ? GetFLXIntegrationConfig(user) : GetIntegrationConfig(user);

using var realm = await GetRealmAsync(config);
using var realm = await GetRealmAsync(config, true);
var client = user.GetMongoClient(ServiceName);
var db = client.GetDatabase(SyncTestHelpers.SyncMongoDBName(appConfigType));

Expand Down
4 changes: 2 additions & 2 deletions Tests/Realm.Tests/Sync/UserManagementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,11 +1166,11 @@ public void UserCustomDataChange_RaisesChanged()

await tcs.Task;

tcs = new();

// Unsubscribe and verify that it no longer raises user changed
user.Changed -= OnUserChanged;

tcs = new();

var filter = BsonDocument.Parse(@"{
user_id: { $eq: """ + user.Id + @""" }
}");
Expand Down

0 comments on commit cc1a1ef

Please sign in to comment.