-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
alts: Introduce AltsContext to allow outside packages accessing ALTS information #7862
Conversation
this.wrapped = wrapped; | ||
} | ||
|
||
@VisibleForTesting |
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.
Is this for testing this class or for letting other classes testing themselves?
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.
This should make classes that use the AltsContext testable. However, without parameters this isn't very useful. Therefore I've changed the method to specify the service accounts (security level is fixed anyway).
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.
While security level is fixed today, you can't actually test any code that looks at it if it is hard-coded during testing. It seems like maybe we should just suck it up and make a builder fascade as well, that delegates to HandshakerResult's builder. @jiangtaoli2016, thoughts?
I'm actually fairly okay with this as it stands, if we do want to leave it as-is. We tend to limit VisibleForTesting usage to instances where the project's own unit tests need access. For cases like this, we'd just call this "a public API". Let's remove the VisibleForTesting annotation here? I honestly don't see much harm someone could do, even using it in production.
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 am fine with it, since AltsContext is just a wrapper of AltsInternalContext. This fixed security level is only exposed for testing.
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've removed the VisibleForTesting annotation.
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.
One comment that could be small or could be more, depending on how @jiangtaoli2016 feels about it as well.
It is intended to be used from unit tests of other projects.
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.
Thanks for creating the AltsContext Wrapper.
@ejona86 is there something missing or could you merge please? |
Oh, sorry. I had been waiting for the CI to finish and then failed to come back around to it. |
No description provided.