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

Test initialization refactor #254

Merged
merged 6 commits into from
Jul 12, 2018
Merged

Test initialization refactor #254

merged 6 commits into from
Jul 12, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 12, 2018

This PR is virtually unreviewable, but is meant to make the next PR reviewable.

The follow up PR will change the way that client initialization works. Currently, the Server SDK has a single member variable (_firestoreClient) that stores the Veneer client. All tests use _firestoreClient to to add request assertions.

In order to support more than 100 concurrent listeners, a follow up PR will change this and support an arbitrary number of clients. The tests will then no longer be able to rely on _firestoreClient and won't be able to override request handlers directly. Instead, they will override the logic that creates these clients: https://github.com/googleapis/nodejs-firestore/pull/242/files#diff-51dde1525cb3ea0c2eea78ebf10ea7e2R84

While the second PR will add actual changes to the client, this PR just changes all of the tests to use a new helper method to init the client (look in test/util/helpers.ts). This required initialization and formatting changes all over the test code. These changes all follow the same pattern, and probably don't need to be reviewed in detail each time.

There is one logic change in the client to make the test work: With the new initialization, some of the conformance tests no longer pass since they can't tell that two paths are equal if one already has _formattedName initialized. I got rid of the lazy-loading here.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 12, 2018
@codecov
Copy link

codecov bot commented Jul 12, 2018

Codecov Report

Merging #254 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #254   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        2104   2104           
  Branches      457    457           
=====================================
  Hits         2104   2104

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3d91e1...16d8c5f. Read the comment docs.

@schmidt-sebastian schmidt-sebastian force-pushed the initrefactor branch 2 times, most recently from 87c07c6 to 8bde202 Compare July 12, 2018 01:25
Copy link
Contributor

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some significant caveats:

  • I don't have enough context to really judge the high-level logic. I mainly checked that the code does implement that logic.
  • the PR is huge and I might have easily missed something among the similar changes.

{timestampsInSnapshots: true}, DOCUMENT_WITH_TIMESTAMP)
{
timestampsInSnapshots: true,
keyFilename: './test/fake-certificate.json',

This comment was marked as spam.

This comment was marked as spam.

assert.equal(request.type, 'query');
assert.deepEqual(actual, request.request);
return request.stream;
function runTransaction(callback, ...requests) {

This comment was marked as spam.

This comment was marked as spam.

};

return createInstance(overrides).then(firestore => {
firestore._preferTransactions = true;

This comment was marked as spam.

This comment was marked as spam.

projectId: PROJECT_ID,
sslCreds: SSL_CREDENTIALS,
timestampsInSnapshots: true,
keyFilename: './test/fake-certificate.json',

This comment was marked as spam.

This comment was marked as spam.

@schmidt-sebastian schmidt-sebastian changed the base branch from addtsdeps to master July 12, 2018 21:50
@schmidt-sebastian
Copy link
Contributor Author

Changed base branch to master and added @stephenplusplus for owners approval.

@schmidt-sebastian schmidt-sebastian merged commit 9552c32 into master Jul 12, 2018
@schmidt-sebastian schmidt-sebastian deleted the initrefactor branch July 24, 2018 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants