This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Odfe it framework release #107
Merged
ktkrg
merged 14 commits into
opendistro-for-elasticsearch:master
from
sidheart:odfe-it-framework-release
Jun 15, 2020
+159
−7
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
50b2526
ODFE IT Framework POC
a0735e9
Testing to see if Dockerstuff is set up
ba6a61f
Modified workflow to set DOCKER_COMPOSE_LOCATION
c0c8170
Modify workflow to include stacktrace and no symbolic linkage
93f1daf
Set DOCKER_COMPOSE_LOCATION using set-env
e0f101e
Try set-env in a different location
04d1703
Attempt to fix docker-compose set-env
4d811f4
Make workflow set vm.max_map_count
7d37c72
Use sudo when setting vm.max_map_count
321c4ad
Make performance-analyzer execute integration tests on checkin
9f3938e
Clean up PerformanceAnalyzerIT and build.gradle script
68da615
Add newline to end of gradle.properties file
998f7bc
Modify gradle.yml and checkMetrics
30e106c
Fix ObjectMapper allocation and move TestUtils definition
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Modify gradle.yml and checkMetrics
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.amazon.opendistro.elasticsearch.performanceanalyzer; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.apache.http.HttpHost; | ||
import org.apache.http.HttpStatus; | ||
|
@@ -12,6 +13,7 @@ | |
import org.elasticsearch.client.RestClient; | ||
import org.elasticsearch.test.rest.ESRestTestCase; | ||
import org.junit.AfterClass; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
|
@@ -60,15 +62,40 @@ public static void ensurePaAndRcaEnabled() throws Exception { | |
} | ||
} | ||
|
||
private static class TestUtils { | ||
public static final String DATA = "data"; | ||
public static final String RECORDS = "records"; | ||
|
||
// Field related strings | ||
public static final String FIELDS = "fields"; | ||
public static final String FIELD_NAME = "name"; | ||
public static final String FIELD_TYPE = "type"; | ||
public static final String DOUBLE_TYPE = "DOUBLE"; | ||
|
||
// Metrics related strings | ||
public static final String M_DISKUTIL = "Disk_Utilization"; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: move the class definition to the end of the class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
@Test | ||
public void checkMetrics() throws Exception { | ||
ensurePaAndRcaEnabled(); | ||
Request request = new Request("GET", | ||
"/_opendistro/_performanceanalyzer/metrics/?metrics=Disk_Utilization&agg=max&dim=&nodes=all"); | ||
Response resp = paClient.performRequest(request); | ||
assert resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK; | ||
LOG.info("PA is emitting metrics!! {}", EntityUtils.toString(resp.getEntity(), "UTF-8")); | ||
System.out.println("WASSUP"); | ||
Assert.assertEquals(HttpStatus.SC_OK, resp.getStatusLine().getStatusCode()); | ||
ObjectMapper mapper = new ObjectMapper(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a new ObjectMapper here? Can we re-use the one defined on line 28? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
String jsonString = EntityUtils.toString(resp.getEntity()); | ||
JsonNode root = mapper.readTree(jsonString); | ||
root.forEach( entry -> { | ||
JsonNode data = entry.get(TestUtils.DATA); | ||
Assert.assertEquals(1, data.get(TestUtils.FIELDS).size()); | ||
JsonNode field = data.get(TestUtils.FIELDS).get(0); | ||
Assert.assertEquals(TestUtils.M_DISKUTIL, field.get(TestUtils.FIELD_NAME).asText()); | ||
Assert.assertEquals(TestUtils.DOUBLE_TYPE, field.get(TestUtils.FIELD_TYPE).asText()); | ||
JsonNode records = data.get(TestUtils.RECORDS); | ||
Assert.assertEquals(1, records.size()); | ||
records.get(0).forEach(record -> Assert.assertTrue(record.asDouble() >= 0)); | ||
}); | ||
} | ||
|
||
@AfterClass | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment saying why this is necessary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done