Skip to content

Commit 8dd38bb

Browse files
committed
v2.x release old postgres no promises (see #3256)
1 parent d1a6414 commit 8dd38bb

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

packages/datadog-plugin-pg/test/index.spec.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,15 @@ describe('Plugin', () => {
191191
})
192192
})
193193

194-
withNamingSchema(
195-
done => client.query('SELECT $1::text as message', ['Hello world!'])
196-
.then(() => client.end())
197-
.catch(done),
198-
() => namingSchema.outbound.opName,
199-
() => namingSchema.outbound.serviceName
200-
)
194+
if (semver.intersects(version, '>=5.1')) {
195+
withNamingSchema(
196+
done => client.query('SELECT $1::text as message', ['Hello world!'])
197+
.then(() => client.end())
198+
.catch(done),
199+
() => namingSchema.outbound.opName,
200+
() => namingSchema.outbound.serviceName
201+
)
202+
}
201203
})
202204
})
203205

@@ -240,13 +242,15 @@ describe('Plugin', () => {
240242
})
241243
})
242244

243-
withNamingSchema(
244-
done => client.query('SELECT $1::text as message', ['Hello world!'])
245-
.then(() => client.end())
246-
.catch(done),
247-
() => namingSchema.outbound.opName,
248-
() => 'custom'
249-
)
245+
if (semver.intersects(version, '>=5.1')) {
246+
withNamingSchema(
247+
done => client.query('SELECT $1::text as message', ['Hello world!'])
248+
.then(() => client.end())
249+
.catch(done),
250+
() => namingSchema.outbound.opName,
251+
() => 'custom'
252+
)
253+
}
250254
})
251255

252256
describe('with a service name callback', () => {
@@ -288,13 +292,15 @@ describe('Plugin', () => {
288292
})
289293
})
290294

291-
withNamingSchema(
292-
done => client.query('SELECT $1::text as message', ['Hello world!'])
293-
.then(() => client.end())
294-
.catch(done),
295-
() => namingSchema.outbound.opName,
296-
() => '127.0.0.1-postgres'
297-
)
295+
if (semver.intersects(version, '>=5.1')) {
296+
withNamingSchema(
297+
done => client.query('SELECT $1::text as message', ['Hello world!'])
298+
.then(() => client.end())
299+
.catch(done),
300+
() => namingSchema.outbound.opName,
301+
() => '127.0.0.1-postgres'
302+
)
303+
}
298304
})
299305

300306
describe('with DBM propagation enabled with service using plugin configurations', () => {

0 commit comments

Comments
 (0)