@ -15,56 +15,56 @@ func TestShouldNotify_MustSkipPassingDevices(t *testing.T) {
DeviceStatus : pkg . DeviceStatusPassed ,
DeviceStatus : pkg . DeviceStatusPassed ,
}
}
smartAttrs := measurements . Smart { }
smartAttrs := measurements . Smart { }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesAll
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesAll
//assert
//assert
require . False ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . False ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ NotifyLevelFail _FailingSmartDevice( t * testing . T ) {
func TestShouldNotify_ MetricsStatusThresholdBoth _FailingSmartDevice( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
DeviceStatus : pkg . DeviceStatusFailedSmart ,
DeviceStatus : pkg . DeviceStatusFailedSmart ,
}
}
smartAttrs := measurements . Smart { }
smartAttrs := measurements . Smart { }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesAll
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesAll
//assert
//assert
require . True ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . True ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ NotifyLevelFail Smart_FailingSmartDevice( t * testing . T ) {
func TestShouldNotify_ MetricsStatusThreshold Smart_FailingSmartDevice( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
DeviceStatus : pkg . DeviceStatusFailedSmart ,
DeviceStatus : pkg . DeviceStatusFailedSmart ,
}
}
smartAttrs := measurements . Smart { }
smartAttrs := measurements . Smart { }
notifyLevel := pkg . NotifyLevelFail Smart
statusThreshold := pkg . MetricsStatusThreshold Smart
notifyFilterAttributes := pkg . Notify FilterAttributesAll
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesAll
//assert
//assert
require . True ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . True ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ NotifyLevelFail Scrutiny_FailingSmartDevice( t * testing . T ) {
func TestShouldNotify_ MetricsStatusThreshold Scrutiny_FailingSmartDevice( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
DeviceStatus : pkg . DeviceStatusFailedSmart ,
DeviceStatus : pkg . DeviceStatusFailedSmart ,
}
}
smartAttrs := measurements . Smart { }
smartAttrs := measurements . Smart { }
notifyLevel := pkg . NotifyLevelFail Scrutiny
statusThreshold := pkg . MetricsStatusThreshold Scrutiny
notifyFilterAttributes := pkg . Notify FilterAttributesAll
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesAll
//assert
//assert
require . False ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . False ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ Notify FilterAttributesCritical_WithCriticalAttrs( t * testing . T ) {
func TestShouldNotify_ MetricsStatus FilterAttributesCritical_WithCriticalAttrs( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
@ -75,14 +75,14 @@ func TestShouldNotify_NotifyFilterAttributesCritical_WithCriticalAttrs(t *testin
Status : pkg . AttributeStatusFailedSmart ,
Status : pkg . AttributeStatusFailedSmart ,
} ,
} ,
} }
} }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesCritical
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesCritical
//assert
//assert
require . True ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . True ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ Notify FilterAttributesCritical_WithMultipleCriticalAttrs( t * testing . T ) {
func TestShouldNotify_ MetricsStatus FilterAttributesCritical_WithMultipleCriticalAttrs( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
@ -96,14 +96,14 @@ func TestShouldNotify_NotifyFilterAttributesCritical_WithMultipleCriticalAttrs(t
Status : pkg . AttributeStatusFailedScrutiny ,
Status : pkg . AttributeStatusFailedScrutiny ,
} ,
} ,
} }
} }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesCritical
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesCritical
//assert
//assert
require . True ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . True ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ Notify FilterAttributesCritical_WithNoCriticalAttrs( t * testing . T ) {
func TestShouldNotify_ MetricsStatus FilterAttributesCritical_WithNoCriticalAttrs( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
@ -114,14 +114,14 @@ func TestShouldNotify_NotifyFilterAttributesCritical_WithNoCriticalAttrs(t *test
Status : pkg . AttributeStatusFailedSmart ,
Status : pkg . AttributeStatusFailedSmart ,
} ,
} ,
} }
} }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesCritical
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesCritical
//assert
//assert
require . False ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . False ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ Notify FilterAttributesCritical_WithNoFailingCriticalAttrs( t * testing . T ) {
func TestShouldNotify_ MetricsStatus FilterAttributesCritical_WithNoFailingCriticalAttrs( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
@ -132,14 +132,14 @@ func TestShouldNotify_NotifyFilterAttributesCritical_WithNoFailingCriticalAttrs(
Status : pkg . AttributeStatusPassed ,
Status : pkg . AttributeStatusPassed ,
} ,
} ,
} }
} }
notifyLevel := pkg . NotifyLevelFail
statusThreshold := pkg . MetricsStatusThresholdBoth
notifyFilterAttributes := pkg . Notify FilterAttributesCritical
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesCritical
//assert
//assert
require . False ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . False ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}
func TestShouldNotify_ NotifyFilterAttributesCritical_NotifyLevelFail Smart_WithCriticalAttrsFailingScrutiny( t * testing . T ) {
func TestShouldNotify_ MetricsStatusFilterAttributesCritical_MetricsStatusThreshold Smart_WithCriticalAttrsFailingScrutiny( t * testing . T ) {
t . Parallel ( )
t . Parallel ( )
//setup
//setup
device := models . Device {
device := models . Device {
@ -153,9 +153,9 @@ func TestShouldNotify_NotifyFilterAttributesCritical_NotifyLevelFailSmart_WithCr
Status : pkg . AttributeStatusFailedScrutiny ,
Status : pkg . AttributeStatusFailedScrutiny ,
} ,
} ,
} }
} }
notifyLevel := pkg . NotifyLevelFail Smart
statusThreshold := pkg . MetricsStatusThreshold Smart
notifyFilterAttributes := pkg . Notify FilterAttributesCritical
notifyFilterAttributes := pkg . MetricsStatus FilterAttributesCritical
//assert
//assert
require . False ( t , ShouldNotify ( device , smartAttrs , notifyLevel , notifyFilterAttributes ) )
require . False ( t , ShouldNotify ( device , smartAttrs , statusThreshold , notifyFilterAttributes ) )
}
}