Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Aug 12, 2024
1 parent 567034b commit 1c3dafc
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 362 deletions.
20 changes: 10 additions & 10 deletions tests/Tests.Core/ManagedOpenSearch/NodeSeeders/DefaultSeeder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,7 @@ private Task<CreateIndexResponse> CreateDeveloperIndexAsync() => Client.Indices.

#pragma warning disable 618
private Task<CreateIndexResponse> CreateProjectIndexAsync() => Client.Indices.CreateAsync(typeof(Project), c => c
.Settings(settings => settings
.Analysis(ProjectAnalysisSettings)
.Setting("index.knn", true)
.Setting("index.knn.algo_param.ef_search", 100))
.Settings(ProjectIndexSettings)
.Mappings(ProjectMappings)
.Aliases(aliases => aliases
.Alias(ProjectsAliasName)
Expand Down Expand Up @@ -263,6 +260,12 @@ public static ITypeMapping ProjectTypeMappings(TypeMappingDescriptor<Project> ma
return mapping;
}

public static IndexSettingsDescriptor ProjectIndexSettings(IndexSettingsDescriptor settings) =>
settings
.Analysis(ProjectAnalysisSettings)
.Setting("index.knn", true)
.Setting("index.knn.algo_param.ef_search", 100);

public static IAnalysis ProjectAnalysisSettings(AnalysisDescriptor analysis)
{
analysis
Expand All @@ -286,14 +289,11 @@ public static IAnalysis ProjectAnalysisSettings(AnalysisDescriptor analysis)
return analysis;
}

public static IndexSettingsDescriptor PercolatorIndexSettings(IndexSettingsDescriptor settings) =>
ProjectIndexSettings(settings).AutoExpandReplicas("0-all");

private Task<CreateIndexResponse> CreatePercolatorIndexAsync() => Client.Indices.CreateAsync(typeof(ProjectPercolation), c => c
.Settings(s => s
.AutoExpandReplicas("0-all")
.Analysis(ProjectAnalysisSettings)
.Setting("index.knn", true)
.Setting("index.knn.algo_param.ef_search", 100)
)
.Settings(PercolatorIndexSettings)
.Map<ProjectPercolation>(m => m
.AutoMap()
.Properties(PercolatedQueryProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal
foreach (var (_, index) in values)
{
var createIndex = client.Indices.Create(index, i => i
.Settings(settings => settings.Analysis(DefaultSeeder.ProjectAnalysisSettings))
.Settings(DefaultSeeder.ProjectIndexSettings)
.Map<Project>(DefaultSeeder.ProjectTypeMappings)
);
createIndex.ShouldBeValid();
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests/Cluster/TaskManagement/GetTask/GetTaskApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal
throw new Exception("failure in setting up integration");

var createIndex = client.Indices.Create(targetIndex, i => i
.Settings(settings => settings.Analysis(DefaultSeeder.ProjectAnalysisSettings))
.Settings(DefaultSeeder.ProjectIndexSettings)
.Map<Project>(DefaultSeeder.ProjectTypeMappings)
);
createIndex.ShouldBeValid();
Expand Down Expand Up @@ -169,7 +169,7 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal
throw new Exception($"failure in setting up integration for {nameof(GetTaskApiCompletedTaskTests)}. {bulkResponse.DebugInformation}");

var createIndex = client.Indices.Create(targetIndex, i => i
.Settings(settings => settings.Analysis(DefaultSeeder.ProjectAnalysisSettings))
.Settings(DefaultSeeder.ProjectIndexSettings)
.Map<Project>(DefaultSeeder.ProjectTypeMappings)
);
createIndex.ShouldBeValid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal
client.Indices.Refresh(sourceIndex);

var createIndex = client.Indices.Create(targetIndex, i => i
.Settings(settings => settings.Analysis(DefaultSeeder.ProjectAnalysisSettings))
.Settings(DefaultSeeder.ProjectIndexSettings)
.Map<Project>(DefaultSeeder.ProjectTypeMappings)
);
createIndex.ShouldBeValid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal
foreach (var index in values.Values)
{
Client.Indices.Create(index, c => c
.Settings(s => s
.Settings(s => DefaultSeeder.ProjectIndexSettings(s)
.NumberOfShards(2)
.NumberOfReplicas(0)
.Analysis(DefaultSeeder.ProjectAnalysisSettings)
)
.Map<Project>(p => p
.AutoMap()
Expand Down
Loading

0 comments on commit 1c3dafc

Please sign in to comment.