ganeti
Safe HaskellNone

Test.Ganeti.Objects

Description

Unittests for ganeti-htools.

Synopsis

Arbitrary instances

genInstWithNets :: [String] -> Gen Instance Source #

Generates an instance that is connected to the given networks and possibly some other networks

genInst :: Gen Instance Source #

Generates an instance that is connected to some networks

enhanceInstWithNets :: Instance -> [String] -> Gen Instance Source #

Enhances a given instance with network information, by connecting it to the given networks and possibly some other networks

genValidNetwork :: Gen Network Source #

Generates a network instance with minimum netmasks of /24. Generating bigger networks slows down the tests, because long bit strings are generated for the reservations.

genBitString :: Int -> Gen AddressPool Source #

Generate an arbitrary string consisting of '0' and '1' of the given length.

genBitStringMaxLen :: Int -> Gen AddressPool Source #

Generate an arbitrary string consisting of '0' and '1' of the maximum given length.

genEmptyCluster :: Int -> Gen ConfigData Source #

Generator for config data with an empty cluster (no instances), with N defined nodes.

genConfigDataWithNetworks :: ConfigData -> Gen ConfigData Source #

FIXME: make an even simpler base version of creating a cluster.

Generates config data with a couple of networks.

Test properties

prop_fillDict :: [(Int, Int)] -> [(Int, Int)] -> Property Source #

Tests that fillDict behaves correctly

prop_Disk_serialisation :: Disk -> Property Source #

Test that the serialisation of DiskLogicalId, which is implemented manually, is idempotent. Since we don't have a standalone JSON instance for DiskLogicalId (it's a data type that expands over two fields in a JSObject), we test this by actially testing entire Disk serialisations. So this tests two things at once, basically.

prop_Node_serialisation :: Node -> Property Source #

Check that node serialisation is idempotent.

prop_Inst_serialisation :: Instance -> Property Source #

Check that instance serialisation is idempotent.

prop_AddressPool_serialisation :: AddressPool -> Property Source #

Check that address pool serialisation is idempotent.

prop_Network_serialisation :: Network -> Property Source #

Check that network serialisation is idempotent.

prop_FilterAction_serialisation :: FilterAction -> Property Source #

Check that filter action serialisation is idempotent.

prop_FilterPredicate_serialisation :: FilterPredicate -> Property Source #

Check that filter predicate serialisation is idempotent.

prop_Config_serialisation :: Property Source #

Check config serialisation.

casePyCompatNetworks :: Assertion Source #

Custom HUnit test to check the correspondence between Haskell-generated networks and their Python decoded, validated and re-encoded version. For the technical background of this unit test, check the documentation of "case_py_compat_types" of testhsTestGanetiOpcodes.hs

getNetworkProperties :: Network -> (Int, Int, Network) Source #

Creates a tuple of the given network combined with some of its properties to be compared against the same properties generated by the python code.

casePyCompatNodegroups :: Assertion Source #

Tests the compatibility between Haskell-serialized node groups and their python-decoded and encoded version.

genNodeGroup :: Gen NodeGroup Source #

Generates a node group with up to 3 networks. | FIXME: This generates still somewhat completely random data, without normal validation rules.

prop_ip4AddressAsNum :: Ip4Address -> Property Source #

Tests conversions of ip addresses from/to numbers.

prop_ip4AddressToNumber :: Word32 -> Property Source #

Tests that the number produced by ip4AddressToNumber has the correct order of bytes.

caseNextIp4Address :: Assertion Source #

Tests a few simple cases of IPv4 next address.

casePyCompatInstances :: Assertion Source #

Tests the compatibility between Haskell-serialized instances and their python-decoded and encoded version. Note: this can be enhanced with logical validations on the decoded objects

mkLIDPlain :: String -> String -> DiskLogicalId Source #

A helper function for creating LIDPlain values.

caseIncludeLogicalIdPlain :: Assertion Source #

Tests that the logical ID is correctly found in a plain disk

caseIncludeLogicalIdDrbd :: Assertion Source #

Tests that the logical ID is correctly found in a DRBD disk

caseNotIncludeLogicalIdPlain :: Assertion Source #

Tests that the logical ID is correctly NOT found in a plain disk

Orphan instances

IsString Ip4Address #

IsString instance for Ip4Address, to help write the tests.

Instance details

Methods

fromString :: String -> Ip4Address

Arbitrary ByteString # 
Instance details

Methods

arbitrary :: Gen ByteString

shrink :: ByteString -> [ByteString]

Arbitrary DiskMode # 
Instance details

Arbitrary BlockDriver # 
Instance details

Arbitrary AdminState # 
Instance details

Arbitrary AdminStateSource # 
Instance details

Arbitrary SshKeyType # 
Instance details

Arbitrary OsParams # 
Instance details

Arbitrary PartialNicParams # 
Instance details

Arbitrary FilledNicParams # 
Instance details

Arbitrary PartialNic # 
Instance details

Arbitrary PartialBeParams # 
Instance details

Arbitrary FilledBeParams # 
Instance details

Arbitrary Instance # 
Instance details

Arbitrary ForthcomingInstanceData # 
Instance details

Arbitrary RealInstanceData # 
Instance details

Arbitrary DiskLogicalId # 
Instance details

Arbitrary LogicalVolume # 
Instance details

Arbitrary Disk #

Disk arbitrary instance. Since we don't test disk hierarchy properties, we only generate disks with no children (FIXME), as generating recursive datastructures is a bit more work.

Instance details

Methods

arbitrary :: Gen Disk

shrink :: Disk -> [Disk]

Arbitrary AddressPool # 
Instance details

Arbitrary Ip4Network # 
Instance details

Arbitrary Ip4Address # 
Instance details

Arbitrary Network # 
Instance details

Methods

arbitrary :: Gen Network

shrink :: Network -> [Network]

Arbitrary PartialISpecParams #

FIXME: This generates completely random data, without normal validation rules.

Instance details

Arbitrary FilledISpecParams # 
Instance details

Arbitrary MinMaxISpecs # 
Instance details

Arbitrary PartialIPolicy #

FIXME: This generates completely random data, without normal validation rules.

Instance details

Arbitrary FilledIPolicy # 
Instance details

Arbitrary PartialNDParams # 
Instance details

Arbitrary FilledNDParams # 
Instance details

Arbitrary GroupDiskParams #

No real arbitrary instance for GroupDiskParams yet.

Instance details

Arbitrary Node # 
Instance details

Methods

arbitrary :: Gen Node

shrink :: Node -> [Node]

Arbitrary FilterPredicate # 
Instance details

Arbitrary FilterAction # 
Instance details

Arbitrary NodeGroup # 
Instance details

Arbitrary FilterRule # 
Instance details

Arbitrary IpFamily # 
Instance details

Arbitrary IAllocatorParams # 
Instance details

Arbitrary ClusterNicParams # 
Instance details

Arbitrary ClusterOsParamsPrivate # 
Instance details

Arbitrary ClusterOsParams # 
Instance details

Arbitrary ClusterBeParams # 
Instance details

Arbitrary OsHvParams #

No real arbitrary instance for OsHvParams yet.

Instance details

Arbitrary ClusterHvParams #

No real arbitrary instance for ClusterHvParams yet.

Instance details

Arbitrary Cluster # 
Instance details

Methods

arbitrary :: Gen Cluster

shrink :: Cluster -> [Cluster]

Arbitrary ConfigData # 
Instance details

Arbitrary (Container DataCollectorConfig) # 
Instance details

Arbitrary a => Arbitrary (Private a) # 
Instance details

Methods

arbitrary :: Gen (Private a)

shrink :: Private a -> [Private a]