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

Commit 45169da

Browse files
committed
tests: catch errors in mutate rows testproxy functions
1 parent 44bb10f commit 45169da

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

testproxy/known_failures.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
TestMutateRow_Generic_CloseClient\|
2-
TestMutateRow_Generic_DeadlineExceeded\|
3-
TestReadModifyWriteRow_Generic_DeadlineExceeded\|
4-
TestReadRow_Generic_DeadlineExceeded\|
52
TestSampleRowKeys_Generic_Headers\|
63
TestSampleRowKeys_NoRetry_NoEmptyKey\|
74
TestSampleRowKeys_Generic_CloseClient\|

testproxy/services/read-row.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
getRowResponse,
2525
getTableInfo,
2626
} from './utils';
27+
import {GoogleError} from 'google-gax';
2728

2829
export const readRow: ClientImplMaker<IReadRowRequest, IRowResult> = ({
2930
clientMap,
@@ -32,15 +33,27 @@ export const readRow: ClientImplMaker<IReadRowRequest, IRowResult> = ({
3233
const {clientId, rowKey, tableName} = rawRequest.request;
3334
const columns = {};
3435

35-
const bigtable = clientMap.get(clientId!);
36-
const table = getTableInfo(bigtable, tableName!);
37-
const row = table.row(rowKey!);
36+
try {
37+
const bigtable = clientMap.get(clientId!);
38+
const table = getTableInfo(bigtable, tableName!);
39+
const row = table.row(rowKey!);
3840

39-
const res = await row.get(columns);
40-
const firstRow = getRowResponse(res[0]);
41+
const res = await row.get(columns);
42+
const firstRow = getRowResponse(res[0]);
4143

42-
return {
43-
status: {code: grpc.status.OK, details: []},
44-
row: firstRow,
45-
};
44+
return {
45+
status: {code: grpc.status.OK, details: []},
46+
row: firstRow,
47+
};
48+
} catch (e) {
49+
const error = e as GoogleError;
50+
return {
51+
status: {
52+
code: error.code,
53+
// e.details must be in an empty array for the test runner to return the status. This is tracked in b/383096533.
54+
details: [],
55+
message: error.message,
56+
},
57+
};
58+
}
4659
});

0 commit comments

Comments
 (0)