Closed midacts closed 7 years ago
All the suggested changes have went through and I have tested them. Let me know if you guys see anything else.
Thanks again for your review and suggestions.
That was a good find (I always miss stuff like that).
First, thanks to everyone for this effort! I definitely apologize for this sitting so long. It's a very visible change, so I wanted to give it a test drive myself, and I'm just getting to that now.
I haven't reviewed every change to the code yet, but I have one suggestion that I'm adding to my new review.
In the PR as is, the many Get- calls are resolved (yay!), but it suffers from a different speed problem. Within each test, a new Describe block is created for every single object, and then the "is the config value null?" check is performed. This makes null value tests take far longer, because if a single VM test's config value is null, it still has to create a new Describe block and then skip for every single VM you have.
I should note, the combination of changes in this PR (including the suggestion in my review) resulted in my benchmark test just now going from 150 seconds down to 65.
Seems pretty good 👍
I believe the ForEach ($Object in $Inventory) {
should move below the $null
check at line 108. This PR right now, lines 92-108:
$null
What matches current behavior, and what I believe to be correct:
$null
,Moving the Describe block & $cfg
value check up really speeds up tests where there is a $null
value. I see this in action when many VM hardening tests run against >100 VMs.
I added the requested changes. Let me know if you see anything else that needs to change
Kudos to @Midacts for sticking with this, and much love to @jpsider and @jonneedham for the reviews. As far as I'm concerned, Vester just doubled in speed. 🍾
:shipit:
No problem. I am glad we were all able to work together to find the best solution. Glad to be a part of the team.
I added jpsider's suggestion
Only add valid ScopeObj's
I did not add the other suggestions. I think the way where you get the object and loop through each test is how it is currently.
I'm not sure that we need these lines anymore:
and
mainly because of lines 51-53