Statistics
| Branch: | Tag: | Revision:

root / htest / Test / Ganeti / TestCommon.hs @ 712da82f

History | View | Annotate | Download (9.6 kB)

# Date Author Comment
712da82f 12/19/2012 03:11 pm Helga Velroyen

Remove superfluous typing to Int

Forgot to fix that after the review of patch
"Haskell/python compatibility test for networks".

Signed-off-by: Helga Velroyen <>
Reviewed-by: Iustin Pop <>

0b288282 12/18/2012 11:24 am Helga Velroyen

Haskell/python compatibility test for networks

This patch contains the HUnit test that checks the compatibility
of Haskell-generated networks with the python code. For that the
generation of test instances of networks was enhanced to meet
the validation steps of the python implementation. Also, so far...

df8578fb 12/17/2012 01:37 pm Iustin Pop

Generalise the test helper 'genUniquesList'

Instead of always using "arbitrary", make it require a generator (that
can then use more complex rules for building the list elements), and
also convert it to use a temporary set instead of list membership.

Signed-off-by: Iustin Pop <>...

4c49b965 12/06/2012 02:29 pm Guido Trotter

make genMaybe more Just

There is a common conception that Just something is more worth than
Nothing. So we're biasing our tests towards that. As such let's generate
Nothing fewer times, and Just subgen more times. The values were copied
from the "official" maybe generator....

086ad4cf 12/03/2012 12:31 pm Iustin Pop

Reduce hostname length in tests and opcode py_compat count

This improves Issue 325 - new runtime and memory consumption is about
1/10 compared to before.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

5006418e 11/30/2012 03:54 pm Iustin Pop

Make QuickCheck generator names more uniform

Due to lack of attention, we have two styles for generators of
arbitrary values: get* and gen* (e.g. getFQDN and genDiskIndices). In
order to make this more obvious that we deal with a function in the
Gen monad, let's rename all get* functions to gen*....

2a8efa13 11/21/2012 04:58 pm Iustin Pop

Add an arbitrary set generator helper

This makes it easy to generate sets of "things" that don't even need
to have arbitrary instances, but which have bounded/enum instances.

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

32f2e1e1 11/20/2012 11:26 am Iustin Pop

Simplify a few test helpers

Use more monadic combinators instead of explicit code.

Signed-off-by: Iustin Pop <>
Reviewed-by: Adeodato Simo <>

7b0476cf 11/16/2012 02:32 pm Michele Tartara

Add Utility functions for loading data from test files

They mimic their python counterparts.

Added functions:
  • getSourceDir
  • testDataFilename
  • readTestData
  • readPythonTestData

Signed-off-by: Michele Tartara <>
Reviewed-by: Iustin Pop <>

a309a3b4 11/12/2012 11:44 am Iustin Pop

Fix display of results in ==? operator

Doh, this is exactly the opposite of what we wanted… good thing no
test failed so far :)

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

41eb900e 10/22/2012 06:19 pm Iustin Pop

Improve message for (==?) operator

After seeing how nice HUnit formats the error message on failed
'assertEqual', I think we can do better with ==?. Currently it says
(on one line): "Expected equality, but 1 /= 2".

This patch changes the code to format it similar to HUnit:...

dddb2bc9 10/22/2012 02:20 pm Helga Velroyen

Annotated inequality operator for unit test properties

This includes: * The operator (/=?), which checks for inequality and prints
an error message if it encounters equality. (Basically the
negation of the (==?) operator). * Application of this operator in the test property...

93be1ced 10/17/2012 07:53 pm Iustin Pop

Generalise the Result type

Currently, our error monad—Result—has a plain string error type. This
is not good, as we don't have structured errors, we can't pass back
proper error information to Python code, etc.

To solve this, we generalise this type as 'GenericResult a', and make...

5b11f8db 09/05/2012 05:31 pm Iustin Pop

Further hlint fixes

Commit 2cdaf22, “Re-enable standard hlint warnings”, got it almost
right. The only problem is that (confusingly) the default set of hints
is not in HLint.Default, but in HLint.HLint (it includes Default and
some built-ins).

After changing the lint file to correctly include the defaults, we had...

2e0bb81d 09/05/2012 05:18 pm Iustin Pop

Add a small 'passTest' helper

This is symmetric to failTest, and allows us to use it in cases where
we need to return a property.

While replacing 'property True' with it, I saw a case where we can
simplify the use and thus reworked that check.

Signed-off-by: Iustin Pop <>...

b9bdc10e 09/05/2012 05:18 pm Iustin Pop

Add some unittests for node queries

These new tests check that:

- no known fields return unknown
- any unknown field returns unknown
- the type of the fields is consistent between the getters and the
field definition
- the length of each result row corresponds with the number of fields...

63b068c1 09/05/2012 04:58 pm Iustin Pop

Add a test helper for simple JSON serialisation testing

While adding yet another JSON serialisation test, I realised that this
can be trivially abstracted; hence this patch, replacing both simple
versions (readJSON . showJSON == id) and the standard version (with...

e1ee7d5a 09/04/2012 04:51 pm Iustin Pop

Split most HTools test code into separate files

Except for Ganeti.HTools.JSON, which needs rename, we split all the
other test suites into separate files.

We have to add another common test helper, due to import dependencies
(sigh), but otherwise this split is pretty straightforward....

aed2325f 09/04/2012 04:50 pm Iustin Pop

Split Luxi, Qlang, Ssconf and OpCodes tests

… from QC.hs into their own files, again mirroring the production code
source tree.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

305e174c 09/04/2012 04:50 pm Iustin Pop

Split Rpc tests from QC

This required lots of other code moves, so I created it as a
standalone patch.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

2733df51 09/04/2012 04:50 pm Iustin Pop

Split one more module out of QC and add test helpers

This splits the confd/utils tests, and adds the TestCommon module for
shared test code.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>