Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: read time should be used for transaction reads #1171

Merged
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b66827e
Allow datastore projectId to be fetched from clien
danieljbruce Sep 7, 2023
684c469
Create a file for mocking out commits
danieljbruce Sep 20, 2023
1ec6ed2
Create a test to measure latency of call.
danieljbruce Sep 21, 2023
40213ca
Run the linting fixes
danieljbruce Sep 21, 2023
57e3b13
Add license header to top of test file
danieljbruce Sep 21, 2023
af56d91
Add comment for test for now
danieljbruce Sep 21, 2023
72f9492
Add a test for the mock server
danieljbruce Sep 22, 2023
194e109
Set current retry attempt to 0
danieljbruce Sep 22, 2023
22d5f54
Add a log for call time
danieljbruce Sep 22, 2023
81f5956
Add another mock
danieljbruce Sep 25, 2023
dc9dbb7
Eliminate code from the mock file
danieljbruce Oct 13, 2023
0ad0a57
Start off by adding read time to read options
danieljbruce Oct 13, 2023
e795c3a
Update the test to use transactions
danieljbruce Oct 13, 2023
851877c
Remove only
danieljbruce Oct 13, 2023
b9bfd79
Remove the before hook
danieljbruce Oct 13, 2023
617b013
Remove unnecessary cherry picked files
danieljbruce Oct 13, 2023
4a32ad3
Clean up PR diff
danieljbruce Oct 13, 2023
8f74353
clean up PR diff
danieljbruce Oct 13, 2023
4c9445c
Update the test so that it is run as a transaction
danieljbruce Oct 18, 2023
32729e1
Add an integration test
danieljbruce Oct 18, 2023
6ef2800
Merge branch 'main' of https://github.com/googleapis/nodejs-datastore…
danieljbruce Oct 30, 2023
1354b47
Linting fixing indents
danieljbruce Oct 30, 2023
80ca7ec
Merge branch 'main' into not-use-read-time-for-run-tx
danieljbruce Apr 4, 2024
136f1b7
Update the header
danieljbruce Apr 4, 2024
280244d
Merge branch 'not-use-read-time-for-run-tx' of https://github.com/dan…
danieljbruce Apr 4, 2024
95d0d54
Fix unit test
danieljbruce Apr 4, 2024
aa4f125
System test changes.
danieljbruce Apr 4, 2024
b78b091
Modify test
danieljbruce Apr 4, 2024
cc72220
Replace with less precise assert
danieljbruce Apr 4, 2024
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
Prev Previous commit
Next Next commit
Remove the before hook
The before hook is not necessary. Just mock out the data client at the start.
  • Loading branch information
danieljbruce committed Oct 13, 2023
commit b9bfd79596ab0e723c51cf07b9ff27c3b2ffd733
23 changes: 10 additions & 13 deletions test/gapic-mocks/runQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import * as assert from 'assert';
import {before, describe} from 'mocha';
import {describe} from 'mocha';
import {DatastoreClient, Datastore} from '../../src';
import * as protos from '../../protos/protos';

Expand All @@ -26,6 +26,15 @@ describe('Run Query', () => {
namespace: NAMESPACE,
};
const datastore = new Datastore(options);
// By default, datastore.clients_ is an empty map.
// To mock out commit we need the map to contain the Gapic data client.
// Normally a call to the data client through the datastore object would initialize it.
// We don't want to make this call because it would make a grpc request.
// So we just add the data client to the map.
const gapic = Object.freeze({
v1: require('../../src/v1'),
});
datastore.clients_.set(clientName, new gapic.v1[clientName](options));

// This function is used for doing assertion checks.
// The idea is to check that the right request gets passed to the commit function in the Gapic layer.
Expand Down Expand Up @@ -58,18 +67,6 @@ describe('Run Query', () => {
}
}

before(() => {
// By default, datastore.clients_ is an empty map.
// To mock out commit we need the map to contain the Gapic data client.
// Normally a call to the data client through the datastore object would initialize it.
// We don't want to make this call because it would make a grpc request.
// So we just add the data client to the map.
const gapic = Object.freeze({
v1: require('../../src/v1'),
});
datastore.clients_.set(clientName, new gapic.v1[clientName](options));
});

it('should pass read time into runQuery for transactions', async () => {
setRunQueryComparison(
(request: protos.google.datastore.v1.IRunQueryRequest) => {
Expand Down