Skip to content

Commit b60b06e

Browse files
authored
test(instrumentation-redis-4): fix tests with [email protected] and earlier (#2914)
In [email protected] and earlier versions of redis v4, client.disconnect() will throw if the connect failed. That broke the "with empty string for client URL, ..." test case, at least on macOS: npm run test:docker:run RUN_REDIS_TESTS=1 npm t I cannot explain why this is not failing in CI. Perhaps something platform specific? This is related to socket handling in the redis client. I believe the relevant change in node-redis was: redis/node-redis#2295 which was part of `@redis/[email protected]` which was included in `[email protected]`.
1 parent c8fa46d commit b60b06e

File tree

1 file changed

+6
-1
lines changed
  • plugins/node/opentelemetry-instrumentation-redis-4/test

1 file changed

+6
-1
lines changed

plugins/node/opentelemetry-instrumentation-redis-4/test/redis.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,12 @@ describe('redis@^4.0.0', () => {
314314
// Ignore. If the test Redis is not at the default port we expect this
315315
// to error.
316316
}
317-
await newClient.disconnect();
317+
try {
318+
await newClient.disconnect();
319+
} catch (_disconnectErr) {
320+
// Ignore. In [email protected] and earlier this disconnect throws
321+
// "The client is closed" if the connect failed.
322+
}
318323

319324
const [span] = getTestSpans();
320325
assert.strictEqual(span.name, 'redis-connect');

0 commit comments

Comments
 (0)