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
feat: add support for spanner client resource base routing #780
Closed
laljikanjareeya
wants to merge
34
commits into
googleapis:master
from
laljikanjareeya:resource-based-routing
Closed
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3b5c4de
feat: added method to get endPointUris and related changes
241fe62
fix: unit test cases was failing
d4d50b7
pass instanceId externally in each SpannerClient Request
87fd04a
feat: added flag to check weather resource based routing is enable or…
1ba9e16
move getInstanceEndPointUris to instance.ts file
2ac95bf
test: added unit test cases
f504666
fix: removed end point uris mapping chaching
cc5e72f
test:added more unit test cases
dfb8100
provided an option to enable resource based routing to user
9d4f4af
pass the instance id insted of formmatedName_ in each method
67f74af
fix: unit test cases
15f261d
fix: unit test cases
fe0e1a5
test:added system test
d46a13c
test:added unit test for instance permission
c4c12d2
fix:review changes
aae7311
refactor: simplify and clean up
0b7e83e
fix: reverse the resource based routing condition
59cdb4f
test: added unit test for multiple endpointUri
06fba33
Merge branch 'master' into resource-based-routing
600d5f1
fix:correct spell
2c99834
Merge branch 'master' into resource-based-routing
846cb78
refactor: replace getInstanceEndpointUris with getMetadata
1e83f37
Merge branch 'master' into resource-based-routing
57687ba
Merge branch 'master' into resource-based-routing
AVaksman eefc95d
Merge branch 'master' into resource-based-routing
4c2f6aa
fix:review changes
48085fb
fix: unit-test case fail issue
eb358f3
refactor: added enum to check the permission status
06dc72d
Merge branch 'master' into resource-based-routing
e5b02c5
merge:merge from master
710bc9a
fix: review changes
66eac38
Merge branch 'master' into resource-based-routing
a464043
test: added unit test and system-test cases
f3b976c
Merge branch 'master' into resource-based-routing
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4420,12 +4420,50 @@ describe('Spanner', () => { | |
spanner.options.enableResourceBasedRouting = false; | ||
}); | ||
|
||
it('should list the session while resource based routing is enabled', done => { | ||
database.getSessions((err, session) => { | ||
assert.ifError(err); | ||
assert.equal(session!.length, 0); | ||
done(); | ||
}); | ||
it('should use resolved endpoint while resource based routing is enabled', done => { | ||
instance.getMetadata( | ||
{fieldNames: ['endpointUris']}, | ||
(err, instanceMetadata) => { | ||
assert.ifError(err); | ||
// tslint:disable-next-line: no-any | ||
const resolvedEndpoint: string[] = (instanceMetadata as any) | ||
.endpointUris; | ||
if (resolvedEndpoint.length === 0) { | ||
done(); //no resolved endpoint. | ||
} | ||
database.getSessions((err, session) => { | ||
assert.ifError(err); | ||
assert.strictEqual( | ||
spanner.clients_.has(`SpannerClient-${instance.id}`), | ||
true | ||
); | ||
done(); | ||
}); | ||
} | ||
); | ||
}); | ||
|
||
it('should use user-specified endpoint when resource based routing is enabled.', done => { | ||
instance.getMetadata( | ||
{fieldNames: ['endpointUris']}, | ||
(err, instanceMetadata) => { | ||
assert.ifError(err); | ||
// tslint:disable-next-line: no-any | ||
const resolvedEndpoint: string[] = (instanceMetadata as any) | ||
.endpointUris; | ||
if (resolvedEndpoint.length === 0) { | ||
done(); //no resolved endpoint. | ||
} | ||
//user specific apiEndpoint | ||
spanner.options.apiEndpoint = resolvedEndpoint[0]; | ||
spanner.options.enableResourceBasedRouting = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at line 4417, resource routing is already enabled so don't think you need this. |
||
database.getSessions((err, session) => { | ||
assert.ifError(err); | ||
assert.strictEqual(spanner.clients_.has('SpannerClient'), true); | ||
done(); | ||
}); | ||
} | ||
); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this using the resolved endpoint instead of a user-specified endpoint?