Skip to content

Commit e0d7e95

Browse files
committed
fix failing test due to elastic/elasticsearch#31507 which failed due to us using IgnoreUnavailable which was basically ignored in previous version
1 parent 63edd99 commit e0d7e95

File tree

1 file changed

+33
-108
lines changed

1 file changed

+33
-108
lines changed

src/Tests/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs

+33-108
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GetMappingApiTests : ApiIntegrationTestBase<ReadOnlyCluster, IGetMa
2222
{
2323
public GetMappingApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
2424

25-
protected override LazyResponses ClientUsage() => Calls(
25+
protected override LazyResponses ClientUsage() => this.Calls(
2626
fluent: (client, f) => client.GetMapping<Project>(f),
2727
fluentAsync: (client, f) => client.GetMappingAsync<Project>(f),
2828
request: (client, r) => client.GetMapping(r),
@@ -114,7 +114,7 @@ public class GetMappingNonExistentIndexApiTests : ApiIntegrationTestBase<ReadOnl
114114

115115
public GetMappingNonExistentIndexApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
116116

117-
protected override LazyResponses ClientUsage() => Calls(
117+
protected override LazyResponses ClientUsage() => this.Calls(
118118
fluent: (client, f) => client.GetMapping<Project>(f),
119119
fluentAsync: (client, f) => client.GetMappingAsync<Project>(f),
120120
request: (client, r) => client.GetMapping(r),
@@ -124,17 +124,13 @@ protected override LazyResponses ClientUsage() => Calls(
124124
protected override bool ExpectIsValid => false;
125125
protected override int ExpectStatusCode => 404;
126126
protected override HttpMethod HttpMethod => HttpMethod.GET;
127-
protected override string UrlPath => $"/{_nonExistentIndex}/_mapping?ignore_unavailable=true";
127+
protected override string UrlPath => $"/{_nonExistentIndex}/_mapping";
128128

129129
protected override Func<GetMappingDescriptor<Project>, IGetMappingRequest> Fluent => d => d
130130
.Index(_nonExistentIndex)
131-
.AllTypes()
132-
.IgnoreUnavailable();
131+
.AllTypes();
133132

134-
protected override GetMappingRequest Initializer => new GetMappingRequest(_nonExistentIndex, AllTypes)
135-
{
136-
IgnoreUnavailable = true
137-
};
133+
protected override GetMappingRequest Initializer => new GetMappingRequest(_nonExistentIndex, AllTypes);
138134

139135
protected override void ExpectResponse(IGetMappingResponse response)
140136
{
@@ -145,22 +141,20 @@ protected override void ExpectResponse(IGetMappingResponse response)
145141

146142
internal class TestVisitor : IMappingVisitor
147143
{
148-
public TestVisitor()
149-
{
150-
Counts = new Dictionary<string, int>();
151-
}
144+
public TestVisitor() => this.Counts = new Dictionary<string, int>();
152145

153146
public int Depth { get; set; }
154147

155148
public Dictionary<string, int> Counts { get; }
156149

157150
private void Increment(string key)
158151
{
159-
if (!Counts.ContainsKey(key))
152+
if (!this.Counts.ContainsKey(key))
160153
{
161-
Counts.Add(key, 0);
154+
this.Counts.Add(key, 0);
162155
}
163-
Counts[key] += 1;
156+
157+
this.Counts[key] += 1;
164158
}
165159

166160
public void CountsShouldContainKeyAndCountBe(string key, int count)
@@ -172,119 +166,50 @@ public void CountsShouldContainKeyAndCountBe(string key, int count)
172166
this.Counts[key].Should().Be(count, because);
173167
}
174168

175-
public void Visit(IDateProperty mapping)
176-
{
177-
Increment("date");
178-
}
169+
public void Visit(IDateProperty mapping) => this.Increment("date");
179170

180-
public void Visit(IBinaryProperty mapping)
181-
{
182-
Increment("binary");
183-
}
171+
public void Visit(IBinaryProperty mapping) => this.Increment("binary");
184172

185-
public void Visit(INestedProperty mapping)
186-
{
187-
Increment("nested");
188-
}
173+
public void Visit(INestedProperty mapping) => this.Increment("nested");
189174

190-
public void Visit(IGeoPointProperty mapping)
191-
{
192-
Increment("geo_point");
193-
}
175+
public void Visit(IGeoPointProperty mapping) => this.Increment("geo_point");
194176

195-
public void Visit(ICompletionProperty mapping)
196-
{
197-
Increment("completion");
198-
}
177+
public void Visit(ICompletionProperty mapping) => this.Increment("completion");
199178

200-
public void Visit(ITokenCountProperty mapping)
201-
{
202-
Increment("token_count");
203-
}
179+
public void Visit(ITokenCountProperty mapping) => this.Increment("token_count");
204180

205-
public void Visit(IPercolatorProperty property)
206-
{
207-
Increment("percolator");
208-
}
181+
public void Visit(IPercolatorProperty property) => this.Increment("percolator");
209182

210-
public void Visit(IIntegerRangeProperty property)
211-
{
212-
Increment("integer_range");
213-
}
183+
public void Visit(IIntegerRangeProperty property) => this.Increment("integer_range");
214184

215-
public void Visit(IFloatRangeProperty property)
216-
{
217-
Increment("float_range");
218-
}
185+
public void Visit(IFloatRangeProperty property) => this.Increment("float_range");
219186

220-
public void Visit(ILongRangeProperty property)
221-
{
222-
Increment("long_range");
223-
}
187+
public void Visit(ILongRangeProperty property) => this.Increment("long_range");
224188

225-
public void Visit(IDoubleRangeProperty property)
226-
{
227-
Increment("double_range");
228-
}
189+
public void Visit(IDoubleRangeProperty property) => this.Increment("double_range");
229190

230-
public void Visit(IDateRangeProperty property)
231-
{
232-
Increment("date_range");
233-
}
191+
public void Visit(IDateRangeProperty property) => this.Increment("date_range");
234192

235-
public void Visit(IIpRangeProperty property)
236-
{
237-
Increment("ip_range");
238-
}
193+
public void Visit(IIpRangeProperty property) => this.Increment("ip_range");
239194

240-
public void Visit(IJoinProperty property)
241-
{
242-
Increment("join");
243-
}
195+
public void Visit(IJoinProperty property) => this.Increment("join");
244196

245-
public void Visit(IMurmur3HashProperty mapping)
246-
{
247-
Increment("murmur3");
248-
}
197+
public void Visit(IMurmur3HashProperty mapping) => this.Increment("murmur3");
249198

250-
public void Visit(INumberProperty mapping)
251-
{
252-
Increment("number");
253-
}
199+
public void Visit(INumberProperty mapping) => this.Increment("number");
254200

255-
public void Visit(IGeoShapeProperty mapping)
256-
{
257-
Increment("geo_shape");
258-
}
201+
public void Visit(IGeoShapeProperty mapping) => this.Increment("geo_shape");
259202

260-
public void Visit(IIpProperty mapping)
261-
{
262-
Increment("ip");
263-
}
203+
public void Visit(IIpProperty mapping) => this.Increment("ip");
264204

265-
public void Visit(IObjectProperty mapping)
266-
{
267-
Increment("object");
268-
}
205+
public void Visit(IObjectProperty mapping) => this.Increment("object");
269206

270-
public void Visit(IBooleanProperty mapping)
271-
{
272-
Increment("boolean");
273-
}
207+
public void Visit(IBooleanProperty mapping) => this.Increment("boolean");
274208

275-
public void Visit(ITextProperty mapping)
276-
{
277-
Increment("text");
278-
}
209+
public void Visit(ITextProperty mapping) => this.Increment("text");
279210

280-
public void Visit(IKeywordProperty mapping)
281-
{
282-
Increment("keyword");
283-
}
211+
public void Visit(IKeywordProperty mapping) => this.Increment("keyword");
284212

285-
public void Visit(ITypeMapping mapping)
286-
{
287-
Increment("type");
288-
}
213+
public void Visit(ITypeMapping mapping) => this.Increment("type");
289214
}
290215
}

0 commit comments

Comments
 (0)