Skip to content

Commit 284435c

Browse files
committed
fixed FAKE build
Conflicts: src/Tests/CodeStandards/NamingConventions.doc.cs src/Tests/Indices/Monitoring/IndicesShardStores/IndicesShardStoresApiTests.cs
1 parent 1b4325a commit 284435c

File tree

4 files changed

+76
-20
lines changed

4 files changed

+76
-20
lines changed

src/Tests/CodeStandards/NamingConventions.doc.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,6 @@ public void ParityBetweenRequestsAndResponses()
9696
// Add any exceptions to the rule here.
9797
var exceptions = new[]
9898
{
99-
typeof(CatAliasesRequest),
100-
typeof(CatAllocationRequest),
101-
typeof(CatCountRequest),
102-
typeof(CatFielddataRequest),
103-
typeof(CatHealthRequest),
104-
typeof(CatHelpRequest),
105-
typeof(CatIndicesRequest),
106-
typeof(CatMasterRequest),
107-
typeof(CatNodesRequest),
108-
typeof(CatPendingTasksRequest),
109-
typeof(CatPluginsRequest),
110-
typeof(CatRecoveryRequest),
111-
typeof(CatSegmentsRequest),
112-
typeof(CatShardsRequest),
113-
typeof(CatThreadPoolRequest),
114-
typeof(CatRepositoriesRequest),
115-
typeof(CatSnapshotsRequest),
116-
typeof(ForceMergeRequest),
11799
typeof(DocumentExistsRequest),
118100
typeof(DocumentExistsRequest<>),
119101
typeof(AliasExistsRequest),
@@ -144,6 +126,7 @@ public void ParityBetweenRequestsAndResponses()
144126
!t.IsAbstract() &&
145127
typeof(IRequest).IsAssignableFrom(t) &&
146128
!typeof(IDescriptor).IsAssignableFrom(t)
129+
&& !t.Name.StartsWith("Cat")
147130
&& !exceptions.Contains(t))
148131
.Select(t => t.Name.Split('`')[0].Replace("Request", ""))
149132
);

src/Tests/Framework/Integration/Process/ElasticsearchNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ string prefix
101101
)
102102
{
103103
_doNotSpawnIfAlreadyRunning = doNotSpawnIfAlreadyRunning;
104-
this.Version = elasticsearchVersion;
104+
this.Version = runningIntegrations ? elasticsearchVersion : "unit-test-version-should-not-appear-on-disk";
105105
this.RunningIntegrations = runningIntegrations;
106106
this.Prefix = prefix.ToLowerInvariant();
107107
var suffix = Guid.NewGuid().ToString("N").Substring(0, 6);
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Elasticsearch.Net;
6+
using FluentAssertions;
7+
using Nest;
8+
using Tests.Framework;
9+
using Tests.Framework.Integration;
10+
using Xunit;
11+
12+
namespace Tests.Indices.Monitoring.IndicesShardStores
13+
{
14+
[Collection(IntegrationContext.OwnIndex)]
15+
public class IndicesShardStoresApiTests : ApiIntegrationTestBase<IIndicesShardStoresResponse, IIndicesShardStoresRequest, IndicesShardStoresDescriptor, IndicesShardStoresRequest>
16+
{
17+
public IndicesShardStoresApiTests(OwnIndexCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
18+
19+
private static string IndexWithUnassignedShards = "nest-" + RandomString();
20+
21+
protected override void BeforeAllCalls(IElasticClient client, IDictionary<ClientMethod, string> values)
22+
{
23+
client.CreateIndex(IndexWithUnassignedShards, s => s
24+
.Settings(settings => settings
25+
.NumberOfShards(1)
26+
.NumberOfReplicas(2)
27+
)
28+
);
29+
client.Index(new IndexRequest<object>(IndexWithUnassignedShards)
30+
{
31+
Document = new { x = 1 },
32+
Refresh = true
33+
});
34+
}
35+
36+
protected override LazyResponses ClientUsage() => Calls(
37+
fluent: (client, f) => client.IndicesShardStores(f),
38+
fluentAsync: (client, f) => client.IndicesShardStoresAsync(f),
39+
request: (client, r) => client.IndicesShardStores(r),
40+
requestAsync: (client, r) => client.IndicesShardStoresAsync(r)
41+
);
42+
protected override IndicesShardStoresRequest Initializer =>
43+
new IndicesShardStoresRequest(IndexWithUnassignedShards)
44+
{
45+
Status = new[] { "all" }
46+
};
47+
protected override Func<IndicesShardStoresDescriptor, IIndicesShardStoresRequest> Fluent => s =>
48+
s.Index(IndexWithUnassignedShards)
49+
.Status("all");
50+
51+
protected override bool ExpectIsValid => true;
52+
protected override int ExpectStatusCode => 200;
53+
protected override HttpMethod HttpMethod => HttpMethod.GET;
54+
protected override string UrlPath => $"/{IndexWithUnassignedShards}/_shard_stores?status=all";
55+
56+
[I] public Task AssertResponse() => AssertOnAllResponses(r =>
57+
{
58+
r.Indices.Should().NotBeEmpty();
59+
var indicesShardStore = r.Indices[IndexWithUnassignedShards];
60+
indicesShardStore.Should().NotBeNull();
61+
indicesShardStore.Shards.Should().NotBeEmpty().And.ContainKey("0");
62+
var shardStoreWrapper = indicesShardStore.Shards["0"];
63+
shardStoreWrapper.Stores.Should().NotBeNullOrEmpty();
64+
65+
var shardStore = shardStoreWrapper.Stores.First();
66+
shardStore.Id.Should().NotBeNullOrWhiteSpace();
67+
shardStore.Name.Should().NotBeNullOrWhiteSpace();
68+
shardStore.TransportAddress.Should().NotBeNullOrWhiteSpace();
69+
shardStore.Version.Should().BeGreaterThan(0);
70+
shardStore.Allocation.Should().Be(ShardStoreAllocation.Primary);
71+
});
72+
}
73+
}

src/Tests/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mode either u (unit test), i (integration test) or m (mixed mode)
2-
mode: m
2+
mode: u
33
# the elasticsearch version that should be started
44
elasticsearch_version: 2.2.0
55
# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running

0 commit comments

Comments
 (0)