-
Notifications
You must be signed in to change notification settings - Fork 1k
Unify jdbc tests between javaagent and library instrumentation #15137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf1db4c
c379244
35abf7d
0304d33
0dddcf8
a8a700f
beb5c45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,7 @@ public void transform(TypeTransformer transformer) { | |
| transformer.applyAdviceToMethod( | ||
| namedOneOf( | ||
| "setBoolean", | ||
| "setByte", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added to match library instrumentation
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch. Down below there are 2 lines with comment |
||
| "setShort", | ||
| "setInt", | ||
| "setLong", | ||
|
|
@@ -155,7 +156,7 @@ public static void onExit( | |
| String str = null; | ||
|
|
||
| if (value instanceof Boolean | ||
| // Short, Int, Long, Float, Double, BigDecimal | ||
| // Byte, Short, Int, Long, Float, Double, BigDecimal | ||
| || value instanceof Number | ||
| || value instanceof String | ||
| || value instanceof Date | ||
|
|
@@ -190,7 +191,7 @@ public static void onExit( | |
| String str = null; | ||
|
|
||
| if (value instanceof Boolean | ||
| // Short, Int, Long, Float, Double, BigDecimal | ||
| // Byte, Short, Int, Long, Float, Double, BigDecimal | ||
| || value instanceof Number | ||
| || value instanceof String | ||
| || value instanceof Date | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,22 +29,28 @@ | |
| import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
|
||
| @SuppressWarnings("deprecation") // using deprecated semconv | ||
| class DruicDataSourceTest { | ||
| class DruidDataSourceTest { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (unrelated fix) |
||
|
|
||
| @RegisterExtension | ||
| static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); | ||
|
|
||
| private DataSource dataSource; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| void setUp() throws SQLException { | ||
| DruidDataSource druidDataSource = new DruidDataSource(); | ||
| druidDataSource.setUrl("jdbc:h2:mem:test"); | ||
| druidDataSource.setDriverClassName("org.h2.Driver"); | ||
| druidDataSource.setUsername("sa"); | ||
| druidDataSource.setPassword(""); | ||
| druidDataSource.setMaxActive(1); | ||
| this.dataSource = druidDataSource; | ||
|
|
||
| // Initialize the connection pool to trigger H2's internal schema setup | ||
| // This prevents internal H2 spans from appearing in the test assertions | ||
| testing.runWithSpan("parent", () -> dataSource.getConnection().close()); | ||
| testing.waitForTraces(1); | ||
| testing.clearData(); | ||
| } | ||
|
|
||
| @AfterEach | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test seems to pass with version 1.3.169 which is specified above