Skip to content

Commit a4a7c5d

Browse files
authored
test(e2e): Use collectStreamedSpansUntilSegment in the create-remix-app-v2 db specs (#24092)
## What Switches the two `create-remix-app-v2` db specs to the shared `collectStreamedSpansUntilSegment` helper from #24073. The explicit child-span count was redundant: the segment span ends last, so its children are already in hand once it arrives. ## Why Follow-up to #24058, which landed before the helper existed. Ref: #23807
1 parent a112273 commit a4a7c5d

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

  • dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests

‎dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/db.test.ts‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
import { expect, test } from '@playwright/test';
22
import type { SerializedStreamedSpan } from '@sentry-internal/test-utils';
3-
import { collectStreamedSpans, getSpanOp } from '@sentry-internal/test-utils';
3+
import { collectStreamedSpansUntilSegment, getSpanOp } from '@sentry-internal/test-utils';
44

55
function isSegmentFor(path: string): (span: SerializedStreamedSpan) => boolean {
6-
return span => getSpanOp(span) === 'http.server' && span.is_segment && span.attributes['url.path']?.value === path;
6+
return span => getSpanOp(span) === 'http.server' && span.attributes['url.path']?.value === path;
77
}
88

99
// Orchestrion force-bundles + transforms mysql/ioredis at build time, and the databases
1010
// are booted via docker-compose in the Playwright global setup.
1111
test.describe('orchestrion DB instrumentation', () => {
1212
test('Instruments ioredis automatically via orchestrion', async ({ baseURL }) => {
13-
const spansPromise = collectStreamedSpans(
14-
'create-remix-app-v2',
15-
spans =>
16-
spans.some(isSegmentFor('/db-ioredis')) && spans.filter(span => getSpanOp(span) === 'db.query').length >= 2,
17-
);
13+
const spansPromise = collectStreamedSpansUntilSegment('create-remix-app-v2', isSegmentFor('/db-ioredis'));
1814

1915
await fetch(`${baseURL}/db-ioredis`);
2016

@@ -48,10 +44,7 @@ test.describe('orchestrion DB instrumentation', () => {
4844
});
4945

5046
test('Instruments mysql automatically via orchestrion', async ({ baseURL }) => {
51-
const spansPromise = collectStreamedSpans(
52-
'create-remix-app-v2',
53-
spans => spans.some(isSegmentFor('/db-mysql')) && spans.filter(span => getSpanOp(span) === 'db').length >= 2,
54-
);
47+
const spansPromise = collectStreamedSpansUntilSegment('create-remix-app-v2', isSegmentFor('/db-mysql'));
5548

5649
await fetch(`${baseURL}/db-mysql`);
5750

0 commit comments

Comments
 (0)