-
Notifications
You must be signed in to change notification settings - Fork 62
chore(testproxy): fix close generated (v2) clients #1249
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
chore(testproxy): fix close generated (v2) clients #1249
Conversation
Tests for closing the client are failing since a new client object is created on every operation that uses the generated (v2) layer. This changeset fixes it by moving the v2 client creation to `testproxy/services/create-client.js` alongside the veneer client creation. Every command using the v2 layer is updated to read the client from the client map instead of creating a new instance. Three previosly failing tests are now passing with this fix: - TestCheckAndMutateRow_Generic_CloseClient - TestMutateRow_Generic_CloseClient - TestReadModifyWriteRow_Generic_CloseClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions
const closeClient = ({clientMap}) => | ||
normalizeCallback(async rawRequest => { | ||
const request = rawRequest.request; | ||
const {clientId} = request; | ||
const bigtable = clientMap.get(clientId); | ||
|
||
if (bigtable) { | ||
bigtable.close(); | ||
await bigtable[v2].close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think this line might not be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point but I just confirmed it's necessary. I tried running the tests without closing the v2 instance (removing this line) and tests fail again without it.
My understanding is that veneer and v2 are completely independent instances so it makes sense that it needs to be closed separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. If that is the case then it looks like the code contains a client bug because closing the veneer is supposed to close the clients on the v2 layer. Oh, but the client never gets initialized because we never make calls with the veneer layer and clients are initialized lazily. I suspect though that when we use the veneer layer for the mutateRow
calls when mutateRow
is exposed then we will not need this line anymore.
Thanks for checking.
Tests for closing the client are failing since a new client object is created on every operation that uses the generated (v2) layer. This changeset fixes it by moving the v2 client creation to
testproxy/services/create-client.js
alongside the veneer client creation and properly closing that v2 instance ontestproxy/services/close-client.js
.Every command using the v2 layer is updated to read the client from the client map instead of creating a new instance.
Three previosly failing tests are now passing with this fix: