Skip to content
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

Results meet expected values, but test listed as failure in 0.0.79 #165

Closed
decopaper opened this issue Jul 7, 2022 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@decopaper
Copy link

After upgrading to 0.0.79 (from 0.0.78), several tests are now failing, even though the Found value meets the testing criteria.

For example:

Expected value (Less Or Equal): 4000, Found value: 469.07
Expected value (Less Than): 7/7/2022 4:01:19 AM, Found value: 1/3/2022 6:02:33 AM
Expected value (Less Or Equal): 0, Found value: -184

This change...

if ($TestedValue.GetType().BaseType.Name -eq 'ValueType') {
$TestedValue = $TestedValue.ToString()
}

...causes the following tests (which use ExpectedValue instead of ExpectedCount) to fail in certain cases because they're being compared as strings instead of their native types:

X509NotBefore = @{
Enable = $true
Name = 'Not Before Date should be within required range'
Parameters = @{
Property = 'X509NotBefore'
ExpectedValue = Get-Date
OperationType = 'lt'
}
Details = [ordered] @{
Category = 'Health'
Importance = 0
ActionType = 0
}
}

X509NotBeforeDays = @{
Enable = $true
Name = 'Not Before Days should be less/equal 0'
Parameters = @{
Property = 'X509NotBeforeDays'
ExpectedValue = 0
OperationType = 'le'
}
Details = [ordered] @{
Category = 'Health'
Importance = 10
ActionType = 2
}
}

SecurityCurrentLogSize = @{
Enable = $true
Name = 'Security Log Current Size smaller then 4GB'
Parameters = @{
WhereObject = { $_.LogName -eq 'Security' }
Property = 'FileSizeCurrentMB'
ExpectedValue = 4000
OperationType = 'le'
}
}

All of them have basetypes of ValueType:

> (Get-Date).GetType().BaseType.Name
ValueType
> $asdf = -184; $asdf.GetType().BaseType.Name
ValueType
> $asdf = 469.07; $asdf.GetType().BaseType.Name
ValueType

There may be more tests with this issue, they're just not failing in my environment.

@PrzemyslawKlys PrzemyslawKlys added the bug Something isn't working label Jul 7, 2022
@PrzemyslawKlys
Copy link
Member

My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants