-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add version to PutTemplateRequest #2971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
using System; | ||
using System.Linq; | ||
using Elasticsearch.Net; | ||
using FluentAssertions; | ||
using Nest; | ||
using Tests.Framework; | ||
using Tests.Framework.Integration; | ||
|
@@ -9,7 +11,7 @@ | |
namespace Tests.Indices.IndexSettings.IndexTemplates.GetIndexTemplate | ||
{ | ||
public class GetIndexTemplateApiTests | ||
: ApiTestBase<WritableCluster, IGetIndexTemplateResponse, IGetIndexTemplateRequest, GetIndexTemplateDescriptor, GetIndexTemplateRequest> | ||
: ApiIntegrationTestBase<WritableCluster, IGetIndexTemplateResponse, IGetIndexTemplateRequest, GetIndexTemplateDescriptor, GetIndexTemplateRequest> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
{ | ||
public GetIndexTemplateApiTests(WritableCluster cluster, EndpointUsage usage) : base(cluster, usage) { } | ||
protected override LazyResponses ClientUsage() => Calls( | ||
|
@@ -25,6 +27,46 @@ protected override LazyResponses ClientUsage() => Calls( | |
protected override Func<GetIndexTemplateDescriptor, IGetIndexTemplateRequest> Fluent => d => d | ||
.Name(CallIsolatedValue); | ||
|
||
protected override int ExpectStatusCode => 200; | ||
|
||
protected override bool ExpectIsValid => true; | ||
|
||
protected override GetIndexTemplateRequest Initializer => new GetIndexTemplateRequest(CallIsolatedValue); | ||
|
||
protected override object ExpectJson => new object(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can set this to |
||
|
||
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values) | ||
{ | ||
foreach (var callUniqueValue in values) | ||
{ | ||
var putTemplateResponse = client.PutIndexTemplate(callUniqueValue.Value, d => | ||
d.IndexPatterns("startingwiththis-*") | ||
.Settings(s => s.NumberOfShards(2)) | ||
.Version(1) | ||
); | ||
|
||
if (!putTemplateResponse.IsValid) | ||
throw new Exception($"Problem putting index template for integration test: {putTemplateResponse.DebugInformation}"); | ||
} | ||
} | ||
|
||
protected override void ExpectResponse(IGetIndexTemplateResponse response) | ||
{ | ||
response.ShouldBeValid(); | ||
|
||
response.TemplateMappings.Should().NotBeNull(); | ||
response.TemplateMappings.Should().HaveCount(1); | ||
|
||
var responseTemplateMapping = response.TemplateMappings[CallIsolatedValue]; | ||
|
||
responseTemplateMapping.IndexPatterns.Should().NotBeNull(); | ||
responseTemplateMapping.IndexPatterns.Should().HaveCount(1); | ||
responseTemplateMapping.IndexPatterns.First().Should().Be("startingwiththis-*"); | ||
|
||
responseTemplateMapping.Version.Should().Be(1); | ||
|
||
responseTemplateMapping.Settings.Should().NotBeNull(); | ||
responseTemplateMapping.Settings.NumberOfShards.Should().Be(2); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍