Skip to content

Commit

Permalink
Backport/backport 204/208 to 2.0 (#216)
Browse files Browse the repository at this point in the history
* Fixing header key value issue (#203) (#204)

Signed-off-by: Ankit Jain <[email protected]>
(cherry picked from commit 778e18a)

* Changing integration tests to use pa agent for header validation and e2e testing

Signed-off-by: Ankit Jain <[email protected]>
(cherry picked from commit b9425f2)
  • Loading branch information
jainankitk authored May 13, 2022
1 parent f7060b0 commit 7ffe158
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
try {
Map<String, List<String>> map = httpURLConnection.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
finalResponse.addHeader(entry.getKey(), entry.getValue().toString());
if (entry.getKey() != null && entry.getKey().length() != 0) {
for (String value : entry.getValue()) {
finalResponse.addHeader(entry.getKey(), value);
}
}
}
// Send Response back to callee
channel.sendResponse(finalResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ITConfig {
private String transportEndpoint;

// The port number to use for
private int paPort = 9600;
private int paPort = 9200;

public ITConfig() {
https = Boolean.parseBoolean(System.getProperty("tests.https"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public void checkLegacyCPUUtilization() throws Exception {
public void checkCPUUtilization(String paBaseUri) throws Exception {
// read metric from local node
List<JsonResponseNode> responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=CPU_Utilization&agg=sum");
readMetric(paBaseUri + "/_agent/metrics?metrics=CPU_Utilization&agg=sum");
Assert.assertEquals(1, responseNodeList.size());
validatePerNodeCPUMetric(responseNodeList.get(0));

// read metric from all nodes in cluster
responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=CPU_Utilization&agg=sum&nodes=all");
readMetric(paBaseUri + "/_agent/metrics?metrics=CPU_Utilization&agg=sum&nodes=all");
int nodeNum = getNodeIDs().size();
Assert.assertEquals(nodeNum, responseNodeList.size());
for (int i = 0; i < nodeNum; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ private void checkHeapMetric(
throws Exception {
// read metric from local node
List<JsonResponseNode> responseNodeList =
readMetric(paBaseUri + "/metrics/?metrics=" + metric.toString() + "&agg=max");
readMetric(
paBaseUri + "/_agent/metrics/?metrics=" + metric.toString() + "&agg=max");
Assert.assertEquals(1, responseNodeList.size());
validateHeapMetric(responseNodeList.get(0), metric, metricValidator);

// read metric from all nodes in cluster
responseNodeList =
readMetric(
paBaseUri
+ "/metrics/?metrics="
+ "/_agent/metrics/?metrics="
+ metric.toString()
+ "&agg=max&nodes=all");
int nodeNum = getNodeIDs().size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public void checkLegacyPaging_MajfltRate() throws Exception {
public void checkPaging_MajfltRate(String paBaseUri) throws Exception {
// read metric from local node
List<JsonResponseNode> responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=Paging_MajfltRate&agg=max");
readMetric(paBaseUri + "/_agent/metrics?metrics=Paging_MajfltRate&agg=max");
Assert.assertEquals(1, responseNodeList.size());
validateMajorPageFaultMetric(responseNodeList.get(0));

// read metric from all nodes in cluster
responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=Paging_MajfltRate&agg=max&nodes=all");
readMetric(
paBaseUri + "/_agent/metrics?metrics=Paging_MajfltRate&agg=max&nodes=all");
int nodeNum = getNodeIDs().size();
Assert.assertEquals(nodeNum, responseNodeList.size());
for (int i = 0; i < nodeNum; i++) {
Expand All @@ -66,13 +67,14 @@ public void checkLegacyPaging_MinfltRate() throws Exception {
public void checkPaging_MinfltRate(String paBaseUri) throws Exception {
// read metric from local node
List<JsonResponseNode> responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=Paging_MinfltRate&agg=max");
readMetric(paBaseUri + "/_agent/metrics?metrics=Paging_MinfltRate&agg=max");
Assert.assertEquals(1, responseNodeList.size());
validateMinorPageFaultMetric(responseNodeList.get(0));

// read metric from all nodes in cluster
responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=Paging_MinfltRate&agg=max&nodes=all");
readMetric(
paBaseUri + "/_agent/metrics?metrics=Paging_MinfltRate&agg=max&nodes=all");
int nodeNum = getNodeIDs().size();
Assert.assertEquals(nodeNum, responseNodeList.size());
for (int i = 0; i < nodeNum; i++) {
Expand All @@ -93,12 +95,13 @@ public void checkLegacyPaging_RSS() throws Exception {
public void checkPaging_RSS(String paBaseUri) throws Exception {
// read metric from local node
List<JsonResponseNode> responseNodeList =
readMetric(paBaseUri + "/metrics?metrics=Paging_RSS&agg=max");
readMetric(paBaseUri + "/_agent/metrics?metrics=Paging_RSS&agg=max");
Assert.assertEquals(1, responseNodeList.size());
validatePagingRSSMetric(responseNodeList.get(0));

// read metric from all nodes in cluster
responseNodeList = readMetric(paBaseUri + "/metrics?metrics=Paging_RSS&agg=max&nodes=all");
responseNodeList =
readMetric(paBaseUri + "/_agent/metrics?metrics=Paging_RSS&agg=max&nodes=all");
int nodeNum = getNodeIDs().size();
Assert.assertEquals(nodeNum, responseNodeList.size());
for (int i = 0; i < nodeNum; i++) {
Expand Down

0 comments on commit 7ffe158

Please sign in to comment.