Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 2711177

Browse files
committed
tests: revert createReadStreamInternal changes to avoid stepping on data loss mines
1 parent 1a017d0 commit 2711177

2 files changed

Lines changed: 1 addition & 29 deletions

File tree

src/utils/createReadStreamInternal.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -428,19 +428,6 @@ export function createReadStreamInternal(
428428
rowStreamPipe(rowStream, userStream);
429429
};
430430

431-
// If the timeout is exceeded for the whole operation, bail with
432-
// an error as the conformance test requires.
433-
if (timeout) {
434-
const deadlineTimer = setTimeout(() => {
435-
const err = new Error(`Total timeout of ${timeout}ms exceeded.`);
436-
(err as unknown as grpc.StatusObject).code =
437-
grpc.status.DEADLINE_EXCEEDED;
438-
userStream.destroy(err);
439-
}, timeout);
440-
441-
userStream.on('close', () => clearTimeout(deadlineTimer));
442-
}
443-
444431
makeNewRequest();
445432
return userStream;
446433
}

test/table.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,7 @@ describe('Bigtable/Table', () => {
11901190
.on('data', done);
11911191
});
11921192
});
1193-
1194-
// Skip: This test currently doesn't make sense after conformance test
1195-
// changes. The error will always be DEADLINE_EXCEEDED, not UNAVAILABLE.
1196-
it.skip('Should respect the timeout parameter passed in for UNAVAILABLE error', done => {
1193+
it('Should respect the timeout parameter passed in for UNAVAILABLE error', done => {
11971194
// The timeout is 2 seconds, but the error is received after 3 seconds
11981195
// so the client doesn't retry because more than 2 seconds have elapsed.
11991196
const requestSpy = (table.bigtable.request = sinon.spy(() => {
@@ -1216,11 +1213,9 @@ describe('Bigtable/Table', () => {
12161213
done();
12171214
});
12181215
});
1219-
12201216
it('Should respect the timeout parameter passed in for DEADLINE_EXCEEDED error', done => {
12211217
// The timeout is 2 seconds, but the error is received after 3 seconds
12221218
// so the client doesn't retry because more than 2 seconds have elapsed.
1223-
let timeoutReceived = false;
12241219
const requestSpy = (table.bigtable.request = sinon.spy(() => {
12251220
const stream = new PassThrough({
12261221
objectMode: true,
@@ -1235,16 +1230,6 @@ describe('Bigtable/Table', () => {
12351230
}));
12361231
const stream = table.createReadStream({gaxOptions: {timeout: 2000}});
12371232
stream.on('error', (error: ServiceError) => {
1238-
if (!timeoutReceived) {
1239-
assert.strictEqual(error.code, 4);
1240-
assert.strictEqual(
1241-
error.message,
1242-
'Total timeout of 2000ms exceeded.',
1243-
);
1244-
assert.strictEqual(requestSpy.callCount, 1); // Ensures the client has not retried.
1245-
done();
1246-
}
1247-
timeoutReceived = true;
12481233
});
12491234
});
12501235
describe('retries', () => {

0 commit comments

Comments
 (0)