Skip to content

Commit 13cc509

Browse files
committed
De-flake EndToEnd Database.runStream test with by ignoring grpc.CANCELLED
1 parent abfc373 commit 13cc509

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

observability-test/spanner.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ describe('EndToEnd', () => {
170170

171171
afterEach(async () => {
172172
await tracerProvider.forceFlush();
173+
await tracerProvider.shutdown();
173174
traceExporter.reset();
174175
spannerMock.resetRequests();
175176
spanner.close();
@@ -323,7 +324,16 @@ describe('EndToEnd', () => {
323324
database
324325
.runStream('SELECT 1')
325326
.on('data', row => {})
326-
.on('error', assert.ifError)
327+
.on('error', err => {
328+
// De-flake by ignoring grpc.status.CANCELLED as we've
329+
// seen on the Github test runners, due to timing.
330+
const grpcErr = err as grpc.ServiceError;
331+
if (!grpcErr) {
332+
assert.ifError(err);
333+
} else if (grpcErr.code != grpc.status.CANCELLED) {
334+
assert.ifError(err);
335+
}
336+
})
327337
.on('end', () => {
328338
traceExporter.forceFlush();
329339
const spans = traceExporter.getFinishedSpans();

0 commit comments

Comments
 (0)