ganeti
Safe HaskellNone

Test.Ganeti.Query.Filter

Description

Unittests for ganeti-htools.

Synopsis

Helpers

checkQueryResults :: ConfigData -> Query -> String -> [[ResultEntry]] -> Property Source #

Run a query and check that we got a specific response.

makeNodeQuery :: Filter FilterField -> Query Source #

Makes a node name query, given a filter.

expectBadQuery :: ConfigData -> Query -> String -> Property Source #

Checks if a given operation failed.

namesToResult :: [String] -> [[ResultEntry]] Source #

A helper to construct a list of results from an expected names list.

genClusterNames :: Int -> Int -> Gen (ConfigData, [String]) Source #

Generates a cluster and returns its node names too.

Test cases

prop_node_single_filter :: Property Source #

Tests single node filtering: eq should return it, and (lt and gt) should fail.

prop_node_many_filter :: Property Source #

Tests node filtering based on name equality: many OrFilter should return all results combined, many AndFilter together should return nothing. Note that we need at least 2 nodes so that the AndFilter case breaks.

prop_node_name_ordering :: Property Source #

Tests name ordering consistency: requesting a 'simple filter' results in identical name ordering as the wanted names, requesting a more complex filter results in a niceSort-ed order.

prop_node_regex_filter :: Property Source #

Tests node regex filtering. This is a very basic test :(

prop_node_bad_filter :: String -> Int -> Property Source #

Tests node regex filtering. This is a very basic test :(

prop_makeSimpleFilter :: Property Source #

Tests make simple filter.