Skip to content

Commit a95eb51

Browse files
authored
fix(testing): Fixes count check for apdex metrics (#946)
The current code for EXPECT_METRICS_EXIST would verify the count of any metric was >0 before passing the test. However, with apdex metrics the first field is not the count of metrics but the count of the number of times the transaction time was less than apdex_t. This change allows for the count to be 0 for apdex metrics.
1 parent 1291a76 commit a95eb51

File tree

1 file changed

+6
-1
lines changed
  • daemon/internal/newrelic/integration

1 file changed

+6
-1
lines changed

daemon/internal/newrelic/integration/test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,12 @@ func (t *Test) compareMetricsExist(harvest *newrelic.Harvest) {
544544
actualCount := int64(math.Round(actualData.([]interface{})[0].(float64)))
545545

546546
metricPasses := false
547-
if (count == -1 && actualCount > 0) || (actualCount == count) {
547+
548+
// apdex metrics can have a count of 0 since the count field is
549+
// actually the "satisfied" count, not a total count of metric
550+
// as it is for other types of metrics
551+
apdex_metric := strings.HasPrefix(expected, "Apdex/")
552+
if (count == -1 && (apdex_metric || actualCount > 0)) || (actualCount == count) {
548553
metricPasses = true
549554
}
550555

0 commit comments

Comments
 (0)