From 7f36d9075e2c084591a12475138e518a84607e51 Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Fri, 3 May 2024 15:01:27 +0200 Subject: [PATCH 1/6] Fix flaky tests on CI --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 35 +++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index f4864edec7..fda66a025e 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -355,25 +355,25 @@ public void RealmObjectAPI_Counter_RealmToAtlas(TestCaseData test }, }; - [TestCaseSource(nameof(AsymmetricTestCases))] - public void RealmObjectAPI_Asymmetric_RealmToAtlas(TestCaseData testCase) - { - SyncTestHelpers.RunBaasTestAsync(async () => - { - var collection = await GetCollection(AppConfigType.FlexibleSync); - var obj = testCase.Value; - var stringProperty = obj.PartitionLike; + //[TestCaseSource(nameof(AsymmetricTestCases))] + //public void RealmObjectAPI_Asymmetric_RealmToAtlas(TestCaseData testCase) + //{ + // SyncTestHelpers.RunBaasTestAsync(async () => + // { + // var collection = await GetCollection(AppConfigType.FlexibleSync); + // var obj = testCase.Value; + // var stringProperty = obj.PartitionLike; - var filter = new { _id = obj.Id }; + // var filter = new { _id = obj.Id }; - using var realm = await GetFLXIntegrationRealmAsync(); - realm.Write(() => realm.Add(obj)); + // using var realm = await GetFLXIntegrationRealmAsync(); + // realm.Write(() => realm.Add(obj)); - var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); + // var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); - Assert.That(stringProperty, Is.EqualTo(syncObj.PartitionLike)); - }, timeout: 120000); - } + // Assert.That(stringProperty, Is.EqualTo(syncObj.PartitionLike)); + // }, timeout: 120000); + //} public static readonly object[] ObjectTestCases = { @@ -1250,7 +1250,7 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() // Retrieves the MongoClient.Collection for a specific object type and removes everything that's eventually there already private async Task> GetCollection(string appConfigType = AppConfigType.Default) - where T : class, IRealmObjectBase + where T : class, IRealmObject { var app = App.Create(SyncTestHelpers.GetAppConfig(appConfigType)); var user = await GetUserAsync(app); @@ -1262,6 +1262,9 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() var collection = client.GetCollection(); await collection.DeleteManyAsync(new object()); + var syncObjects = realm.All(); + await syncObjects.WaitForEventAsync((sender, _) => sender.Count == 0); + return collection; } From 040680d60c232edb9ddea4aa8f72cb9759bc1c10 Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Tue, 7 May 2024 10:41:07 +0200 Subject: [PATCH 2/6] Testing fix --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index fda66a025e..9d8f396d57 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -547,6 +547,7 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase AssertEqual(linkObj!.Link, obj.Link); + await WaitForConditionAsync(() => { return linkObj.List.Count == obj.List.Count; }); Assert.That(linkObj.List.Count, Is.EqualTo(obj.List.Count)); for (int i = 0; i < linkObj.List.Count; i++) @@ -554,6 +555,7 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase AssertEqual(linkObj.List[i], obj.List[i]); } + await WaitForConditionAsync(() => { return linkObj.Dictionary.Count == obj.Dictionary.Count; }); Assert.That(linkObj.Dictionary.Count, Is.EqualTo(obj.Dictionary.Count)); foreach (var key in obj.Dictionary.Keys) @@ -562,6 +564,7 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase AssertEqual(linkObj.Dictionary[key], obj.Dictionary[key]); } + await WaitForConditionAsync(() => { return linkObj.Set.Count == obj.Set.Count; }); Assert.That(linkObj.Set.Count, Is.EqualTo(obj.Set.Count)); var orderedOriginalSet = obj.Set.OrderBy(a => a.Id).ToList(); @@ -757,6 +760,7 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData { return realmValObj.RealmValueList.Count == obj.RealmValueList.Count; }); Assert.That(realmValObj.RealmValueList.Count, Is.EqualTo(obj.RealmValueList.Count)); for (int i = 0; i < realmValObj.RealmValueList.Count; i++) @@ -764,6 +768,7 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData { return realmValObj.RealmValueDictionary.Count == obj.RealmValueDictionary.Count; }); Assert.That(realmValObj.RealmValueDictionary.Count, Is.EqualTo(obj.RealmValueDictionary.Count)); foreach (var key in obj.RealmValueDictionary.Keys) @@ -772,6 +777,7 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData { return realmValObj.RealmValueSet.Count == obj.RealmValueSet.Count; }); Assert.That(realmValObj.RealmValueSet.Count, Is.EqualTo(obj.RealmValueSet.Count)); var orderedOriginalSet = obj.RealmValueSet.OrderBy(a => a.As().Id).ToList(); From 01013c71e2e731e58284777a7878c642ff938e81 Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Tue, 7 May 2024 16:12:07 +0200 Subject: [PATCH 3/6] Added missing correction --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index 9d8f396d57..1eaa147998 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -561,6 +561,8 @@ public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase foreach (var key in obj.Dictionary.Keys) { Assert.That(linkObj.Dictionary.ContainsKey(key)); + + await WaitForConditionAsync(() => { return (linkObj.Dictionary[key] == null) == (obj.Dictionary[key] == null); }); AssertEqual(linkObj.Dictionary[key], obj.Dictionary[key]); } From 29839260ca3d23cac1fae049849a43e7afce4993 Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Tue, 7 May 2024 21:25:37 +0200 Subject: [PATCH 4/6] Corrections --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index 1eaa147998..324548e279 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -758,8 +758,12 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData sender.Count >= totalCount); await realmObjs.WaitForEventAsync((sender, _) => sender.Count == 1 && realm.Find(obj.Id) != null); - var realmValObj = realm.Find(obj.Id); + var realmValObj = realm.Find(obj.Id)!; + await WaitForConditionAsync(() => { + return realmValObj.RealmValueProperty.Type == RealmValueType.Null == + (obj.RealmValueProperty.Type == RealmValueType.Null); + }); AssertEqual(realmValObj!.RealmValueProperty, obj.RealmValueProperty); await WaitForConditionAsync(() => { return realmValObj.RealmValueList.Count == obj.RealmValueList.Count; }); @@ -776,6 +780,10 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData { return realmValObj.RealmValueDictionary[key].Type == RealmValueType.Null + == (obj.RealmValueDictionary[key].Type == RealmValueType.Null); + }); + AssertEqual(realmValObj.RealmValueDictionary[key], obj.RealmValueDictionary[key]); } From 9370545903899416092bee610afd869a137615aa Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Wed, 8 May 2024 09:37:16 +0200 Subject: [PATCH 5/6] Small modifications --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 193 ++++++++++--------- 1 file changed, 98 insertions(+), 95 deletions(-) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index 324548e279..afe229e8fa 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -93,10 +93,10 @@ void AssertCollectionProps(SyncCollectionsObject expected, SyncCollectionsObject }, timeout: 120000); } - public static readonly object[] PrimitiveTestCases = + public static IEnumerable PrimitiveTestCases() { - new object[] { CreateTestCase("Empty object", new SyncAllTypesObject()) }, - new object[] + yield return new object[] { CreateTestCase("Empty object", new SyncAllTypesObject()) }; + yield return new object[] { CreateTestCase("All values", new SyncAllTypesObject { @@ -116,21 +116,21 @@ void AssertCollectionProps(SyncCollectionsObject expected, SyncCollectionsObject RealmValueProperty = "this is a string", StringProperty = "foo bar" }) - }, - new object[] { CreateTestCase("Bool RealmValue", new SyncAllTypesObject { RealmValueProperty = true }) }, - new object[] { CreateTestCase("Int RealmValue", new SyncAllTypesObject { RealmValueProperty = 123 }) }, - new object[] { CreateTestCase("Long RealmValue", new SyncAllTypesObject { RealmValueProperty = 9999999999 }) }, - new object[] { CreateTestCase("Null RealmValue", new SyncAllTypesObject { RealmValueProperty = RealmValue.Null }) }, - new object[] { CreateTestCase("String RealmValue", new SyncAllTypesObject { RealmValueProperty = "abc" }) }, - new object[] { CreateTestCase("Data RealmValue", new SyncAllTypesObject { RealmValueProperty = GetBytes(10) }) }, - new object[] { CreateTestCase("Float RealmValue", new SyncAllTypesObject { RealmValueProperty = 15.2f }) }, - new object[] { CreateTestCase("Double RealmValue", new SyncAllTypesObject { RealmValueProperty = -123.45678909876 }) }, - new object[] { CreateTestCase("Decimal RealmValue", new SyncAllTypesObject { RealmValueProperty = 1.1111111111111111111M }) }, - new object[] { CreateTestCase("Decimal RealmValue", new SyncAllTypesObject { RealmValueProperty = 1.1111111111111111111M }) }, - new object[] { CreateTestCase("Decimal128 RealmValue", new SyncAllTypesObject { RealmValueProperty = new Decimal128(2.1111111111111111111M) }) }, - new object[] { CreateTestCase("ObjectId RealmValue", new SyncAllTypesObject { RealmValueProperty = ObjectId.GenerateNewId() }) }, - new object[] { CreateTestCase("Guid RealmValue", new SyncAllTypesObject { RealmValueProperty = Guid.NewGuid() }) }, - }; + }; + yield return new object[] { CreateTestCase("Bool RealmValue", new SyncAllTypesObject { RealmValueProperty = true }) }; + yield return new object[] { CreateTestCase("Int RealmValue", new SyncAllTypesObject { RealmValueProperty = 123 }) }; + yield return new object[] { CreateTestCase("Long RealmValue", new SyncAllTypesObject { RealmValueProperty = 9999999999 }) }; + yield return new object[] { CreateTestCase("Null RealmValue", new SyncAllTypesObject { RealmValueProperty = RealmValue.Null }) }; + yield return new object[] { CreateTestCase("String RealmValue", new SyncAllTypesObject { RealmValueProperty = "abc" }) }; + yield return new object[] { CreateTestCase("Data RealmValue", new SyncAllTypesObject { RealmValueProperty = GetBytes(10) }) }; + yield return new object[] { CreateTestCase("Float RealmValue", new SyncAllTypesObject { RealmValueProperty = 15.2f }) }; + yield return new object[] { CreateTestCase("Double RealmValue", new SyncAllTypesObject { RealmValueProperty = -123.45678909876 }) }; + yield return new object[] { CreateTestCase("Decimal RealmValue", new SyncAllTypesObject { RealmValueProperty = 1.1111111111111111111M }) }; + yield return new object[] { CreateTestCase("Decimal RealmValue", new SyncAllTypesObject { RealmValueProperty = 1.1111111111111111111M }) }; + yield return new object[] { CreateTestCase("Decimal128 RealmValue", new SyncAllTypesObject { RealmValueProperty = new Decimal128(2.1111111111111111111M) }) }; + yield return new object[] { CreateTestCase("ObjectId RealmValue", new SyncAllTypesObject { RealmValueProperty = ObjectId.GenerateNewId() }) }; + yield return new object[] { CreateTestCase("Guid RealmValue", new SyncAllTypesObject { RealmValueProperty = Guid.NewGuid() }) }; + } [TestCaseSource(nameof(PrimitiveTestCases))] public void RealmObjectAPI_Primitive_AtlasToRealm(TestCaseData testCase) @@ -269,9 +269,9 @@ public void RealmObjectAPI_DateTime_RealmToAtlas_SpecialCase() }, timeout: 120000); } - public static readonly object[] CounterTestCases = + public static IEnumerable CounterTestCases() { - new object[] + yield return new object[] { CreateTestCase("All values", new CounterObject { @@ -285,8 +285,8 @@ public void RealmObjectAPI_DateTime_RealmToAtlas_SpecialCase() NullableInt32Property = 49394939, NullableInt64Property = 889898965342443 }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("Nullable values", new CounterObject { @@ -300,8 +300,8 @@ public void RealmObjectAPI_DateTime_RealmToAtlas_SpecialCase() NullableInt32Property = null, NullableInt64Property = null, }) - }, - }; + }; + } [TestCaseSource(nameof(CounterTestCases))] public void RealmObjectAPI_Counter_AtlasToRealm(TestCaseData testCase) @@ -347,44 +347,44 @@ public void RealmObjectAPI_Counter_RealmToAtlas(TestCaseData test }, timeout: 120000); } - public static readonly object[] AsymmetricTestCases = + public static IEnumerable AsymmetricTestCases() { - new object[] + yield return new object[] { CreateTestCase("Base", new BasicAsymmetricObject { PartitionLike = "testString" }) - }, - }; + }; + } - //[TestCaseSource(nameof(AsymmetricTestCases))] - //public void RealmObjectAPI_Asymmetric_RealmToAtlas(TestCaseData testCase) - //{ - // SyncTestHelpers.RunBaasTestAsync(async () => - // { - // var collection = await GetCollection(AppConfigType.FlexibleSync); - // var obj = testCase.Value; - // var stringProperty = obj.PartitionLike; + [TestCaseSource(nameof(AsymmetricTestCases))] + public void RealmObjectAPI_Asymmetric_RealmToAtlas(TestCaseData testCase) + { + SyncTestHelpers.RunBaasTestAsync(async () => + { + var collection = await GetCollection(AppConfigType.FlexibleSync); + var obj = testCase.Value; + var stringProperty = obj.PartitionLike; - // var filter = new { _id = obj.Id }; + var filter = new { _id = obj.Id }; - // using var realm = await GetFLXIntegrationRealmAsync(); - // realm.Write(() => realm.Add(obj)); + using var realm = await GetFLXIntegrationRealmAsync(); + realm.Write(() => realm.Add(obj)); - // var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); + var syncObj = await WaitForNonNullObjectAsync(() => collection.FindOneAsync(filter)); - // Assert.That(stringProperty, Is.EqualTo(syncObj.PartitionLike)); - // }, timeout: 120000); - //} + Assert.That(stringProperty, Is.EqualTo(syncObj.PartitionLike)); + }, timeout: 120000); + } - public static readonly object[] ObjectTestCases = + public static IEnumerable ObjectTestCases() { - new object[] + yield return new object[] { CreateTestCase("All values", new SyncAllTypesObject { ObjectProperty = new IntPropertyObject { Int = 23 }, }) - }, - }; + }; + } [TestCaseSource(nameof(ObjectTestCases))] public void RealmObjectAPI_Object_AtlasToRealm(TestCaseData testCase) @@ -443,17 +443,17 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData }, timeout: 120000); } - public static readonly object[] LinksTestCases = + public static IEnumerable LinksTestCases() { - new object[] + yield return new object[] { CreateTestCase("Single link", new LinksObject("singleLink") { Link = new("second") { Value = 2 }, Value = 1, }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("List", new LinksObject("listLink") { @@ -464,8 +464,8 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData }, Value = 987 }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("Dictionary", new LinksObject("dictLink") { @@ -477,8 +477,8 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData }, Value = 999 }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("Set", new LinksObject("setLink") { @@ -489,8 +489,8 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData }, Value = 123 }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("All types", new LinksObject("parent") { @@ -513,8 +513,8 @@ public void RealmObjectAPI_Object_RealmToAtlas(TestCaseData ["dict_null"] = null } }), - } - }; + }; + } [TestCaseSource(nameof(LinksTestCases))] public void RealmObjectAPI_Links_AtlasToRealm(TestCaseData testCase) @@ -658,16 +658,16 @@ static async Task AssertEqual(MongoClient.Collection collection, Li }, timeout: 120000); } - public static readonly object[] RealmValueLinkTestCases = + public static IEnumerable RealmValueLinkTestCases() { - new object[] + yield return new object[] { CreateTestCase("Single link", new RealmValueObject { RealmValueProperty = new IntPropertyObject { Int = 2 }, }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("List", new RealmValueObject { @@ -677,8 +677,8 @@ static async Task AssertEqual(MongoClient.Collection collection, Li new IntPropertyObject { Int = 200 }, }, }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("Dictionary", new RealmValueObject { @@ -689,8 +689,8 @@ static async Task AssertEqual(MongoClient.Collection collection, Li ["key_2"] = new IntPropertyObject { Int = 200 }, }, }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("Set", new RealmValueObject { @@ -700,8 +700,8 @@ static async Task AssertEqual(MongoClient.Collection collection, Li new IntPropertyObject { Int = 200 }, }, }), - }, - new object[] + }; + yield return new object[] { CreateTestCase("All types", new RealmValueObject { @@ -723,8 +723,8 @@ static async Task AssertEqual(MongoClient.Collection collection, Li ["dict_null"] = RealmValue.Null } }), - } - }; + }; + } [TestCaseSource(nameof(RealmValueLinkTestCases))] public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData testCase) @@ -887,9 +887,9 @@ static async Task AssertEqual(MongoClient.Collection collecti }, timeout: 120000); } - public static readonly object[] EmbeddedTestCases = + public static IEnumerable EmbeddedTestCases() { - new object[] + yield return new object[] { CreateTestCase("Single", new ObjectWithEmbeddedProperties { @@ -902,8 +902,8 @@ static async Task AssertEqual(MongoClient.Collection collecti StringProperty = "bla bla" } }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("Recursive", new ObjectWithEmbeddedProperties { @@ -920,9 +920,8 @@ static async Task AssertEqual(MongoClient.Collection collecti } } }) - }, - - new object[] + }; + yield return new object[] { CreateTestCase("List", new ObjectWithEmbeddedProperties { @@ -946,8 +945,8 @@ static async Task AssertEqual(MongoClient.Collection collecti } }, }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("Dictionary", new ObjectWithEmbeddedProperties { @@ -972,8 +971,8 @@ static async Task AssertEqual(MongoClient.Collection collecti ["key3"] = null, }, }) - }, - new object[] + }; + yield return new object[] { CreateTestCase("All types", new ObjectWithEmbeddedProperties { @@ -1037,8 +1036,8 @@ static async Task AssertEqual(MongoClient.Collection collecti ["key3"] = null, }, }) - } - }; + }; + } [TestCaseSource(nameof(EmbeddedTestCases))] public void RealmObjectAPI_Embedded_AtlasToRealm(TestCaseData testCase) @@ -1266,30 +1265,26 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() // Retrieves the MongoClient.Collection for a specific object type and removes everything that's eventually there already private async Task> GetCollection(string appConfigType = AppConfigType.Default) - where T : class, IRealmObject + where T : class, IRealmObjectBase { - var app = App.Create(SyncTestHelpers.GetAppConfig(appConfigType)); - var user = await GetUserAsync(app); - - SyncConfigurationBase config = appConfigType == AppConfigType.FlexibleSync ? GetFLXIntegrationConfig(user) : GetIntegrationConfig(user); + var config = await GetConfig(appConfigType); + var user = config.User; using var realm = await GetRealmAsync(config, true); var client = user.GetMongoClient(ServiceName); var collection = client.GetCollection(); await collection.DeleteManyAsync(new object()); - var syncObjects = realm.All(); - await syncObjects.WaitForEventAsync((sender, _) => sender.Count == 0); + //var syncObjects = realm.All(); + //await syncObjects.WaitForEventAsync((sender, _) => sender.Count == 0); return collection; } private async Task> GetCollectionAsBson(string collectionName, string appConfigType = AppConfigType.Default) { - var app = App.Create(SyncTestHelpers.GetAppConfig(appConfigType)); - var user = await GetUserAsync(app); - - SyncConfigurationBase config = appConfigType == AppConfigType.FlexibleSync ? GetFLXIntegrationConfig(user) : GetIntegrationConfig(user); + var config = await GetConfig(appConfigType); + var user = config.User; using var realm = await GetRealmAsync(config, true); var client = user.GetMongoClient(ServiceName); @@ -1301,6 +1296,14 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() return collection; } + private async Task GetConfig(string appConfigType = AppConfigType.Default) + { + var app = App.Create(SyncTestHelpers.GetAppConfig(appConfigType)); + var user = await GetUserAsync(app); + + return appConfigType == AppConfigType.FlexibleSync ? GetFLXIntegrationConfig(user) : GetIntegrationConfig(user); + } + private static void AssertEmbedded(ObjectWithEmbeddedProperties syncObj, ObjectWithEmbeddedProperties obj) { var props = EmbeddedAllTypesObject.RealmSchema From 12b8ffed6d54960c381e219b8404e17f39b0c4da Mon Sep 17 00:00:00 2001 From: Ferdinando Papale <4850119+papafe@users.noreply.github.com> Date: Wed, 29 May 2024 14:29:16 +0200 Subject: [PATCH 6/6] Small corrections --- Tests/Realm.Tests/Sync/StaticQueriesTests.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs index afe229e8fa..094aee8a50 100644 --- a/Tests/Realm.Tests/Sync/StaticQueriesTests.cs +++ b/Tests/Realm.Tests/Sync/StaticQueriesTests.cs @@ -760,7 +760,8 @@ public void RealmObjectAPI_RealmValueLinks_AtlasToRealm(TestCaseData(obj.Id)!; - await WaitForConditionAsync(() => { + await WaitForConditionAsync(() => + { return realmValObj.RealmValueProperty.Type == RealmValueType.Null == (obj.RealmValueProperty.Type == RealmValueType.Null); }); @@ -780,8 +781,9 @@ await WaitForConditionAsync(() => { foreach (var key in obj.RealmValueDictionary.Keys) { Assert.That(realmValObj.RealmValueDictionary.ContainsKey(key)); - await WaitForConditionAsync(() => { return realmValObj.RealmValueDictionary[key].Type == RealmValueType.Null - == (obj.RealmValueDictionary[key].Type == RealmValueType.Null); + await WaitForConditionAsync(() => + { + return realmValObj.RealmValueDictionary[key].Type == RealmValueType.Null == (obj.RealmValueDictionary[key].Type == RealmValueType.Null); }); AssertEqual(realmValObj.RealmValueDictionary[key], obj.RealmValueDictionary[key]); @@ -1275,9 +1277,6 @@ public void RealmObjectAPI_MissingField_GetsDefaultValueWhenDeserialized() var collection = client.GetCollection(); await collection.DeleteManyAsync(new object()); - //var syncObjects = realm.All(); - //await syncObjects.WaitForEventAsync((sender, _) => sender.Count == 0); - return collection; }