Skip to content

Commit 3094791

Browse files
committed
Add a IndexNotExists integration test
1 parent 28f6a5e commit 3094791

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/Tests/Tests/Indices/IndexManagement/IndicesExists/IndexExistsApiTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,31 @@ protected override LazyResponses ClientUsage() => Calls(
3030

3131
protected override void ExpectResponse(ExistsResponse response) => response.Exists.Should().BeTrue();
3232
}
33+
34+
public class IndexNotExistsApiTests
35+
: ApiIntegrationTestBase<ReadOnlyCluster, ExistsResponse, IIndexExistsRequest, IndexExistsDescriptor, IndexExistsRequest>
36+
{
37+
private const string NonExistentIndex = "non-existent-index";
38+
39+
public IndexNotExistsApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
40+
41+
protected override bool ExpectIsValid => false;
42+
protected override int ExpectStatusCode => 404;
43+
protected override HttpMethod HttpMethod => HttpMethod.HEAD;
44+
45+
protected override IndexExistsRequest Initializer => new IndexExistsRequest(NonExistentIndex);
46+
protected override string UrlPath => $"/{NonExistentIndex}";
47+
48+
protected override LazyResponses ClientUsage() => Calls(
49+
(client, f) => client.Indices.Exists(NonExistentIndex),
50+
(client, f) => client.Indices.ExistsAsync(NonExistentIndex),
51+
(client, r) => client.Indices.Exists(r),
52+
(client, r) => client.Indices.ExistsAsync(r)
53+
);
54+
55+
protected override void ExpectResponse(ExistsResponse response)
56+
{
57+
response.Exists.Should().BeFalse();
58+
}
59+
}
3360
}

0 commit comments

Comments
 (0)