Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {CallOptions} from 'google-gax';
import {ServiceError} from 'google-gax';
import {google} from '../protos/protos';
import {RowDataUtils, RowProperties} from './row-data-utils';
import {TabularApiSurface} from './tabular-api-surface';
import {GetRowsOptions, TabularApiSurface} from './tabular-api-surface';
import {getRowsInternal} from './utils/getRowsInternal';
import {
MethodName,
Expand Down Expand Up @@ -667,9 +667,10 @@ export class Row {
filter = arrify(filter).concat(options.filter);
}

const getRowsOptions = Object.assign({}, options, {
const getRowsOptions: GetRowsOptions = Object.assign({}, options, {
keys: [this.id],
filter,
limit: 1,
});

const metricsCollector =
Expand Down
13 changes: 13 additions & 0 deletions src/utils/createReadStreamInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,19 @@ export function createReadStreamInternal(
rowStreamPipe(rowStream, userStream);
};

// If the timeout is exceeded for the whole operation, bail with
// an error as the conformance test requires.
if (timeout) {
const deadlineTimer = setTimeout(() => {
const err = new Error(`Total timeout of ${timeout}ms exceeded.`);
(err as unknown as grpc.StatusObject).code =
grpc.status.DEADLINE_EXCEEDED;
userStream.destroy(err);
}, timeout);

userStream.on('close', () => clearTimeout(deadlineTimer));
}

makeNewRequest();
return userStream;
}
Expand Down
2 changes: 0 additions & 2 deletions testproxy/known_failures.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
TestMutateRow_Generic_DeadlineExceeded\|
TestMutateRow_Generic_CloseClient\|
TestMutateRows_Retry_WithRoutingCookie\|
TestReadRow_Generic_DeadlineExceeded\|
TestReadRow_Retry_WithRoutingCookie\|
TestReadRow_Retry_WithRetryInfo\|
TestReadRows_ReverseScans_FeatureFlag_Enabled\|
Expand Down
24 changes: 15 additions & 9 deletions testproxy/services/mutate-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@ const mutateRow = ({clientMap}) =>
const appProfileId = clientMap.get(clientId).appProfileId;
const client = clientMap.get(clientId)[v2];

await client.mutateRow({
appProfileId,
mutations,
tableName,
rowKey,
});
try {
await client.mutateRow({
appProfileId,
mutations,
tableName,
rowKey,
});

return {
status: {code: grpc.status.OK, details: []},
};
return {
status: {code: grpc.status.OK, details: []},
};
} catch (e) {
return {
status: e,
};
}
});

module.exports = mutateRow;
19 changes: 13 additions & 6 deletions testproxy/services/read-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ const readRow = ({clientMap}) =>
const bigtable = clientMap.get(clientId);
const table = getTableInfo(bigtable, tableName);
const row = table.row(rowKey);
const res = await row.get(columns);
const firstRow = getRowResponse(res[0]);

return {
status: {code: grpc.status.OK, details: []},
row: firstRow,
};
try {
const res = await row.get(columns);
const firstRow = getRowResponse(res[0]);

return {
status: {code: grpc.status.OK, details: []},
row: firstRow,
};
} catch (e) {
return {
status: e,
};
}
});

module.exports = readRow;
Loading