Skip to content

Commit faf34fc

Browse files
committed
Add extra unit test for AwsMetricAttributeGenerator
1 parent c8b5e0e commit faf34fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,18 @@ public void testGetDBStatementRemoteOperation() {
632632
mockAttribute(DB_STATEMENT, "SELECT FROM *");
633633
mockAttribute(DB_OPERATION, "DB operation");
634634
validateExpectedRemoteAttributes("DB system", "DB operation");
635+
636+
// Case 10: Same as case 1 but with leading whitespace
637+
mockAttribute(DB_SYSTEM, "DB system");
638+
mockAttribute(DB_STATEMENT, " SELECT DB statement");
639+
mockAttribute(DB_OPERATION, null);
640+
validateExpectedRemoteAttributes("DB system", "SELECT");
641+
642+
// Case 11: Same as case 2, but with leading whitespace. Testing if whitespace affects longest match
643+
mockAttribute(DB_SYSTEM, "DB system");
644+
mockAttribute(DB_STATEMENT, " DROP VIEW DB statement");
645+
mockAttribute(DB_OPERATION, null);
646+
validateExpectedRemoteAttributes("DB system", "DROP VIEW");
635647
}
636648

637649
@Test

0 commit comments

Comments
 (0)