microsoft / PSRule

Validate infrastructure as code (IaC) and objects using PowerShell rules.
https://microsoft.github.io/PSRule/v2/
MIT License
376 stars 49 forks source link

[Feature request] RuleRecord: Change the unit of Time to millisecond. #192

Closed LaurentDardenne closed 5 years ago

LaurentDardenne commented 5 years ago

Is your feature request related to a problem? Please describe. The unit of the Time property of the RuleRecord class should be in millisecond, because in seconds we can not know the total execution time.

$Path='C:\temp'
$File='Test.Rule.ps1'
@'
Rule Main  {
    sleep -Milliseconds 350
    $True
} 

Rule Main2  {
    sleep -Milliseconds 350
    $True
} 

Rule Main3  {
    sleep -Milliseconds 300
    $True
} 

'@ >"$Path\$File"

$r='object'|Invoke-psrule -path "$path\$File"
$r|select RuleID,Time

# RuleId              Time
# ------              ----
# Test.Rule.ps1/Main     0
# Test.Rule.ps1/Main2    0
# Test.Rule.ps1/Main3    0

$r|Measure-Object -Property Time -sum
# Count    : 3
# Average  :
# Sum      : 0
# Maximum  :
# Minimum  :
# Property : Time

The total time should be one second at least, and not the value zero.

BernieWhite commented 5 years ago

@LaurentDardenne Agree. Thanks for the effect to log all the feedback.