Closed Trenly closed 2 weeks ago
/azp run
o.O They ran locally for me. . . Time to debug!
o.O They ran locally for me. . . Time to debug!
You might need to rearrange the order so that the helper functions are first before the Assert-Git
I think the issue is actually that Git just isn't installed, so there is no way for it to actually clone the repository.
I think this leaves 2 options -
1) Have the tests install Git using Microsoft.WinGet.DSC
2) Have some test data or test files that can be copied to the directory in place of asserting that the actual process of running git clone
works
Edit: Just realized that option 2 won't work, since that also requires git
to be installed 🤦
Okay, that was harder than I thought it would be, since Pester doesn't like to play nice if you don't have the scopes set juuuuuust right, but I think I got it to work
/azp run
/azp run
Okay, now I'm truly lost. This is the error on line 22 -
##[error] [-] Discovery in D:\a\_work\1\s\tests\GitDsc\GitDsc.Tests.ps1 failed with:
##[error] System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The 'Assert-Git' command was found in the module 'GitDsc', but the module could not be loaded. For more information, run 'Import-Module GitDsc'.
But yet the module is imported on line 19 in the BeforeAll
block ???
Edit: When the module is imported, it calls Assert-Git
. That assertion fails because Git is not installed in the pipelines. The failed assertion throws, which causes Pester to not be able to bind into the container
/azp run
/azp run
Why do I even try. I uninstalled Git, and the tests passed for me. I tried it in a VM, and the tests passed for me. I have no clue what's going wrong. I'll revisit this later once I have a bit more time
I noticed that the
GitConfigFile
resource in theGitDsc
module didn't actually exist. So, I removed it and added the test for listing the available resources. I also added a basic test for theGitClone
resource. I wasn't familiar enough with the other resources in the module to add tests for them, but I figured that some tests were better than none. If this PR merges, I'll raise an issue for tracking that the additional tests should be added