Revision 3074ccaf

b/htools/Ganeti/HTools/QC.hs
1281 1281
  Loader.lookupInstance il inst ==? Data.Map.lookup inst il
1282 1282
    where il = Data.Map.fromList kti
1283 1283

  
1284
prop_Loader_assignIndices nodes =
1285
  Data.Map.size nassoc == length nodes &&
1286
  Container.size kt == length nodes &&
1287
  (if not (null nodes)
1288
   then maximum (IntMap.keys kt) == length nodes - 1
1289
   else True)
1290
    where (nassoc, kt) =
1291
            Loader.assignIndices (map (\n -> (Node.name n, n)) nodes)
1284
prop_Loader_assignIndices =
1285
  -- generate nodes with unique names
1286
  forAll (arbitrary `suchThat`
1287
          (\nodes ->
1288
             let names = map Node.name nodes
1289
             in length names == length (nub names))) $ \nodes ->
1290
  let (nassoc, kt) =
1291
        Loader.assignIndices (map (\n -> (Node.name n, n)) nodes)
1292
  in Data.Map.size nassoc == length nodes &&
1293
     Container.size kt == length nodes &&
1294
     if not (null nodes)
1295
       then maximum (IntMap.keys kt) == length nodes - 1
1296
       else True
1292 1297

  
1293 1298
-- | Checks that the number of primary instances recorded on the nodes
1294 1299
-- is zero.

Also available in: Unified diff