Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadnoveljic committed Dec 17, 2024
1 parent f7636a4 commit 907ad6b
Showing 1 changed file with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {
def addDbmTag = dbmTraceInjected()
resultSet.next()
resultSet.getInt(1) == 3
if (driver == POSTGRESQL || driver == MYSQL || !addDbmTag) {
if (driver == POSTGRESQL || driver == MYSQL || driver == ORACLE || !addDbmTag) {
assertTraces(1) {
trace(2) {
basicSpan(it, "parent")
Expand Down Expand Up @@ -453,9 +453,11 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {
if (usingHikari) {
"$Tags.DB_POOL_NAME" String
}
if (this.dbmTracePreparedStatements(driver)){
if (this.dbmTracePreparedStatements(this.getDbType(driver))){
"$InstrumentationTags.DBM_TRACE_INJECTED" true
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
if (driver == POSTGRESQL) {
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
}
}
peerServiceFrom(Tags.DB_INSTANCE)
defaultTags()
Expand Down Expand Up @@ -590,7 +592,9 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {
}
if (this.dbmTracePreparedStatements(driver)){
"$InstrumentationTags.DBM_TRACE_INJECTED" true
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
if (driver == POSTGRESQL) {
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
}
}
peerServiceFrom(Tags.DB_INSTANCE)
defaultTags()
Expand Down Expand Up @@ -717,9 +721,11 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {
if (conPoolType == "hikari") {
"$Tags.DB_POOL_NAME" String
}
if (this.dbmTracePreparedStatements(driver)){
if (this.dbmTracePreparedStatements(this.getDbType(driver))){
"$InstrumentationTags.DBM_TRACE_INJECTED" true
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
if (driver == POSTGRESQL) {
"$InstrumentationTags.INSTRUMENTATION_TIME_MS" Long
}
}
defaultTags()
}
Expand Down Expand Up @@ -766,7 +772,7 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {
then:
def addDbmTag = dbmTraceInjected()
statement.updateCount == 0
if (driver == POSTGRESQL || driver == MYSQL || !dbmTraceInjected()) {
if (driver == POSTGRESQL || driver == MYSQL || driver == ORACLE || !dbmTraceInjected()) {
assertTraces(1) {
trace(2) {
basicSpan(it, "parent")
Expand Down Expand Up @@ -1034,9 +1040,7 @@ abstract class RemoteJDBCInstrumentationTest extends VersionedNamingTestBase {

protected abstract boolean dbmTraceInjected()

protected boolean dbmTracePreparedStatements(String dbType){
return false
}
protected abstract boolean dbmTracePreparedStatements(String dbType)
}

class RemoteJDBCInstrumentationV0Test extends RemoteJDBCInstrumentationTest {
Expand All @@ -1060,6 +1064,11 @@ class RemoteJDBCInstrumentationV0Test extends RemoteJDBCInstrumentationTest {
protected boolean dbmTraceInjected() {
return false
}

@Override
protected boolean dbmTracePreparedStatements(String dbType) {
return false
}
}

class RemoteJDBCInstrumentationV1ForkedTest extends RemoteJDBCInstrumentationTest {
Expand All @@ -1084,6 +1093,11 @@ class RemoteJDBCInstrumentationV1ForkedTest extends RemoteJDBCInstrumentationTes
return false
}

@Override
protected boolean dbmTracePreparedStatements(String dbType) {
return false
}

@Override
protected String getDbType(String dbType) {
final databaseNaming = new DatabaseNamingV1()
Expand All @@ -1104,6 +1118,11 @@ class RemoteDBMTraceInjectedForkedTest extends RemoteJDBCInstrumentationTest {
return true
}

@Override
protected boolean dbmTracePreparedStatements(String dbType){
return dbType == ORACLE
}

@Override
int version() {
return 1
Expand Down Expand Up @@ -1163,6 +1182,6 @@ class RemoteDBMTraceInjectedForkedTestTracePreparedStatements extends RemoteJDBC

@Override
protected boolean dbmTracePreparedStatements(String dbType){
return dbType == POSTGRESQL
return dbType == POSTGRESQL || dbType == ORACLE
}
}

0 comments on commit 907ad6b

Please sign in to comment.