Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

IT improvements #143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
run: ./gradlew build
- name: Run Integration Tests
working-directory: ./tmp/pa
run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster
run: ./gradlew integTest -Dtests.enableIT=true -Dtests.useDockerCluster=true
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ import org.ajoberstar.gradle.git.tasks.GitClone
String rcaDir

static def propEnabled(property) {
return System.getProperty(property) != null
return System.getProperty(property) != null && System.getProperty(property).toLowerCase().equals("true")
}

// The following Gradle tasks are used to create a PA/RCA enabled Elasticsearch cluster
Expand Down
12 changes: 9 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
systemProp.tests.rest.cluster=localhost:9200
# The Elasticsearch cluster node communication endpoint
systemProp.tests.cluster=localhost:9300
# Whether or not to spin up a new Elasticsearch cluster for integration testing
# Comment this out if you don't want a cluster spun up
systemProp.tests.useDockerCluster=

# Set this to true if you want a cluster spun up for integration testing
systemProp.tests.useDockerCluster=false

# Set this to true if you want to enable integration testing
systemProp.tests.enableIT=false

# The port number for the PerformanceAnalyzer WebService
systemProp.tests.pa.port=9600
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class PerformanceAnalyzerIT extends ESRestTestCase {
private static final Logger LOG = LogManager.getLogger(PerformanceAnalyzerIT.class);
private static final int PORT = 9600;
private static final int PORT = Integer.parseInt(System.getProperty("tests.pa.port"));
private static final ObjectMapper mapper = new ObjectMapper();
private static RestClient paClient;

Expand Down Expand Up @@ -81,15 +81,17 @@ public static void ensurePaAndRcaEnabled() throws Exception {
Response resp = client().performRequest(new Request("GET", "_opendistro/_performanceanalyzer/cluster/config"));
Map<String, Object> respMap = mapper.readValue(EntityUtils.toString(resp.getEntity(), "UTF-8"),
new TypeReference<Map<String, Object>>(){});
if (respMap.get("currentPerformanceAnalyzerClusterState").equals(3)) {
if (respMap.get("currentPerformanceAnalyzerClusterState").equals(3) &&
ricardolstephen marked this conversation as resolved.
Show resolved Hide resolved
!respMap.get("currentPerformanceAnalyzerClusterState").equals(7)) {
break;
}
Thread.sleep(1000L);
}
Response resp = client().performRequest(new Request("GET", "_opendistro/_performanceanalyzer/cluster/config"));
Map<String, Object> respMap = mapper.readValue(EntityUtils.toString(resp.getEntity(), "UTF-8"),
new TypeReference<Map<String, Object>>(){});
if (!respMap.get("currentPerformanceAnalyzerClusterState").equals(3)) {
if (!respMap.get("currentPerformanceAnalyzerClusterState").equals(3) &&
!respMap.get("currentPerformanceAnalyzerClusterState").equals(7)) {
throw new Exception("PA and RCA are not enabled on the target cluster!");
}
}
Expand Down