-
Notifications
You must be signed in to change notification settings - Fork 4
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
add timeout connexion and add check on open connect #2
base: master
Are you sure you want to change the base?
Changes from all commits
2507b53
57c0130
4ef5bcf
0c3fa43
2351f43
965dfec
6508d27
3c9ab2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
task ImportDevModule { | ||
ImportModule -Path "$Source\$ModuleName.psd1" -Force | ||
Import-BuildModule -Path "$Source\$ModuleName.psd1" -Force | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
task Pester { | ||
$requiredPercent = $Script:CodeCoveragePercent | ||
Import-Module Pester -Force | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't support pester 5+ so I can't really help you here, the help tests rely on pester 4 functionality, pester 5 appears to be completely throwing out variables from the outer scope within Context blocks. The tests should work fine on Pester 4.10 (they are still passing for me on https://github.com/loanDepot/SnowSQL master branch. I can't test 4.10 on your branch since your changes here will not run on 4.10 due to the changes below being 5.0 functionality). I would recommend rolling the pester changes back, honestly, We've had nothing but trouble with pester 5 historically. Feel free to replace with a forced load of PSScriptAnalyzer and Pester updates are pretty involved sometimes, and we normally bulk update all our modules at once to a new version of pester once we know what we're getting ourselves into rather than piecemealing like this. If you can figure out how to make Pester 5 work here, be my guest, but it looks like the $node variables are completely gone once you enter the Context block in Pester 5, so you'd have to work around that somehow. I'm sure there's a way if you want to figure it out, but since we upgrade Pester in bulk across 50+ modules by merging a common base module repo in, we'd rather just solve it there once and leave this working as-is on Pester 4.10.1 until then, and merge that in one big batch to all our modules as we normally do. |
||
$configuration = [PesterConfiguration]::Default | ||
# assing properties & discover via intellisense | ||
$configuration.Run.Path = 'Tests' | ||
$configuration.Filter.Tag = 'Build' | ||
$configuration.Run.PassThru = $true | ||
$configuration.Output.Verbosity = 'Detailed' | ||
$configuration.TestResult.Enabled = $true | ||
$configuration.TestResult.OutputFormat = 'NUnitXml' | ||
$configuration.TestResult.OutputPath = $testFile | ||
|
||
$params = @{ | ||
OutputFile = $testFile | ||
OutputFormat = 'NUnitXml' | ||
PassThru = $true | ||
Path = 'Tests' | ||
Show = 'Failed', 'Fails', 'Summary' | ||
Tag = 'Build' | ||
} | ||
if ($requiredPercent -gt 0.00) { | ||
|
||
if($requiredPercent -gt 0.00) | ||
{ | ||
$params['CodeCoverage'] = 'Output\*\*.psm1' | ||
$params['CodeCoverageOutputFile'] = 'Output\codecoverage.xml' | ||
$configuration.CodeCoverage.Enabled = $true | ||
$configuration.CodeCoverage.OutputPath = 'Output\codecoverage.xml' | ||
} | ||
|
||
$results = Invoke-Pester @params | ||
if ($results.FailedCount -gt 0) | ||
{ | ||
Write-Error -Message "Failed [$($results.FailedCount)] Pester tests." | ||
} | ||
$results = Invoke-Pester -Configuration $configuration | ||
if ($requiredPercent -gt 0.00) { | ||
|
||
if($results.codecoverage.NumberOfCommandsAnalyzed -gt 0) | ||
{ | ||
$codeCoverage = $results.codecoverage.NumberOfCommandsExecuted / $results.codecoverage.NumberOfCommandsAnalyzed | ||
if ($results.TotalCount -gt 0) { | ||
$CodeCoveragePercent = $results.TotalCount * ($results.PassedCount / 100) | ||
$codeCoverage = [math]::Round($CodeCoveragePercent,2) | ||
|
||
if($codeCoverage -lt $requiredPercent) | ||
{ | ||
Write-Error ("Failed Code Coverage [{0:P}] below {1:P}" -f $codeCoverage,$requiredPercent) | ||
if ($codeCoverage -lt [Math]::Round($requiredPercent,2)) { | ||
Write-Error ("Failed Code Coverage [{0:P}] below {1:P}" -f $codeCoverage, $requiredPercent) | ||
} | ||
} | ||
} elseif ($results.FailedCount -gt 0) { | ||
Write-Error -Message "Failed [$($results.FailedCount)] Pester tests." | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ Get list of Snowflake roles | |
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
### EXEMPLE 1 | ||
``` | ||
Get-SnowSqlRole | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ Get list of Snowflake users | |
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
### EXEMPLE 1 | ||
``` | ||
Get-SnowSqlUser | ||
``` | ||
|
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 wouldn't normally name internal functions with
*-*
syntax, but thats personal preference. Makes it confusing as it looks like you're using a cmdlet when you're using a local function instead. You can leave this, but just pointing out why it was named as it was originally.