Skip to content

Commit 4eaaf9c

Browse files
authored
ESQL: Adds a test and fixes running the CsvTestsDataLoader.main (#109836)
1 parent 7b81e0c commit 4eaaf9c

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

x-pack/plugin/esql/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ dependencies {
2828
// Also contains a dummy processor to allow compilation with unused annotations.
2929
annotationProcessor project('compute:gen')
3030

31-
testImplementation project('qa:testFixtures')
31+
testImplementation(project('qa:testFixtures')) {
32+
exclude(group:"org.elasticsearch.plugin", module: "esql")
33+
}
3234
testImplementation project(':test:framework')
3335
testImplementation(testArtifact(project(xpackModule('core'))))
3436
testImplementation project(path: xpackModule('enrich'))

x-pack/plugin/esql/qa/testFixtures/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
apply plugin: 'elasticsearch.java'
2-
2+
apply plugin: org.elasticsearch.gradle.dependencies.CompileOnlyResolvePlugin
33

44
dependencies {
55
implementation project(':x-pack:plugin:esql:compute')
6-
compileOnly project(':x-pack:plugin:esql')
6+
implementation project(':x-pack:plugin:esql')
77
compileOnly project(path: xpackModule('core'))
88
implementation project(":libs:elasticsearch-x-content")
99
implementation project(':client:rest')
1010
implementation project(':libs:elasticsearch-logging')
1111
implementation project(':test:framework')
1212
api(testArtifact(project(xpackModule('esql-core'))))
1313
implementation project(':server')
14-
api "net.sf.supercsv:super-csv:${versions.supercsv}"
14+
implementation "net.sf.supercsv:super-csv:${versions.supercsv}"
15+
}
16+
17+
/**
18+
* This is needed for CsvTestsDataLoaderTests to reflect the classpath that CsvTestsDataLoader actually uses when "main" method is executed.
19+
*/
20+
tasks.named("test").configure {
21+
classpath = classpath - (configurations.resolveableCompileOnly - configurations.runtimeClasspath)
1522
}
1623

1724
/**
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.xpack.esql;
9+
10+
import org.elasticsearch.test.ESTestCase;
11+
12+
import java.net.ConnectException;
13+
14+
import static org.hamcrest.Matchers.startsWith;
15+
16+
public class CsvTestsDataLoaderTests extends ESTestCase {
17+
18+
public void testCsvTestsDataLoaderExecution() {
19+
ConnectException ce = expectThrows(ConnectException.class, () -> CsvTestsDataLoader.main(new String[] {}));
20+
assertThat(ce.getMessage(), startsWith("Connection refused"));
21+
}
22+
}

0 commit comments

Comments
 (0)