mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Squidex.Domain.Apps.Core.TestHelpers;
|
|
using Squidex.Domain.Apps.Entities.TestHelpers;
|
|
using Squidex.Extensions.Text.ElasticSearch;
|
|
using Testcontainers.Elasticsearch;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Contents.Text;
|
|
|
|
public sealed class ElasticSearchTextIndexFixture : IAsyncLifetime
|
|
{
|
|
private readonly ElasticsearchContainer elastic =
|
|
new ElasticsearchBuilder("elasticsearch:8.6.1")
|
|
.WithReuse(true)
|
|
.WithLabel("resuse-id", "elastic-text")
|
|
.Build();
|
|
|
|
public ElasticSearchTextIndex Index { get; private set; }
|
|
|
|
public async ValueTask InitializeAsync()
|
|
{
|
|
await elastic.StartAsync(TestContext.Current.CancellationToken);
|
|
|
|
Index = new ElasticSearchTextIndex(
|
|
new ElasticSearchClient(elastic.GetConnectionString()),
|
|
TestConfig.Configuration["elastic:indexName"]!,
|
|
TestUtils.DefaultSerializer);
|
|
|
|
await Index.InitializeAsync(default);
|
|
}
|
|
|
|
public async ValueTask DisposeAsync()
|
|
{
|
|
await elastic.StopAsync(TestContext.Current.CancellationToken);
|
|
}
|
|
}
|
|
|