-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(citest): Dont perform superfluous platform initializations #1529
Conversation
This CL refactors SpinnakerTestScenario so that bindings requiring platform interrogation are not performed until they are needed. This allows tests to be decoupled from platforms they are not using. This also refactors the SpinnakerTestScenario so that the platform specific code is factored out into an encapsulated support module. This should make it easier to add and maintain new platforms as well as simplify what's going on.
builder.add_argument( | ||
'--test_aws_vpc_id', | ||
default=defaults.get('TEST_AWS_VPC_ID', None), | ||
help='Default AWS VpcId to use when creating test resources.') |
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.
Why not "VPC ID" rather than "VpcId"?
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.
VpcId is the identifier in the AWS schemas. Not that it matters.
I'm missing something - where is the loading from lazy bindings defined? |
Not sure what you mean by where loading is defined.
There's only one place it is currently used, which is in the AWS support
around here
41e6aa3#diff-7d5658c9672146f06d4d0722fc4675a0R123
The mechanism is in citest, the PR defined. It adds the injected function
map into the "key" search path.
…On Sat, Apr 1, 2017 at 2:51 PM, Lars Wander ***@***.***> wrote:
I'm missing something - where is the loading from lazy bindings defined?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1529 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEKkGF04pP3ixSFCYea0y7_ERmijMJ4Sks5rrpy6gaJpZM4MwkBQ>
.
|
What I meant was I see you call |
It's in the other cited PR
google/citest#252
…On Sun, Apr 2, 2017 at 5:19 PM, Lars Wander ***@***.***> wrote:
What I meant was I see you call bindings.add_lazy_initializer, and I see
you read properties from the bindings that were added with that method, but
I didn't see where the logic for that lives.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1529 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEKkGOUkPV2vFglqnZMaKEXZ_Ead7QjNks5rsBDwgaJpZM4MwkBQ>
.
|
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.
Ah, I see, LGTM
@ewiseblatt Okay! I will test and will let you know. |
I submitted the citest change so this is all you need to patch in.
…On Mon, Apr 3, 2017 at 9:18 AM, Roshan ***@***.***> wrote:
@ewiseblatt <https://github.com/ewiseblatt> Okay! I will test and will
let you know.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1529 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEKkGMcbFwJp6RGC03wklbrItENPYBppks5rsPG7gaJpZM4MwkBQ>
.
|
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.
LGTM.
@rguthriemsft When the dependent PR goes in, you should take things you may be adding into spinnaker_test_scenario.py and instead add them to an azure_support.py so the only change to spinnaker_test_scenario is adding AzureScenarioSupport to the PLATFORM_SUPPORT_CLASSES. This PR should fix the other issues made me aware of so your workarounds should not be needed anymore.
@Roshan2017 I migrated all the OpenStack changes, but I did not test them because I still havent gotten around to reinstalling openstack. Could you test this for me?
@jtk54 or @lwander Please review.
This CL refactors SpinnakerTestScenario so that bindings requiring
platform interrogation are not performed until they are needed.
This allows tests to be decoupled from platforms they are not using.
This also refactors the SpinnakerTestScenario so that the platform
specific code is factored out into an encapsulated support module.
This should make it easier to add and maintain platforms, as
well as simplify what's going on.
Most of this PR is moving existing code from spinnaker_scenario_test.py into individual _support.py modules. The interface has a method for initializing the argparser (used before the class is constructed), initializing the bindings (used on the instance after constructed) and creating the observer for that platform. The appropriate code blocks were moved from spinnaker_testing without any major change except as follows:
The observers are not constructed until the property is referenced. So if the observer is never referenced, it will never be instantiated. Presumably if one is not needed it will not be referenced.
Binding values derived from interrogating the platform if not otherwise available are added using lazy initializers so that they will not incur the work if they are never needed. This also decouples the platform initialization from tests that do not need them.
I added a SPINNAKER__ENABLED binding to easily check if a platform is enabled or not rather than merely seeing if there is an account configured for it. This is added in the base support class.
This PR depends on google/citest#252 which is not yet approved.