Skip to content

Commit 020027f

Browse files
committed
xpack beta1 related fixes
1 parent 9f69f5f commit 020027f

File tree

16 files changed

+128
-104
lines changed

16 files changed

+128
-104
lines changed

src/Nest/Nest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,7 @@
12781278
<Compile Include="XPack\Security\Role\ClearCachedRoles\ClearCachedRolesRequest.cs" />
12791279
<Compile Include="XPack\Security\Role\ClearCachedRoles\ClearCachedRolesResponse.cs" />
12801280
<Compile Include="XPack\Security\Role\ClearCachedRoles\ElasticClient-ClearCachedRoles.cs" />
1281+
<Compile Include="XPack\Security\Role\FieldSecurity.cs" />
12811282
<Compile Include="XPack\Security\ShieldNode.cs" />
12821283
<Compile Include="XPack\Security\ShieldNodeStatus.cs" />
12831284
<Compile Include="XPack\Security\Role\DeleteRole\DeleteRoleRequest.cs" />

src/Nest/XPack/Security/Role/PutRole/IndicesPrivileges.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,35 @@ public interface IIndicesPrivileges
1515
[JsonProperty("privileges")]
1616
IEnumerable<string> Privileges { get; set; }
1717

18-
[JsonProperty("fields")]
19-
Fields Fields { get; set; }
18+
[JsonProperty("field_security")]
19+
IFieldSecurity FieldSecurity { get; set; }
2020

2121
[JsonProperty("query")]
2222
QueryContainer Query { get; set; }
23-
2423
}
2524
public class IndicesPrivileges : IIndicesPrivileges
2625
{
2726
[JsonConverter(typeof(IndicesJsonConverter))]
2827
public Indices Names { get; set; }
2928
public IEnumerable<string> Privileges { get; set; }
30-
public Fields Fields { get; set; }
29+
public IFieldSecurity FieldSecurity { get; set; }
3130
public QueryContainer Query { get; set; }
3231
}
3332

34-
3533
public class IndicesPrivilegesDescriptor : DescriptorPromiseBase<IndicesPrivilegesDescriptor, IList<IIndicesPrivileges>>
3634
{
3735
public IndicesPrivilegesDescriptor() : base(new List<IIndicesPrivileges>()) { }
3836

3937
public IndicesPrivilegesDescriptor Add<T>(Func<IndicesPrivilegesDescriptor<T>, IIndicesPrivileges> selector) where T : class =>
4038
Assign(a => a.AddIfNotNull(selector?.Invoke(new IndicesPrivilegesDescriptor<T>())));
41-
4239
}
40+
4341
public class IndicesPrivilegesDescriptor<T>: DescriptorBase<IndicesPrivilegesDescriptor<T>, IIndicesPrivileges>, IIndicesPrivileges
4442
where T :class
4543
{
4644
Indices IIndicesPrivileges.Names { get; set; }
4745
IEnumerable<string> IIndicesPrivileges.Privileges { get; set; }
48-
Fields IIndicesPrivileges.Fields { get; set; }
46+
IFieldSecurity IIndicesPrivileges.FieldSecurity { get; set; }
4947
QueryContainer IIndicesPrivileges.Query { get; set; }
5048

5149
public IndicesPrivilegesDescriptor<T> Names(Indices indices) => Assign(a => a.Names = indices);
@@ -55,13 +53,10 @@ public class IndicesPrivilegesDescriptor<T>: DescriptorBase<IndicesPrivilegesDes
5553
public IndicesPrivilegesDescriptor<T> Privileges(params string[] privileges) => Assign(a => a.Privileges = privileges);
5654
public IndicesPrivilegesDescriptor<T> Privileges(IEnumerable<string> privileges) => Assign(a => a.Privileges = privileges);
5755

58-
public IndicesPrivilegesDescriptor<T> Fields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
59-
Assign(a => a.Fields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);
60-
61-
public IndicesPrivilegesDescriptor<T> Fields(Fields fields) => Assign(a => a.Fields = fields);
56+
public IndicesPrivilegesDescriptor<T> FieldSecurity(Func<FieldSecurityDescriptor<T>, IFieldSecurity> fields) =>
57+
Assign(a => a.FieldSecurity = fields?.Invoke(new FieldSecurityDescriptor<T>()));
6258

6359
public IndicesPrivilegesDescriptor<T> Query(Func<QueryContainerDescriptor<T>, QueryContainer> query) =>
6460
Assign(a => a.Query = query?.Invoke(new QueryContainerDescriptor<T>()));
65-
6661
}
6762
}

src/Tests/Document/Multiple/BulkAll/BulkAllApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Tests.Document.Multiple.BulkAll
1313
{
14-
public class BulkAllApiTests : SerializationTestBase, IClusterFixture<WritableCluster>
14+
public class BulkAllApiTests : SerializationTestBase, IClusterFixture<IntrusiveOperationCluster>
1515
{
1616
private class SmallObject
1717
{
@@ -28,7 +28,7 @@ private IEnumerable<SmallObject> CreateLazyStreamOfDocuments(int count)
2828
yield return new SmallObject() { Id = i };
2929
}
3030

31-
public BulkAllApiTests(WritableCluster cluster, EndpointUsage usage)
31+
public BulkAllApiTests(IntrusiveOperationCluster cluster, EndpointUsage usage)
3232
{
3333
this._client = cluster.Client;
3434
}

src/Tests/Document/Multiple/Reindex/ReindexApiTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public ReindexApiTests(ReindexCluster cluster, EndpointUsage usage)
4444
// create a thousand commits and associate with the projects
4545
var commits = CommitActivity.CommitActivities;
4646
var bb = new BulkDescriptor();
47-
for (int index = 0; index < commits.Count; index++)
47+
for (int i = 0; i < commits.Count; i++)
4848
{
49-
var commit = commits[index];
50-
var project = index % 2 == 0
49+
var commit = commits[i];
50+
var project = i % 2 == 0
5151
? projects[0].Name
5252
: projects[1].Name;
5353

src/Tests/Document/Single/Index/IndexIngestApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
namespace Tests.Document.Single.Index
1111
{
1212
public class IndexIngestApiTests :
13-
ApiIntegrationTestBase<WritableCluster, IIndexResponse, IIndexRequest<Project>, IndexDescriptor<Project>, IndexRequest<Project>>
13+
ApiIntegrationTestBase<IntrusiveOperationCluster, IIndexResponse, IIndexRequest<Project>, IndexDescriptor<Project>, IndexRequest<Project>>
1414
{
1515
private static string PipelineId { get; } = "pipeline-" + Guid.NewGuid().ToString("N").Substring(0, 8);
1616

17-
public IndexIngestApiTests(WritableCluster cluster, EndpointUsage usage) : base(cluster, usage)
17+
public IndexIngestApiTests(IntrusiveOperationCluster cluster, EndpointUsage usage) : base(cluster, usage)
1818
{
1919
}
2020

src/Tests/Document/Single/Index/IndexIngestAttachmentApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace Tests.Document.Single.Index
1212
{
1313
public class IndexIngestAttachmentApiTests :
14-
ApiIntegrationTestBase<WritableCluster, IIndexResponse,
14+
ApiIntegrationTestBase<IntrusiveOperationCluster, IIndexResponse,
1515
IIndexRequest<IndexIngestAttachmentApiTests.IngestedAttachment>,
1616
IndexDescriptor<IndexIngestAttachmentApiTests.IngestedAttachment>,
1717
IndexRequest<IndexIngestAttachmentApiTests.IngestedAttachment>>
@@ -27,7 +27,7 @@ public class IngestedAttachment
2727

2828
private static string PipelineId { get; } = "pipeline-" + Guid.NewGuid().ToString("N").Substring(0, 8);
2929

30-
public IndexIngestAttachmentApiTests(WritableCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
30+
public IndexIngestAttachmentApiTests(IntrusiveOperationCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
3131

3232
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
3333
{

src/Tests/Document/Single/Index/IndexIngestGeoIpApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
namespace Tests.Document.Single.Index
1414
{
1515
public class IndexIngestGeoIpApiTests :
16-
ApiIntegrationTestBase<WritableCluster, IIndexResponse, IIndexRequest<Project>, IndexDescriptor<Project>, IndexRequest<Project>>
16+
ApiIntegrationTestBase<IntrusiveOperationCluster, IIndexResponse, IIndexRequest<Project>, IndexDescriptor<Project>, IndexRequest<Project>>
1717
{
1818
private static string PipelineId { get; } = "pipeline-" + Guid.NewGuid().ToString("N").Substring(0, 8);
1919

20-
public IndexIngestGeoIpApiTests(WritableCluster cluster, EndpointUsage usage) : base(cluster, usage)
20+
public IndexIngestGeoIpApiTests(IntrusiveOperationCluster cluster, EndpointUsage usage) : base(cluster, usage)
2121
{
2222
}
2323

src/Tests/Framework/EndpointTests/Clusters/WritableCluster.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ namespace Tests.Framework.Integration
88
[RequiresPlugin(ElasticsearchPlugin.MapperAttachments, ElasticsearchPlugin.IngestGeoIp, ElasticsearchPlugin.IngestAttachment)]
99
public class WritableCluster : ClusterBase
1010
{
11+
public override int MaxConcurrency => 4;
12+
13+
1114
public override void Bootstrap()
1215
{
1316
var seeder = new Seeder(this.Node);

src/Tests/Framework/Xunit/ForEachAsyncExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ select Task.Run(async delegate
2323
}
2424

2525
}
26-
}
26+
}

src/Tests/Framework/Xunit/TestAssemblyRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ orderby g.Count() descending
6666
var clusterTotals = new Dictionary<string, Stopwatch>();
6767
foreach (var group in grouped)
6868
{
69-
if (group.Key?.GetType() != typeof(WritableCluster)) continue;
69+
//if (group.Key?.GetType() != typeof(XPackCluster)) continue;
7070
var type = group.Key?.GetType();
7171
var clusterName = type?.Name.Replace("Cluster", "") ?? "UNKNOWN";
7272
var dop = group.Key != null && group.Key.MaxConcurrency > 0

0 commit comments

Comments
 (0)