Skip to content

Commit 38d8487

Browse files
committed
test(redis-2-3): insert additional asserts
1 parent ce90fe4 commit 38d8487

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

packages/instrumentation-redis/test/v2-v3/redis.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,21 @@ describe('redis v2-v3', () => {
190190
);
191191
assert.ok(!(ATTR_DB_SYSTEM_NAME in span.attributes));
192192
assert.ok(!(ATTR_DB_QUERY_TEXT in span.attributes));
193+
194+
assert.strictEqual(
195+
span.attributes[SEMATTRS_NET_PEER_NAME],
196+
CONFIG.host
197+
);
198+
assert.strictEqual(
199+
span.attributes[SEMATTRS_NET_PEER_PORT],
200+
CONFIG.port
201+
);
202+
assert.strictEqual(
203+
span.attributes[SEMATTRS_DB_CONNECTION_STRING],
204+
URL
205+
);
206+
assert.ok(!(ATTR_SERVER_ADDRESS in span.attributes));
207+
assert.ok(!(ATTR_SERVER_PORT in span.attributes));
193208
done();
194209
});
195210
});
@@ -207,6 +222,11 @@ describe('redis v2-v3', () => {
207222
);
208223
assert.ok(!(SEMATTRS_DB_SYSTEM in span.attributes));
209224
assert.ok(!(SEMATTRS_DB_STATEMENT in span.attributes));
225+
assert.strictEqual(span.attributes[ATTR_SERVER_ADDRESS], CONFIG.host);
226+
assert.strictEqual(span.attributes[ATTR_SERVER_PORT], CONFIG.port);
227+
assert.ok(!(SEMATTRS_NET_PEER_NAME in span.attributes));
228+
assert.ok(!(SEMATTRS_NET_PEER_PORT in span.attributes));
229+
assert.ok(!(SEMATTRS_DB_CONNECTION_STRING in span.attributes));
210230
done();
211231
});
212232
});
@@ -227,6 +247,20 @@ describe('redis v2-v3', () => {
227247
span.attributes[ATTR_DB_QUERY_TEXT],
228248
'set covKey [1 other arguments]'
229249
);
250+
assert.strictEqual(
251+
span.attributes[SEMATTRS_NET_PEER_NAME],
252+
CONFIG.host
253+
);
254+
assert.strictEqual(
255+
span.attributes[SEMATTRS_NET_PEER_PORT],
256+
CONFIG.port
257+
);
258+
assert.strictEqual(span.attributes[ATTR_SERVER_ADDRESS], CONFIG.host);
259+
assert.strictEqual(span.attributes[ATTR_SERVER_PORT], CONFIG.port);
260+
assert.strictEqual(
261+
span.attributes[SEMATTRS_DB_CONNECTION_STRING],
262+
URL
263+
);
230264
done();
231265
});
232266
});

0 commit comments

Comments
 (0)