Revision c42fbe28 test/hs/Test/Ganeti/Query/Query.hs
b/test/hs/Test/Ganeti/Query/Query.hs | ||
---|---|---|
36 | 36 |
import Data.List |
37 | 37 |
import qualified Data.Map as Map |
38 | 38 |
import Data.Maybe |
39 |
import Text.JSON (JSValue(..)) |
|
39 |
import Text.JSON (JSValue(..), showJSON)
|
|
40 | 40 |
|
41 | 41 |
import Test.Ganeti.TestHelper |
42 | 42 |
import Test.Ganeti.TestCommon |
... | ... | |
235 | 235 |
(sortBy field_sort . map (\(f, _, _) -> f) $ Map.elems groupFieldsMap) |
236 | 236 |
(sortBy field_sort fdefs) |
237 | 237 |
|
238 |
-- | Check that the node count reported by a group list is sane. |
|
239 |
-- |
|
240 |
-- FIXME: also verify the node list, etc. |
|
241 |
prop_queryGroup_nodeCount :: Property |
|
242 |
prop_queryGroup_nodeCount = |
|
243 |
forAll (choose (0, maxNodes)) $ \nodes -> |
|
244 |
forAll (genEmptyCluster nodes) $ \cluster -> monadicIO $ |
|
245 |
do |
|
246 |
QueryResult _ fdata <- |
|
247 |
run (query cluster False (Query (ItemTypeOpCode QRGroup) |
|
248 |
["node_cnt"] EmptyFilter)) >>= resultProp |
|
249 |
stop $ conjoin |
|
250 |
[ printTestCase "Invalid node count" $ |
|
251 |
map (map rentryValue) fdata ==? [[Just (showJSON nodes)]] |
|
252 |
] |
|
253 |
|
|
238 | 254 |
-- ** Job queries |
239 | 255 |
|
240 | 256 |
-- | Tests that querying any existing fields, via either query or |
... | ... | |
317 | 333 |
, 'prop_queryGroup_Unknown |
318 | 334 |
, 'prop_queryGroup_types |
319 | 335 |
, 'case_queryGroup_allfields |
336 |
, 'prop_queryGroup_nodeCount |
|
320 | 337 |
, 'prop_queryJob_noUnknown |
321 | 338 |
, 'prop_queryJob_Unknown |
322 | 339 |
, 'prop_getRequestedNames |
Also available in: Unified diff