RamblingCookieMonster / PSDepend

PowerShell Dependency Handler
MIT License
285 stars 76 forks source link

Add AWS S3 bucket support #27 #30

Closed Sarafian closed 6 years ago

Sarafian commented 7 years ago

As discussed in GH-27:

RamblingCookieMonster commented 7 years ago

Awesome, thanks for putting this together!

What version of pester are your tests targeting? Guessing my hard coding version 3.4.2 might be throwing things off. If that's the case, I can revisit failing tests on my side and use the latest pester.

Cheers!

Sarafian commented 7 years ago

I'm with 3.4.0 which is less than yours.

Sarafian commented 7 years ago

I've now updated to the latest version of Pester 4.0.2 and the AWSS3Object dependency scripts are successful. but if you update, you should expect these to fail:

 Describing Package Type PS5

    Context PackageSource does not Exist
      [+] Throws because Repository could not be found 876ms

    Context Same package version exists
      [-] Runs Get-Package and Find-Package, skips Install-Package 878ms
        Parameter set cannot be resolved using the specified named parameters.
        at line: 188 in C:\Users\Alex\Documents\Develop\GitHub\PSDepend\PSDepend\Public\Invoke-DependencyScript.ps1

    Context Test-Dependency
      [-] Returns $true when it finds an existing module 765ms
        Parameter set cannot be resolved using the specified named parameters.
        at line: 188 in C:\Users\Alex\Documents\Develop\GitHub\PSDepend\PSDepend\Public\Invoke-DependencyScript.ps1
      [-] Returns $false when it doesn't find an existing module 723ms
        Parameter set cannot be resolved using the specified named parameters.
        at line: 188 in C:\Users\Alex\Documents\Develop\GitHub\PSDepend\PSDepend\Public\Invoke-DependencyScript.ps1
      [+] Returns $false when it finds an existing module with a lower version 744ms

Overall, I'm not sure what the problem is with the broken tests as I can't reproduce on my side. The configured s3 object is https://s3-eu-west-1.amazonaws.com/cloudformation-templates-eu-west-1/Windows_Single_Server_SharePoint_Foundation.template which does not require authorization, so it should work well as a test. I've also run the tests without a profile with success.

RamblingCookieMonster commented 7 years ago

Hi! Dropped the ball on this, apologies for the delay! Will try to get the testing wrapped up today!

RamblingCookieMonster commented 7 years ago

Alrighty! I think I have the tests ironed out (gating on Pester 4.02). That whole Package test section needs to be redone, some serious ugliness due to this bit and my tendency to 'just get it working' vs. refactoring : )

Want to rebase, merge the build.ps1 conflict, and force push to your fork? That should bring things in line and let the tests start running. Or, re-fork, add your new files, and add that AWSPowerShell line to the build.ps1, if that's easier.

Cheers!

Sarafian commented 7 years ago

Hi, no problem for the delay. If I remember correctly my changes to the codebase are very limited so conflict resolution will be very easy. Therefore I suggest to proceed with what did you the best.

RamblingCookieMonster commented 7 years ago

Whew! Sorry about the half year wait : ) poked around at the tests, seem to have it working.

Can you (or anyone who sees this) run a quick test to see if it actually works? Don't have an amazon account to play with at the moment

Cheers!

Sarafian commented 7 years ago

I had completely forgotten about this. In the meantime, I've worked a lot with the AWSPowerShell module and I'm not sure anymore if the approach could be that simple. Each AWSPowerShell cmdlets has a strange (for PowerShell) set optional parameter set to drive the authorization. I would now suggest that all such parameters are somehow optional from the config file. Don't know when I can improve upon this though.

RamblingCookieMonster commented 6 years ago

I'm going to close this out for now, feel free to re-open when you're ready!