Skip to content

Commit 92935c8

Browse files
committed
Revert "share yaml test code WIP"
This reverts commit 5f651a3.
1 parent d4a08b3 commit 92935c8

File tree

4 files changed

+33
-47
lines changed

4 files changed

+33
-47
lines changed

modules/ingest-geoip/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,7 @@ tasks.named("dependencyLicenses").configure {
8585
ignoreFile 'elastic-geoip-database-service-agreement-LICENSE.txt'
8686
}
8787

88-
configurations {
89-
yamlRestImplementation {
90-
attributes {
91-
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.JVM_CLASS_DIRECTORY)
92-
}
93-
}
94-
}
95-
9688
artifacts {
97-
yamlRestImplementation(new File(projectDir, "src/yamlRestTest/java"))
9889
restTests(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
9990
}
10091

modules/ingest-geoip/qa/multi-project/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@
99

1010
apply plugin: 'elasticsearch.internal-java-rest-test'
1111
apply plugin: 'elasticsearch.internal-yaml-rest-test'
12-
//apply plugin: 'elasticsearch.yaml-rest-compat-test'
12+
apply plugin: 'elasticsearch.yaml-rest-compat-test'
1313

1414
dependencies {
15-
yamlRestTestImplementation project(path: ':modules:ingest-geoip', configuration: 'yamlRestImplementation')
1615
javaRestTestImplementation project(':modules:ingest-geoip')
1716
javaRestTestImplementation project(':test:external-modules:test-multi-project')
1817
javaRestTestImplementation project(':test:fixtures:geoip-fixture')
1918

20-
// testImplementation project(':modules:ingest-geoip')
2119
yamlRestTestImplementation project(':modules:ingest-geoip')
22-
23-
// yamlRestTestImplementation(testArtifact(project(":modules:ingest-geoip")))
2420
yamlRestTestImplementation project(':test:external-modules:test-multi-project')
2521
yamlRestTestImplementation project(':test:fixtures:geoip-fixture')
2622
yamlRestTestImplementation project(':x-pack:qa:multi-project:yaml-test-framework')

modules/ingest-geoip/qa/multi-project/src/yamlRestTest/java/org/elasticsearch/ingest/geoip/IngestGeoIpClientMultiProjectYamlTestSuiteIT.java

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static org.hamcrest.Matchers.containsInAnyOrder;
3939
import static org.hamcrest.Matchers.equalTo;
4040
import static org.hamcrest.Matchers.notNullValue;
41-
import static org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT.putGeoipPipeline;
4241

4342
public class IngestGeoIpClientMultiProjectYamlTestSuiteIT extends MultipleProjectsClientYamlSuiteTestCase {
4443

@@ -80,7 +79,7 @@ public static Iterable<Object[]> parameters() throws Exception {
8079

8180
@Before
8281
public void waitForDatabases() throws Exception {
83-
putGeoIpPipeline();
82+
putGeoipPipeline();
8483
assertBusy(() -> {
8584
Request request = new Request("GET", "/_ingest/geoip/stats");
8685
Map<String, Object> response = entityAsMap(client().performRequest(request));
@@ -105,33 +104,33 @@ public void waitForDatabases() throws Exception {
105104
* This creates a pipeline with a geoip processor so that the GeoipDownloader will download its databases.
106105
* @throws IOException
107106
*/
108-
// private void putGeoipPipeline() throws IOException {
109-
// final BytesReference bytes;
110-
// try (XContentBuilder builder = JsonXContent.contentBuilder()) {
111-
// builder.startObject();
112-
// {
113-
// builder.startArray("processors");
114-
// {
115-
// builder.startObject();
116-
// {
117-
// builder.startObject("geoip");
118-
// {
119-
// builder.field("field", "ip");
120-
// builder.field("target_field", "ip-city");
121-
// builder.field("database_file", "GeoLite2-City.mmdb");
122-
// }
123-
// builder.endObject();
124-
// }
125-
// builder.endObject();
126-
// }
127-
// builder.endArray();
128-
// }
129-
// builder.endObject();
130-
// bytes = BytesReference.bytes(builder);
131-
// }
132-
// Request putPipelineRequest = new Request("PUT", "/_ingest/pipeline/pipeline-with-geoip");
133-
// putPipelineRequest.setEntity(new ByteArrayEntity(bytes.array(), ContentType.APPLICATION_JSON));
134-
// client().performRequest(putPipelineRequest);
135-
// }
107+
private void putGeoipPipeline() throws IOException {
108+
final BytesReference bytes;
109+
try (XContentBuilder builder = JsonXContent.contentBuilder()) {
110+
builder.startObject();
111+
{
112+
builder.startArray("processors");
113+
{
114+
builder.startObject();
115+
{
116+
builder.startObject("geoip");
117+
{
118+
builder.field("field", "ip");
119+
builder.field("target_field", "ip-city");
120+
builder.field("database_file", "GeoLite2-City.mmdb");
121+
}
122+
builder.endObject();
123+
}
124+
builder.endObject();
125+
}
126+
builder.endArray();
127+
}
128+
builder.endObject();
129+
bytes = BytesReference.bytes(builder);
130+
}
131+
Request putPipelineRequest = new Request("PUT", "/_ingest/pipeline/pipeline-with-geoip");
132+
putPipelineRequest.setEntity(new ByteArrayEntity(bytes.array(), ContentType.APPLICATION_JSON));
133+
client().performRequest(putPipelineRequest);
134+
}
136135

137136
}

modules/ingest-geoip/src/yamlRestTest/java/org/elasticsearch/ingest/geoip/IngestGeoIpClientYamlTestSuiteIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public void waitForDatabases() throws Exception {
7878
assertBusy(() -> {
7979
Request request = new Request("GET", "/_ingest/geoip/stats");
8080
Map<String, Object> response = entityAsMap(client().performRequest(request));
81-
// assert databases are downloaded
81+
8282
Map<?, ?> downloadStats = (Map<?, ?>) response.get("stats");
8383
assertThat(downloadStats.get("databases_count"), equalTo(4));
84-
// assert databases are loaded to node
84+
8585
Map<?, ?> nodes = (Map<?, ?>) response.get("nodes");
8686
assertThat(nodes.size(), equalTo(1));
8787
Map<?, ?> node = (Map<?, ?>) nodes.values().iterator().next();
@@ -99,7 +99,7 @@ public void waitForDatabases() throws Exception {
9999
* This creates a pipeline with a geoip processor so that the GeoipDownloader will download its databases.
100100
* @throws IOException
101101
*/
102-
public static void putGeoipPipeline() throws IOException {
102+
private void putGeoipPipeline() throws IOException {
103103
final BytesReference bytes;
104104
try (XContentBuilder builder = JsonXContent.contentBuilder()) {
105105
builder.startObject();

0 commit comments

Comments
 (0)