Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ dependencies {
testImplementation group: 'org.testcontainers', name: 'postgresql', version: libs.versions.testcontainers.get()

latestDepTestImplementation group: 'io.vertx', name: 'vertx-pg-client', version: '4.+'
latestDepTestImplementation group: 'com.ongres.scram', name: 'scram-client', version: '3.2'
}

// in v3 of scram, module names were changed to scram-*
// we need to exclude the old scram 2.1 artifacts from latestDep (that are pulled from testImplementation)to avoid conflicts
configurations.matching { it.name.startsWith('latestDep') }.configureEach {
exclude group: 'com.ongres.scram', module: 'client'
exclude group: 'com.ongres.scram', module: 'common'
}

tasks.withType(Test).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,40 @@ class VertxPostgresSqlClientForkedTest extends InstrumentationSpecification {

AsyncResult<RowSet<Row>> queryCursorWithHandler(Cursor cursor) {
def latch = new CountDownLatch(1)
AsyncResult<RowSet<Row>> result = null
AsyncResult<RowSet<Row>> asyncResult = null
cursor.read(0) { rowSetAR ->
runUnderTrace("handler") {
result = rowSetAR
asyncResult = rowSetAR
}
latch.countDown()
}
assert latch.await(10, TimeUnit.SECONDS)
return result
assert asyncResult?.succeeded() : "Failed to read cursor: ${asyncResult?.cause()}"
return asyncResult
}

SqlConnection connection(Pool pool) {
def latch = new CountDownLatch(1)
SqlConnection result = null
AsyncResult<SqlConnection> asyncResult = null
pool.getConnection({ connectionAR ->
result = connectionAR.result()
asyncResult = connectionAR
latch.countDown()
})
assert latch.await(10, TimeUnit.SECONDS)
return result
assert asyncResult?.succeeded() : "Failed to get connection: ${asyncResult?.cause()}"
return asyncResult.result()
}

PreparedStatement prepare(SqlConnection connection, String sql) {
def latch = new CountDownLatch(1)
PreparedStatement result = null
AsyncResult<PreparedStatement> asyncResult = null
connection.prepare(sql, { statementAR ->
result = statementAR.result()
asyncResult = statementAR
latch.countDown()
})
assert latch.await(10, TimeUnit.SECONDS)
return result
assert asyncResult?.succeeded() : "Failed to prepare statement: ${asyncResult?.cause()}"
return asyncResult.result()
}

void checkDBSpan(TraceAssert ta, DDSpan parent, String resource, String operation, TestDBInfo info, boolean prepared = false) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package datadog.trace.api.debugger

import datadog.environment.JavaVirtualMachine
import datadog.trace.api.InstrumenterConfig
import spock.lang.Specification

Expand Down