Skip to content

Commit

Permalink
Add Extra Unit Test for AwsMetricAttributeGenerator (#903)
Browse files Browse the repository at this point in the history
*Issue #, if available:*
Adding extra unit test to check if leading whitespace in remote
operation attributes are removed

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
harrryr authored Oct 4, 2024
1 parent 048535a commit c6e03ab
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,19 @@ public void testGetDBStatementRemoteOperation() {
mockAttribute(DB_STATEMENT, "SELECT FROM *");
mockAttribute(DB_OPERATION, "DB operation");
validateExpectedRemoteAttributes("DB system", "DB operation");

// Case 10: Duplicate of case 1 with leading whitespace
mockAttribute(DB_SYSTEM, "DB system");
mockAttribute(DB_STATEMENT, " SELECT DB statement");
mockAttribute(DB_OPERATION, null);
validateExpectedRemoteAttributes("DB system", "SELECT");

// Case 11: Duplicate of case 2 with leading whitespace. Test if whitespace affects longest
// match
mockAttribute(DB_SYSTEM, "DB system");
mockAttribute(DB_STATEMENT, " DROP VIEW DB statement");
mockAttribute(DB_OPERATION, null);
validateExpectedRemoteAttributes("DB system", "DROP VIEW");
}

@Test
Expand Down

0 comments on commit c6e03ab

Please sign in to comment.