-}
-module Test.Ganeti.Block.Drbd.Parser (testBlock_DRBDParser) where
+module Test.Ganeti.Block.Drbd.Parser (testBlock_Drbd_Parser) where
import Test.QuickCheck as QuickCheck hiding (Result)
import Test.HUnit
)
[ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 78728316 0 77675644 1277039 254 270 0 0 0 0
+ (PerfIndicators 78728316 0 77675644 1277039 254 270 0 0 0 0
Nothing Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 65657 135 0 0 135)
)
[ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate UpToDate) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 1 Connected (LocalRemote Secondary Primary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
+ (PerfIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
(Just 0))
Nothing
Nothing
UnconfiguredDevice 2,
DeviceInfo 3 SyncSource (LocalRemote Primary Secondary)
(LocalRemote UpToDate Inconsistent) 'A' "r-----"
- (PerformanceIndicators 373888 0 0 374088 0 22 7 27 7 0 (Just 1)
+ (PerfIndicators 373888 0 0 374088 0 22 7 27 7 0 (Just 1)
(Just 'f') (Just 15358208))
(Just $ SyncStatus 2.4 14996 15360 MegaByte (Time 0 4 8) 61736 Nothing
KiloByte Second)
Nothing,
DeviceInfo 4 WFConnection (LocalRemote Primary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
)
[ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate UpToDate) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 1 Connected (LocalRemote Secondary Primary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
+ (PerfIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
(Just 0))
Nothing
Nothing
UnconfiguredDevice 2,
DeviceInfo 3 SyncTarget (LocalRemote Primary Secondary)
(LocalRemote Inconsistent UpToDate) 'C' "r----"
- (PerformanceIndicators 0 178176 178176 0 104 42 0 0 0 0 (Just 1)
+ (PerfIndicators 0 178176 178176 0 104 42 0 0 0 0 (Just 1)
(Just 'b') (Just 346112))
- (Just $ SyncStatus 34.9 346112 524288 MegaByte (Time 0 0 5) 59392 Nothing
- KiloByte Second)
+ (Just $ SyncStatus 34.9 346112 524288 MegaByte (Time 0 0 5) 59392
+ Nothing KiloByte Second)
Nothing
Nothing,
DeviceInfo 4 WFConnection (LocalRemote Primary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
)
[ DeviceInfo 0 SyncTarget (LocalRemote Secondary Primary)
(LocalRemote Inconsistent UpToDate) 'C' "r-----"
- (PerformanceIndicators 0 460288 460160 0 0 28 2 4 1 0 (Just 1)
+ (PerfIndicators 0 460288 460160 0 0 28 2 4 1 0 (Just 1)
(Just 'f') (Just 588416))
(Just $ SyncStatus 44.4 588416 1048576 KiloByte (Time 0 0 8) 65736
(Just 61440) KiloByte Second)
)
[ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate UpToDate) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131533 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 1 Connected (LocalRemote Secondary Primary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
+ (PerfIndicators 0 140980 140980 0 0 8 0 0 0 0 (Just 1) (Just 'f')
(Just 0))
Nothing
Nothing
UnconfiguredDevice 2,
DeviceInfo 4 WFConnection (LocalRemote Primary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131534 27 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 5 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate Diskless) 'C' "r----"
- (PerformanceIndicators 140978 0 9906 131533 19 8 0 0 0 0 (Just 1)
+ (PerfIndicators 140978 0 9906 131533 19 8 0 0 0 0 (Just 1)
(Just 'b') (Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 6 Connected (LocalRemote Secondary Primary)
(LocalRemote Diskless UpToDate) 'C' "r---"
- (PerformanceIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1) (Just 'f')
+ (PerfIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1) (Just 'f')
(Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 7 WFConnection (LocalRemote Secondary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r---"
- (PerformanceIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1) (Just 'f')
+ (PerfIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1) (Just 'f')
(Just 0))
Nothing
Nothing
Nothing,
DeviceInfo 8 StandAlone (LocalRemote Secondary Unknown)
(LocalRemote UpToDate DUnknown) ' ' "r---"
- (PerformanceIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1)
+ (PerfIndicators 0 140978 140978 0 0 8 0 0 0 0 (Just 1)
(Just 'f') (Just 0))
Nothing
Nothing
)
[ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 4375577 0 4446279 674 1067 69 0 0 0 0 Nothing
+ (PerfIndicators 4375577 0 4446279 674 1067 69 0 0 0 0 Nothing
Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
(Just $ AdditionalInfo 0 257 793749 1067 0 0 1067),
DeviceInfo 1 Connected (LocalRemote Secondary Primary)
(LocalRemote UpToDate UpToDate) 'C' "r---"
- (PerformanceIndicators 738320 0 738320 554400 67 0 0 0 0 0 Nothing
+ (PerfIndicators 738320 0 738320 554400 67 0 0 0 0 0 Nothing
Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
UnconfiguredDevice 2,
DeviceInfo 4 WFConnection (LocalRemote Primary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r---"
- (PerformanceIndicators 738320 0 738320 554400 67 0 0 0 0 0 Nothing
+ (PerfIndicators 738320 0 738320 554400 67 0 0 0 0 0 Nothing
Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
(Just $ AdditionalInfo 0 257 92464 67 0 0 67),
DeviceInfo 5 Connected (LocalRemote Primary Secondary)
(LocalRemote UpToDate Diskless) 'C' "r---"
- (PerformanceIndicators 4375581 0 4446283 674 1069 69 0 0 0 0 Nothing
+ (PerfIndicators 4375581 0 4446283 674 1069 69 0 0 0 0 Nothing
Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
(Just $ AdditionalInfo 0 257 793750 1069 0 0 1069),
DeviceInfo 6 Connected (LocalRemote Secondary Primary)
(LocalRemote Diskless UpToDate) 'C' "r---"
- (PerformanceIndicators 0 4375581 5186925 327 75 214 0 0 0 0 Nothing
+ (PerfIndicators 0 4375581 5186925 327 75 214 0 0 0 0 Nothing
Nothing Nothing)
Nothing
Nothing
Nothing,
DeviceInfo 7 WFConnection (LocalRemote Secondary Unknown)
(LocalRemote UpToDate DUnknown) 'C' "r---"
- (PerformanceIndicators 0 0 0 0 0 0 0 0 0 0 Nothing Nothing Nothing)
+ (PerfIndicators 0 0 0 0 0 0 0 0 0 0 Nothing Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
(Just $ AdditionalInfo 0 257 0 0 0 0 0),
DeviceInfo 8 StandAlone (LocalRemote Secondary Unknown)
(LocalRemote UpToDate DUnknown) ' ' "r---"
- (PerformanceIndicators 0 0 0 0 0 0 0 0 0 0 Nothing Nothing Nothing)
+ (PerfIndicators 0 0 0 0 0 0 0 0 0 0 Nothing Nothing Nothing)
Nothing
(Just $ AdditionalInfo 0 61 0 0 0 0 0)
(Just $ AdditionalInfo 0 257 0 0 0 0 0)
Right obtained ->
obtained < 1000 .&&.
getFirst3Digits i ==? obtained
- where getFirst3Digits x = if x > 1000
- then getFirst3Digits $ x `div` 10
- else x
+ where getFirst3Digits x =
+ if x >= 1000
+ then getFirst3Digits $ x `div` 10
+ else x
-- | Test if non-triplets are handled correctly (they are assumed NOT being part
-- of the number).
case_commaInt_non_triplet = testCommaInt "61,736,12" 61736
-testSuite "Block_DRBDParser"
+testSuite "Block/Drbd/Parser"
[ 'case_drbd80_emptyline,
'case_drbd83_sync_krnl2_6_39,
'case_drbd83_sync,