Skip to content

Commit

Permalink
test: fix flaky tracing test.
Browse files Browse the repository at this point in the history
Fixes #2244.
  • Loading branch information
ehsannas committed Dec 3, 2024
1 parent 1ddb62e commit be823a1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dev/system-test/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,12 @@ describe('Tracing Tests', () => {
if (success) {
buildSpanMaps();
}
expect(spanIdToSpanData.size).to.equal(

// Tests are able to perform some Firestore operations inside
// `runFirestoreOperationInRootSpan`, and some Firestore operations outside
// of it. Therefore, if a given test intends to capture some (but not all) spans,
// the in-memory trace will have more spans than `numExpectedSpans`.
expect(spanIdToSpanData.size).to.greaterThanOrEqual(
numExpectedSpans,
`Could not find expected number of spans (${numExpectedSpans})`
);
Expand Down Expand Up @@ -812,6 +817,10 @@ describe('Tracing Tests', () => {
});

it('document reference update()', async () => {
// Make sure the document exists before updating it.
// Perform the `set` operation outside of the root span.
await firestore.collection('foo').doc('bar').set({foo: 'bar'});

await runFirestoreOperationInRootSpan(() =>
firestore.collection('foo').doc('bar').update('foo', 'bar2')
);
Expand Down

0 comments on commit be823a1

Please sign in to comment.