Skip to content

Commit 744c032

Browse files
committed
fix certgen -out behaviour change in 6.x
1 parent 3f2700f commit 744c032

File tree

5 files changed

+27
-18
lines changed

5 files changed

+27
-18
lines changed

src/Tests/ClientConcepts/Certificates/SslAndKpiXPackCluster.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Tests.Framework.ManagedElasticsearch.Nodes;
88
using Tests.Framework.ManagedElasticsearch.Plugins;
99
using Tests.Framework.ManagedElasticsearch.Tasks.InstallationTasks;
10+
using Tests.Framework.Versions;
1011

1112
namespace Tests.ClientConcepts.Certificates
1213
{
@@ -68,12 +69,12 @@ public override void Run(NodeConfiguration config, NodeFileSystem fileSystem)
6869
$" filename : \"{fileSystem.ClientCertificateFilename}\"",
6970
});
7071

71-
this.GenerateCertificates(fileSystem, silentModeConfigFile);
72-
this.GenerateUnusedCertificates(fileSystem, silentModeConfigFile);
73-
this.AddClientCertificateUser(fileSystem);
72+
this.GenerateCertificates(fileSystem, silentModeConfigFile, config.ElasticsearchVersion);
73+
this.GenerateUnusedCertificates(fileSystem, silentModeConfigFile, config.ElasticsearchVersion);
74+
this.AddClientCertificateUser(fileSystem, config.ElasticsearchVersion);
7475
}
7576

76-
private void AddClientCertificateUser(NodeFileSystem fileSystem)
77+
private void AddClientCertificateUser(NodeFileSystem fileSystem, ElasticsearchVersion version)
7778
{
7879
var file = Path.Combine(fileSystem.ConfigPath, "x-pack", "role_mapping") + ".yml";
7980
var name = fileSystem.ClientCertificateName;
@@ -83,28 +84,30 @@ private void AddClientCertificateUser(NodeFileSystem fileSystem)
8384
$" - \"{name}\""
8485
});
8586
}
86-
private void GenerateCertificates(NodeFileSystem fileSystem, string silentModeConfigFile)
87+
private void GenerateCertificates(NodeFileSystem fileSystem, string silentModeConfigFile, ElasticsearchVersion version)
8788
{
8889
var name = fileSystem.CertificateFolderName;
90+
var zipLocation = Path.Combine(fileSystem.ConfigPath, "x-pack", name) + ".zip";
91+
var @out = version.Major < 6 ? $"{name}.zip" : zipLocation;
8992
if (!File.Exists(fileSystem.CaCertificate))
9093
this.ExecuteBinary(fileSystem.CertGenBinary, "generating ssl certificates for this session",
91-
"-in", silentModeConfigFile, "-out", $"{name}.zip");
94+
"-in", silentModeConfigFile, "-out", @out);
9295

9396
if (Directory.Exists(fileSystem.CertificatesPath)) return;
9497
Directory.CreateDirectory(fileSystem.CertificatesPath);
95-
var zipLocation = Path.Combine(fileSystem.ConfigPath, "x-pack", name) + ".zip";
9698
ZipFile.ExtractToDirectory(zipLocation, fileSystem.CertificatesPath);
9799
}
98-
private void GenerateUnusedCertificates(NodeFileSystem fileSystem, string silentModeConfigFile)
100+
private void GenerateUnusedCertificates(NodeFileSystem fileSystem, string silentModeConfigFile, ElasticsearchVersion version)
99101
{
100102
var name = fileSystem.UnusedCertificateFolderName;
103+
var zipLocation = Path.Combine(fileSystem.ConfigPath, "x-pack", name) + ".zip";
104+
var @out = version.Major < 6 ? $"{name}.zip" : zipLocation;
101105
if (!File.Exists(fileSystem.UnusedCaCertificate))
102106
this.ExecuteBinary(fileSystem.CertGenBinary, "generating ssl certificates for this session",
103-
"-in", silentModeConfigFile, "-out", $"{name}.zip");
107+
"-in", silentModeConfigFile, "-out", @out);
104108

105109
if (Directory.Exists(fileSystem.UnusedCertificatesPath)) return;
106110
Directory.CreateDirectory(fileSystem.UnusedCertificatesPath);
107-
var zipLocation = Path.Combine(fileSystem.ConfigPath, "x-pack", name) + ".zip";
108111
ZipFile.ExtractToDirectory(zipLocation, fileSystem.UnusedCertificatesPath);
109112
}
110113
}

src/Tests/Document/Multiple/ReindexOnServer/ReindexOnServerApiTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected override LazyResponses ClientUsage() => Calls(
7272
.VersionType(VersionType.Internal)
7373
.Routing(ReindexRouting.Discard)
7474
)
75-
.Script(ss => ss.Inline(PainlessScript).Lang("groovy"))
75+
.Script(ss => ss.Inline(PainlessScript))
7676
.Conflicts(Conflicts.Proceed)
7777
.Refresh();
7878

@@ -95,7 +95,7 @@ protected override LazyResponses ClientUsage() => Calls(
9595
VersionType = VersionType.Internal,
9696
Routing = ReindexRouting.Discard
9797
},
98-
Script = new InlineScript(PainlessScript) { Lang = "groovy" },
98+
Script = new InlineScript(PainlessScript),
9999
Conflicts = Conflicts.Proceed,
100100
Refresh = true,
101101
};
@@ -132,7 +132,6 @@ protected override void ExpectResponse(IReindexOnServerResponse response)
132132
script = new
133133
{
134134
inline = this.PainlessScript,
135-
lang = "groovy"
136135
},
137136
source = new
138137
{

src/Tests/Document/Multiple/UpdateByQuery/UpdateByQueryApiTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ protected override LazyResponses ClientUsage() => Calls(
7676

7777
protected override Func<UpdateByQueryDescriptor<Test>, IUpdateByQueryRequest> Fluent => d => d
7878
.Index(CallIsolatedValue)
79+
.Query(q=>q.MatchAll())
7980
.Refresh()
8081
.Conflicts(Conflicts.Proceed);
8182

8283
protected override UpdateByQueryRequest Initializer => new UpdateByQueryRequest(CallIsolatedValue, Type<Test>())
8384
{
85+
Query = new MatchAllQuery(),
8486
Refresh = true,
8587
Conflicts = Conflicts.Proceed
8688
};
@@ -112,12 +114,14 @@ public UpdateByQueryWaitForCompletionApiTests(IntrusiveOperationCluster cluster,
112114
protected override string UrlPath => $"/{CallIsolatedValue}/test/_update_by_query?wait_for_completion=false&conflicts=proceed";
113115

114116
protected override Func<UpdateByQueryDescriptor<Test>, IUpdateByQueryRequest> Fluent => d => d
117+
.Query(q=>q.MatchAll())
115118
.Index(CallIsolatedValue)
116119
.WaitForCompletion(false)
117120
.Conflicts(Conflicts.Proceed);
118121

119122
protected override UpdateByQueryRequest Initializer => new UpdateByQueryRequest(CallIsolatedValue, Type<Test>())
120123
{
124+
Query = new MatchAllQuery(),
121125
WaitForCompletion = false,
122126
Conflicts = Conflicts.Proceed
123127
};
@@ -159,13 +163,13 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
159163
new
160164
{
161165
query = new { match = new { flag = new { query = "bar" } } },
162-
script = new { inline = "ctx._source.text = 'x'", lang = "groovy" }
166+
script = new { inline = "ctx._source.text = 'x'" }
163167
};
164168

165169
protected override Func<UpdateByQueryDescriptor<Test>, IUpdateByQueryRequest> Fluent => d => d
166170
.Index(CallIsolatedValue)
167171
.Query(q => q.Match(m => m.Field(p => p.Flag).Query("bar")))
168-
.Script(ss => ss.Inline(_script).Lang("groovy"))
172+
.Script(ss => ss.Inline(_script))
169173
;
170174

171175
protected override UpdateByQueryRequest Initializer => new UpdateByQueryRequest(CallIsolatedValue, Type<Test>())
@@ -175,7 +179,7 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
175179
Field = Field<Test>(p => p.Flag),
176180
Query = "bar"
177181
},
178-
Script = new InlineScript(_script) { Lang = "groovy" },
182+
Script = new InlineScript(_script),
179183
};
180184

181185
protected override void ExpectResponse(IUpdateByQueryResponse response)
308 KB
Binary file not shown.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Nest;
1+
using System.Collections.Generic;
2+
using Nest;
23
using Tests.Framework.Integration;
34
using Tests.Framework.ManagedElasticsearch.NodeSeeders;
45

@@ -7,6 +8,8 @@ namespace Tests.Framework.ManagedElasticsearch.Clusters
78
public class UnbalancedCluster : ReadOnlyCluster
89
{
910
protected override void SeedNode() =>
10-
new DefaultSeeder(this.Node, new IndexSettings { NumberOfShards = 3, NumberOfReplicas = 2 }).SeedNode();
11+
new DefaultSeeder(this.Node, new IndexSettings(new Dictionary<string, object> {
12+
{ "mapping.single_type", "false" } //TODO this is temporarily while parent child mappings are reimagined in 6.0
13+
}) { NumberOfShards = 3, NumberOfReplicas = 2 }).SeedNode();
1114
}
1215
}

0 commit comments

Comments
 (0)