Skip to content

Commit

Permalink
Fixing broken http-client functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
meiao committed Nov 1, 2021
1 parent 55d6092 commit 8ca9fa4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ public void httpMethod() throws IOException {

Set<String> metrics = AgentHelper.getMetrics();
assertTrue(metrics.toString(), metrics.contains("External/localhost/CommonsHttp"));
assertTrue(metrics.toString(), metrics.contains("External/localhost/CommonsHttp/execute"));
assertTrue(metrics.toString(), metrics.contains("External/localhost/all"));
assertTrue(metrics.toString(), metrics.contains("External/all"));
assertTrue(metrics.toString(), metrics.contains("External/allOther"));

Map<String, Integer> metricCounts = getMetricCounts(
MetricName.create("External/localhost/CommonsHttp",
"OtherTransaction/Custom/test.newrelic.test.agent.HttpCommonsTest/httpMethodImpl"),
MetricName.create("External/localhost/CommonsHttp/execute",
"OtherTransaction/Custom/test.newrelic.test.agent.HttpCommonsTest/httpMethodImpl"),
MetricName.create("External/localhost/all"),
MetricName.create("External/all"),
MetricName.create("External/allOther"));
Expand All @@ -105,9 +108,10 @@ public void httpMethod() throws IOException {
assertEquals(3, (int) metricCounts.get("External/all"));
assertEquals(3, (int) metricCounts.get("External/allOther"));

// This is 6 because the loop executes 3 times and each loop calls
// This is 3 because the loop executes 3 times and each loop calls
// execute() and releaseConnection(), both of which are instrumented
assertEquals(6, (int) metricCounts.get("External/localhost/CommonsHttp"));
assertEquals(3, (int) metricCounts.get("External/localhost/CommonsHttp")); // releaseConnection
assertEquals(3, (int) metricCounts.get("External/localhost/CommonsHttp/execute"));
}

@Trace(dispatcher = true)
Expand Down

0 comments on commit 8ca9fa4

Please sign in to comment.