Browse Source

Ferretdb (#1239)

* Generate with AI.

* FerretDb

* Fixes

* Update packages.

* No resizer.

* Lock deadlocks.

* Make ferret optional.
pull/1241/head
Sebastian Stehle 11 months ago
committed by GitHub
parent
commit
a70d738da4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      .github/workflows/dev.yml
  2. 7
      .github/workflows/release.yml
  3. 14
      backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj
  4. 55
      backend/src/Squidex.Data.MongoDb/Domain/Apps/Entities/Contents/Text/MongoTextIndexBase.cs
  5. 16
      backend/src/Squidex.Data.MongoDb/Infrastructure/MongoExtensions.cs
  6. 12
      backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj
  7. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj
  8. 4
      backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj
  9. 14
      backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj
  10. 24
      backend/src/Squidex/Squidex.csproj
  11. 8
      tools/TestSuite/TestSuite.ApiTests/ContentCollationTests.cs
  12. 18
      tools/TestSuite/TestSuite.Shared/AssetStrategies.cs
  13. 2
      tools/TestSuite/TestSuite.Shared/ClientExtensions.cs
  14. 2
      tools/TestSuite/TestSuite.Shared/ClientWrapper.cs
  15. 64
      tools/TestSuite/TestSuite.Shared/ContentStrategies.cs
  16. 6
      tools/TestSuite/TestSuite.Shared/Fixtures/ClientFixture.cs
  17. 4
      tools/TestSuite/TestSuite.Shared/Fixtures/CreatedAppFixture.cs
  18. 2
      tools/TestSuite/TestSuite.Shared/Fixtures/CreatedTeamFixture.cs
  19. 2
      tools/TestSuite/TestSuite.Shared/Fixtures/WebhookCatcherClient.cs
  20. 44
      tools/TestSuite/TestSuite.Shared/Model/TestEntity.cs
  21. 6
      tools/TestSuite/TestSuite.Shared/Model/TestEntityWithReferences.cs
  22. 2
      tools/TestSuite/docker-compose-base.yml
  23. 53
      tools/TestSuite/docker-compose-ferretdb.yml

7
.github/workflows/dev.yml

@ -143,10 +143,17 @@ jobs:
include:
- name: mysql
compose: docker-compose-mysql.yml
optional: false
- name: postgres
compose: docker-compose-postgres.yml
optional: false
- name: sqlserver
compose: docker-compose-sqlserver.yml
optional: false
- name: ferretdb
compose: docker-compose-ferretdb.yml
optional: true
continue-on-error: ${{ matrix.optional == true }}
steps:
- name: Prepare - Checkout

7
.github/workflows/release.yml

@ -138,10 +138,17 @@ jobs:
include:
- name: mysql
compose: docker-compose-mysql.yml
optional: false
- name: postgres
compose: docker-compose-postgres.yml
optional: false
- name: sqlserver
compose: docker-compose-sqlserver.yml
optional: false
- name: ferretdb
compose: docker-compose-ferretdb.yml
optional: true
continue-on-error: ${{ matrix.optional == true }}
steps:
- name: Prepare - Checkout

14
backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj

@ -40,13 +40,13 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Json.Microsoft" Version="8.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.NetTopologySuite" Version="8.0.3" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI.EntityFramework" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.EntityFramework" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.26.0" />
<PackageReference Include="Squidex.Events.EntityFramework" Version="7.26.0" />
<PackageReference Include="Squidex.Flows.EntityFramework" Version="7.26.0" />
<PackageReference Include="Squidex.Hosting" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="7.26.0" />
<PackageReference Include="Squidex.AI.EntityFramework" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.EntityFramework" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.27.0" />
<PackageReference Include="Squidex.Events.EntityFramework" Version="7.27.0" />
<PackageReference Include="Squidex.Flows.EntityFramework" Version="7.27.0" />
<PackageReference Include="Squidex.Hosting" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="7.27.0" />
<PackageReference Include="Squidex.OpenIdDict.EntityFramework" Version="5.8.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

55
backend/src/Squidex.Data.MongoDb/Domain/Apps/Entities/Contents/Text/MongoTextIndexBase.cs

@ -31,23 +31,48 @@ public abstract class MongoTextIndexBase<T>(IMongoDatabase database, string shar
public double Score { get; set; }
}
protected override Task SetupCollectionAsync(IMongoCollection<MongoTextIndexEntity<T>> collection,
protected override async Task SetupCollectionAsync(IMongoCollection<MongoTextIndexEntity<T>> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.ContentId)),
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.SchemaId)
.Ascending(x => x.GeoField)
.Geo2DSphere(x => x.GeoObject)),
], ct);
var isFerreDb = await Database.IsFerretDbAsync(ct);
if (isFerreDb)
{
await collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.ContentId)),
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.SchemaId)
.Ascending(x => x.GeoField)),
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Geo2DSphere(x => x.GeoObject)),
], ct);
}
else
{
await collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.ContentId)),
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
.Ascending(x => x.SchemaId)
.Ascending(x => x.GeoField)
.Geo2DSphere(x => x.GeoObject)),
], ct);
}
}
protected override string CollectionName()

16
backend/src/Squidex.Data.MongoDb/Infrastructure/MongoExtensions.cs

@ -218,10 +218,24 @@ public static class MongoExtensions
var versionMajor = versionString.Split('.')[0];
int.TryParse(versionMajor, NumberStyles.Integer, CultureInfo.InvariantCulture, out int result);
return result;
}
public static async Task<bool> IsFerretDbAsync(this IMongoDatabase database,
CancellationToken ct = default)
{
var command =
new BsonDocumentCommand<BsonDocument>(new BsonDocument
{
{ "buildInfo", 1 },
});
var document = await database.RunCommandAsync(command, cancellationToken: ct);
var isFerretDB = document.Any(x => x.Name.Contains("ferret", StringComparison.OrdinalIgnoreCase));
return isFerretDB;
}
public static async Task<List<T>> ToListRandomAsync<T>(this IFindFluent<T, T> find, IMongoCollection<T> collection, long take,
CancellationToken ct = default)
{

12
backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj

@ -25,12 +25,12 @@
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.30.0" />
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI.Mongo" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.Mongo" Version="7.26.0" />
<PackageReference Include="Squidex.Events.Mongo" Version="7.26.0" />
<PackageReference Include="Squidex.Flows.Mongo" Version="7.26.0" />
<PackageReference Include="Squidex.Hosting" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.Mongo" Version="7.26.0" />
<PackageReference Include="Squidex.AI.Mongo" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.Mongo" Version="7.27.0" />
<PackageReference Include="Squidex.Events.Mongo" Version="7.27.0" />
<PackageReference Include="Squidex.Flows.Mongo" Version="7.27.0" />
<PackageReference Include="Squidex.Hosting" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging.Mongo" Version="7.27.0" />
<PackageReference Include="Squidex.OpenIddict.MongoDb" Version="5.8.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

2
backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj

@ -20,7 +20,7 @@
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.Flows" Version="7.26.0" />
<PackageReference Include="Squidex.Flows" Version="7.27.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />

4
backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj

@ -29,8 +29,8 @@
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.26.0" />
<PackageReference Include="Squidex.AI" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.27.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />

14
backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj

@ -24,13 +24,13 @@
<PackageReference Include="NodaTime" Version="3.2.0" />
<PackageReference Include="OpenTelemetry.Api" Version="1.9.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.Assets" Version="7.26.0" />
<PackageReference Include="Squidex.Caching" Version="7.26.0" />
<PackageReference Include="Squidex.Events" Version="7.26.0" />
<PackageReference Include="Squidex.Hosting.Abstractions" Version="7.26.0" />
<PackageReference Include="Squidex.Log" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging" Version="7.26.0" />
<PackageReference Include="Squidex.Text" Version="7.26.0" />
<PackageReference Include="Squidex.Assets" Version="7.27.0" />
<PackageReference Include="Squidex.Caching" Version="7.27.0" />
<PackageReference Include="Squidex.Events" Version="7.27.0" />
<PackageReference Include="Squidex.Hosting.Abstractions" Version="7.27.0" />
<PackageReference Include="Squidex.Log" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging" Version="7.27.0" />
<PackageReference Include="Squidex.Text" Version="7.27.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />

24
backend/src/Squidex/Squidex.csproj

@ -60,17 +60,17 @@
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="ReportGenerator" Version="5.4.1" PrivateAssets="all" />
<PackageReference Include="Squidex.Assets.Azure" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.GoogleCloud" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.FTP" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.ImageSharp" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.S3" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.Azure" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.GoogleCloud" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.FTP" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.ImageSharp" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.S3" Version="7.27.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.27.0" />
<PackageReference Include="Squidex.ClientLibrary" Version="21.8.0" />
<PackageReference Include="Squidex.Events.GetEventStore" Version="7.26.0" />
<PackageReference Include="Squidex.Hosting" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.All" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.26.0" />
<PackageReference Include="Squidex.Events.GetEventStore" Version="7.27.0" />
<PackageReference Include="Squidex.Hosting" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging.All" Version="7.27.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.27.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="YDotNet" Version="0.4.3" />
<PackageReference Include="YDotNet.Native" Version="0.4.3" />
@ -84,11 +84,11 @@
</ItemGroup>
<ItemGroup Condition="'$(IncludeMagick)' == 'true'">
<PackageReference Include="Squidex.Assets.ImageMagick" Version="7.26.0" />
<PackageReference Include="Squidex.Assets.ImageMagick" Version="7.27.0" />
</ItemGroup>
<ItemGroup Condition="'$(IncludeKafka)' == 'true'">
<PackageReference Include="Squidex.Messaging.Kafka" Version="7.26.0" />
<PackageReference Include="Squidex.Messaging.Kafka" Version="7.27.0" />
</ItemGroup>
<PropertyGroup>

8
tools/TestSuite/TestSuite.ApiTests/ContentCollationTests.cs

@ -80,15 +80,15 @@ public class ContentCollationTests(CreatedAppFixture fixture) : IClassFixture<Cr
// STEP 2: Get sorted contents.
var sorted_1 = await contents.GetAsync(new ContentQuery { OrderBy = $"data/{TestEntityData.StringField}/iv asc" });
var sortedNames_1 = sorted_1.Items.Select(x => x.Data.String).ToList();
var sortedContent_1 = await contents.GetAsync(new ContentQuery { OrderBy = $"data/{TestEntityData.StringField}/iv asc" });
var sortedNames_1 = sortedContent_1.Items.Select(x => x.Data.String).ToList();
Assert.Equal(new string[] { "Lüleburgaz", "Mersin", "İstanbul" }, sortedNames_1);
// STEP 3: Get with collation.
var sorted_2 = await contents.GetAsync(new ContentQuery { OrderBy = $"data/{TestEntityData.StringField}/iv asc", Collation = "tr" });
var sortedNames_2 = sorted_2.Items.Select(x => x.Data.String).ToList();
var sortedContent_2 = await contents.GetAsync(new ContentQuery { OrderBy = $"data/{TestEntityData.StringField}/iv asc", Collation = "tr" });
var sortedNames_2 = sortedContent_2.Items.Select(x => x.Data.String).ToList();
Assert.Equal(new string[] { "İstanbul", "Lüleburgaz", "Mersin" }, sortedNames_2);
}

18
tools/TestSuite/TestSuite.Shared/AssetStrategies.cs

@ -32,7 +32,7 @@ public static partial class ContentStrategies
Id = asset.Id,
Permanent = false,
},
]
],
});
case Deletion.BulkPermanent:
return client.BulkUpdateAssetsAsync(new BulkUpdateAssetsDto
@ -45,7 +45,7 @@ public static partial class ContentStrategies
Id = asset.Id,
Permanent = true,
},
]
],
});
default:
return Task.CompletedTask;
@ -55,7 +55,7 @@ public static partial class ContentStrategies
public enum Move
{
Single,
Bulk
Bulk,
}
public static Task MoveAsync(this IAssetsClient client, AssetDto asset, AssetFolderDto folder, Move strategy)
@ -65,7 +65,7 @@ public static partial class ContentStrategies
case Move.Single:
return client.PutAssetParentAsync(asset.Id, new MoveAssetDto
{
ParentId = folder.Id
ParentId = folder.Id,
});
case Move.Bulk:
return client.BulkUpdateAssetsAsync(new BulkUpdateAssetsDto
@ -76,9 +76,9 @@ public static partial class ContentStrategies
{
Type = BulkUpdateAssetType.Move,
Id = asset.Id,
ParentId = folder.Id
ParentId = folder.Id,
},
]
],
});
default:
return Task.CompletedTask;
@ -88,7 +88,7 @@ public static partial class ContentStrategies
public enum Annotate
{
Single,
Bulk
Bulk,
}
public static Task AnnotateAsync(this IAssetsClient client, AssetDto asset, AnnotateAssetDto request, Annotate strategy)
@ -110,9 +110,9 @@ public static partial class ContentStrategies
IsProtected = request.IsProtected,
Metadata = request.Metadata,
Slug = request.Slug,
Tags = request.Tags
Tags = request.Tags,
},
]
],
});
default:
return Task.CompletedTask;

2
tools/TestSuite/TestSuite.Shared/ClientExtensions.cs

@ -370,7 +370,7 @@ public static class ClientExtensions
var pausingStream = new PauseStream(fileParameter.Data, 0.25);
var pausingFile = new FileParameter(pausingStream, fileParameter.FileName, fileParameter.ContentType)
{
ContentLength = fileParameter.Data.Length
ContentLength = fileParameter.Data.Length,
};
await using (pausingFile.Data)

2
tools/TestSuite/TestSuite.Shared/ClientWrapper.cs

@ -33,7 +33,7 @@ public sealed class ClientWrapper
{
return new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator,
};
}).Services
.BuildServiceProvider();

64
tools/TestSuite/TestSuite.Shared/ContentStrategies.cs

@ -18,7 +18,7 @@ public static partial class ContentStrategies
SingleSoft,
SinglePermanent,
BulkSoft,
BulkPermanent
BulkPermanent,
}
public static Task DeleteAsync(this ISquidexClient client, ContentBase content,
@ -46,7 +46,7 @@ public static partial class ContentStrategies
Id = content.Id,
Permanent = false,
},
]
],
});
case Deletion.BulkPermanent:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -59,7 +59,7 @@ public static partial class ContentStrategies
Id = content.Id,
Permanent = true,
},
]
],
});
default:
return Task.CompletedTask;
@ -73,7 +73,7 @@ public static partial class ContentStrategies
UpsertBulk,
Bulk,
BulkWithSchema,
BulkShared
BulkShared,
}
public static Task UpdateAsync(this ISquidexClient client, ContentBase content, object data,
@ -99,9 +99,9 @@ public static partial class ContentStrategies
{
Type = BulkUpdateType.Update,
Id = content.Id,
Data = data
Data = data,
},
]
],
});
case Update.UpsertBulk:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -112,9 +112,9 @@ public static partial class ContentStrategies
{
Type = BulkUpdateType.Upsert,
Id = content.Id,
Data = data
Data = data,
},
]
],
});
case Update.BulkWithSchema:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -126,9 +126,9 @@ public static partial class ContentStrategies
Type = BulkUpdateType.Update,
Id = content.Id,
Data = data,
Schema = content.SchemaName
Schema = content.SchemaName,
},
]
],
});
case Update.BulkShared:
return GetSharedClient(client).BulkUpdateAsync(new BulkUpdate
@ -140,9 +140,9 @@ public static partial class ContentStrategies
Type = BulkUpdateType.Update,
Id = content.Id,
Data = data,
Schema = content.SchemaName
Schema = content.SchemaName,
},
]
],
});
default:
return Task.CompletedTask;
@ -156,7 +156,7 @@ public static partial class ContentStrategies
UpsertBulk,
Bulk,
BulkWithSchema,
BulkShared
BulkShared,
}
public static Task PatchAsync(this ISquidexClient client, ContentBase content, object data,
@ -183,9 +183,9 @@ public static partial class ContentStrategies
Type = BulkUpdateType.Upsert,
Id = content.Id,
Data = data,
Patch = true
Patch = true,
},
]
],
});
case Patch.Bulk:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -198,7 +198,7 @@ public static partial class ContentStrategies
Id = content.Id,
Data = data,
},
]
],
});
case Patch.BulkWithSchema:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -210,9 +210,9 @@ public static partial class ContentStrategies
Type = BulkUpdateType.Patch,
Id = content.Id,
Data = data,
Schema = content.SchemaName
Schema = content.SchemaName,
},
]
],
});
case Patch.BulkShared:
return GetSharedClient(client).BulkUpdateAsync(new BulkUpdate
@ -224,9 +224,9 @@ public static partial class ContentStrategies
Type = BulkUpdateType.Patch,
Id = content.Id,
Data = data,
Schema = content.SchemaName
Schema = content.SchemaName,
},
]
],
});
default:
return Task.CompletedTask;
@ -242,7 +242,7 @@ public static partial class ContentStrategies
BulkWithSchema,
BulkShared,
UpsertBulk,
UpdateBulk
UpdateBulk,
}
public static Task EnrichDefaultsAsync(this ISquidexClient client, ContentBase content, object data,
@ -258,14 +258,14 @@ public static partial class ContentStrategies
case EnrichDefaults.Normal:
var createOptions = new ContentEnrichDefaultsOptions
{
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
};
return GetClient().EnrichDefaultsAsync(content.Id, createOptions);
case EnrichDefaults.Update:
var updateOptions = new ContentUpdateOptions
{
EnrichDefaults = true
EnrichDefaults = true,
};
return GetClient().UpdateAsync(content.Id, data, updateOptions);
@ -273,7 +273,7 @@ public static partial class ContentStrategies
var upsertOptions = new ContentUpsertOptions
{
EnrichDefaults = true,
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
};
return GetClient().UpsertAsync(content.Id, data, upsertOptions);
@ -285,10 +285,10 @@ public static partial class ContentStrategies
new BulkUpdateJob
{
Type = BulkUpdateType.EnrichDefaults,
Id = content.Id
Id = content.Id,
},
],
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
});
case EnrichDefaults.UpdateBulk:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -303,7 +303,7 @@ public static partial class ContentStrategies
EnrichDefaults = true,
},
],
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
});
case EnrichDefaults.UpsertBulk:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -318,7 +318,7 @@ public static partial class ContentStrategies
EnrichDefaults = true,
},
],
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
});
case EnrichDefaults.BulkWithSchema:
return GetClient().BulkUpdateAsync(new BulkUpdate
@ -329,10 +329,10 @@ public static partial class ContentStrategies
{
Type = BulkUpdateType.EnrichDefaults,
Id = content.Id,
Schema = content.SchemaName
Schema = content.SchemaName,
},
],
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
});
case EnrichDefaults.BulkShared:
return GetSharedClient(client).BulkUpdateAsync(new BulkUpdate
@ -343,10 +343,10 @@ public static partial class ContentStrategies
{
Type = BulkUpdateType.EnrichDefaults,
Id = content.Id,
Schema = content.SchemaName
Schema = content.SchemaName,
},
],
EnrichRequiredFields = requiredFields
EnrichRequiredFields = requiredFields,
});
default:
return Task.CompletedTask;

6
tools/TestSuite/TestSuite.Shared/Fixtures/ClientFixture.cs

@ -45,7 +45,7 @@ public class ClientFixture : IAsyncLifetime
var createRequest = new CreateAppDto
{
Name = name
Name = name,
};
return PostAppAsync(createRequest);
@ -57,7 +57,7 @@ public class ClientFixture : IAsyncLifetime
var request = new CreateTeamDto
{
Name = name
Name = name,
};
return Client.Teams.PostTeamAsync(request);
@ -80,7 +80,7 @@ public class ClientFixture : IAsyncLifetime
{
return new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator,
};
}).Services
.BuildServiceProvider();

4
tools/TestSuite/TestSuite.Shared/Fixtures/CreatedAppFixture.cs

@ -21,7 +21,7 @@ public class CreatedAppFixture : ClientFixture
{
var createRequest = new AddLanguageDto
{
Language = name
Language = name,
};
await Client.Apps.PostLanguageAsync(createRequest);
@ -41,7 +41,7 @@ public class CreatedAppFixture : ClientFixture
{
var createRequest = new CreateAppDto
{
Name = AppName
Name = AppName,
};
await Client.Apps.PostAppAsync(createRequest);

2
tools/TestSuite/TestSuite.Shared/Fixtures/CreatedTeamFixture.cs

@ -27,7 +27,7 @@ public class CreatedTeamFixture : ClientFixture
{
var request = new CreateTeamDto
{
Name = TeamName
Name = TeamName,
};
Team = await Client.Teams.PostTeamAsync(request);

2
tools/TestSuite/TestSuite.Shared/Fixtures/WebhookCatcherClient.cs

@ -73,7 +73,7 @@ public sealed class WebhookCatcherClient
httpClient = new HttpClient
{
BaseAddress = new Uri($"http://{apiHost}:{apiPort}")
BaseAddress = new Uri($"http://{apiHost}:{apiPort}"),
};
}

44
tools/TestSuite/TestSuite.Shared/Model/TestEntity.cs

@ -30,40 +30,40 @@ public sealed class TestEntity : Content<TestEntityData>
Name = TestEntityData.NumberField,
Properties = new NumberFieldPropertiesDto
{
IsRequired = true
}
IsRequired = true,
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.StringField,
Properties = new StringFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.SearchableField,
Properties = new StringFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.GeoField,
Properties = new GeolocationFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.JsonField,
Properties = new JsonFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
new UpsertSchemaFieldDto
{
@ -71,28 +71,28 @@ public sealed class TestEntity : Content<TestEntityData>
Partitioning = "language",
Properties = new StringFieldPropertiesDto
{
DefaultValue = "default"
}
DefaultValue = "default",
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.IdField,
Properties = new StringFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
new UpsertSchemaFieldDto
{
Name = TestEntityData.ImmutableField,
Properties = new StringFieldPropertiesDto
{
IsCreateOnly = true
}
IsCreateOnly = true,
},
},
],
Scripts = scripts,
IsPublished = true
IsPublished = true,
});
return schema;
@ -108,10 +108,10 @@ public sealed class TestEntity : Content<TestEntityData>
nested0 = index,
nested1 = new
{
nested2 = index
}
nested2 = index,
},
}),
String = index.ToString(CultureInfo.InvariantCulture)
String = index.ToString(CultureInfo.InvariantCulture),
};
if (index % 2 == 0)
@ -122,8 +122,8 @@ public sealed class TestEntity : Content<TestEntityData>
coordinates = new[]
{
index,
index
}
index,
},
};
}
else

6
tools/TestSuite/TestSuite.Shared/Model/TestEntityWithReferences.cs

@ -26,11 +26,11 @@ public sealed class TestEntityWithReferences : Content<TestEntityWithReferencesD
Name = TestEntityWithReferencesData.ReferencesField,
Properties = new ReferencesFieldPropertiesDto
{
IsRequired = false
}
IsRequired = false,
},
},
],
IsPublished = true
IsPublished = true,
});
return schema;

2
tools/TestSuite/docker-compose-base.yml

@ -5,6 +5,7 @@ services:
environment:
- ASPNETCORE_URLS=http://+:5000
- CLUSTERING__RANDOMNAME=true
- EVENTSTORE__TYPE=MongoDb
- EVENTSTORE__MONGODB__CONFIGURATION=mongodb://db_mongo
- GRAPHQL__CACHEDURATION=00:00:00
- IDENTITY__ADMINCLIENTID=root
@ -16,6 +17,7 @@ services:
- RULES__RULESCACHEDURATION=00:00:00
- SCRIPTING__TIMEOUTEXECUTION=00:00:10
- SCRIPTING__TIMEOUTSCRIPT=00:00:10
- STORE__TYPE=MongoDb
- STORE__MONGODB__CONFIGURATION=mongodb://db_mongo
- TEMPLATES__LOCALURL=http://localhost:5000
- UI__HIDENEWS=true

53
tools/TestSuite/docker-compose-ferretdb.yml

@ -0,0 +1,53 @@
services:
db_postgres:
image: ghcr.io/ferretdb/postgres-documentdb:17-0.105.0-ferretdb-2.4.0
command: postgres -c log_lock_waits=on -c deadlock_timeout=1s -c log_min_messages=warning
restart: on-failure
environment:
- POSTGRES_USER=username
- POSTGRES_PASSWORD=password
- POSTGRES_DB=postgres
volumes:
- ./data:/var/lib/postgresql/data
db_ferretdb:
image: ghcr.io/ferretdb/ferretdb:2.4.0
restart: on-failure
ports:
- 27017:27017
environment:
- FERRETDB_POSTGRESQL_URL=postgres://username:password@db_postgres:5432/postgres
squidex_ferretdb:
extends:
file: docker-compose-base.yml
service: squidex_base
environment:
- EVENTSTORE__MONGODB__CONFIGURATION=mongodb://username:password@db_ferretdb/
- STORE__TYPE=MongoDb
- STORE__MONGODB__CONFIGURATION=mongodb://username:password@db_ferretdb/
- URLS__BASEURL=http://localhost:8080
depends_on:
db_ferretdb:
condition: service_healthy
proxy_ferretdb:
image: squidex/caddy-proxy-path:2.6.2
ports:
- "8080:8080"
environment:
- SITE_ADDRESS=http://localhost:8080
- SITE_PATH=*
- SITE_SERVER="squidex_ferretdb:5000"
depends_on:
- squidex_ferretdb
restart: unless-stopped
webhookcatcher:
image: tarampampam/webhook-tester:2
command: serve --port 1026
ports:
- "1026:1026"
volumes:
ferretdb_data:
Loading…
Cancel
Save