Statistics
| Branch: | Tag: | Revision:

root / htest @ 5b48df93

# Date Author Comment
5b48df93 12/19/2012 04:55 pm Helga Velroyen

Serialization compatibility test for node groups

This creates a number of node groups with up to 3 networks,
serializes them and compares them with their python equvalents.

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

0f0d7aba 12/19/2012 04:55 pm Helga Velroyen

Add a network fields to NIC params and node group type

This adds a network field to the NIC params and a list of networks
to the node group type. It adjusts the nodegroup's unit tests accordingly.

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

a7e484c4 12/19/2012 03:37 pm Iustin Pop

Add support for job queries in hconfd

This adds support for job queries, including (basic) unit-tests.

I've tested this for memory and cpu usage as follows:

- 3600 jobs (live queue):
- via masterd, default: ~1.1s (masterd: ~60MB ram)
- via confd, default: ~1.1s (hconfd: ~25MB ram)...

037762a9 12/19/2012 03:37 pm Iustin Pop

Change makeSimpleFilter accept NumericValues as well

This is required for QueryJobs implementation; we change
makeSimpleFilter to support both string and integers as names.

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

aa79e62e 12/19/2012 03:37 pm Iustin Pop

Add a read-only job queue module

This patch adds implementation for a read-only job queue module,
together with "full" test (as full as can be in a lazy language…).

One note about the behaviour of the job queue is the handling of
opcodes that fail validation: the 'input' opcode actually is a...

f94a9680 12/19/2012 03:37 pm Iustin Pop

Implement support for QFF_SPLIT_TIMESTAMP

I am very very unhappy with this patch. We have to do this, in order
to be compatible with the Python code and behaviour, but there's lots
of duplication; both the Python and the Haskell code will need to be
cleaned up and simplified (we don't need QFF_* at all)....

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 <>

90634d95 12/19/2012 01:11 pm Iustin Pop

Extend job ID parsing tests

Since this is a type that behaves non-standard, let's add some more
test for "wrong" input values.

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

f56013fd 12/19/2012 01:11 pm Iustin Pop

Add a few tests for OpParams types

As OpParams definitions are used at Template Haskell type, they don't
get any coverage (although the values defined by them are actually
used in unittests). However, we can at least test some of the
functions defined in the module....

570274e4 12/19/2012 01:10 pm Iustin Pop

Add more mon-collector shell tests

These test the newly-changed behaviour, and fix an inconsistency in
the hs-check target (versus hs-coverage).

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

559c4a98 12/19/2012 01:10 pm Iustin Pop

Add description to personality definitions

This allows usage information to display nicer help (like in Python).

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

0d57ce24 12/19/2012 01:02 pm Guido Trotter

Allow shutting down offline instance

If an instance is offline we definitely shouldn't start it up.
But shutting it down, should it be up by mistake is not "that" bad.
Still, we only allow it with --force, as it still performs an action on
an instance we shouldn't touch. This should make everybody happy....

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...

fef919b7 12/17/2012 01:38 pm Iustin Pop

Split and extend Confd types tests

Some confd types were not tested for serialisation, so let's move
these (type-related) tests to their own module and extend them.

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

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

Reduce logging level in tests

This allows tests to execute IO actions which have logging as a side
effect, without polluting the stderr too much.

A better solution would be that we have fine-grained control over
loggers, so that tests can run with their own logging, etc. etc.....

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 <>...

ad1c1e41 12/17/2012 01:29 pm Iustin Pop

Implement opcode summary support

This implements in the Haskell codebase the opcode summary. As opposed
to Python, we always use custom code for formatting, since we don't
want to use dynamic attribute lookup.

To test this properly, we need to change MetaOpCode to record-syntax,...

5cd95d46 12/17/2012 01:29 pm Iustin Pop

Add a type for the log type in job/opcode logs

Also fixes indentation for OP_STATUS.

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

cce30754 12/14/2012 03:11 pm Guido Trotter

Improve a few Graph test properties

Return type is changed from Property to Bool, and the ==? True at the
end is dropped.

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

cefd4a4a 12/12/2012 02:09 pm Michele Tartara

Add shelltests for the mon-collector

This commit adds shelltests for the mon-collector binary and for the DRBD
data collector.

Also, it fixes a small bug in the DRBD parser found thanks to the tests.

Signed-off-by: Michele Tartara <>...

405656b7 12/12/2012 11:20 am Helga Velroyen

Remove usage of reserved key word 'family'

An old hlint version (1.8.28) was complaining about the
word 'family' being used in the network tests. Thanks to
an epiphany of Iustin this was due to that it is a reserved
key word.

Signed-off-by: Helga Velroyen <>...

76a0266e 12/11/2012 05:18 pm Helga Velroyen

Network and address pool (again)

Implementation of the network objects and address pool. Functionality
as in the reverted commit b9a616e132af9bba718d2da8c94eeec7af886814, but
now using only the vector library and not the bit-vector library.
Tested with vector library version 0.9 and 0.10., which are...

bccb8d20 12/07/2012 05:43 pm Dato Simó

htest/Types.hs: check ordering of some ADTs

In some ADT, ordering of constructors is important because a certain
meaning is attached to ordinality (e.g., "clusters with lesser AllocPolicy
are preferred").

To ensure constructor order is not accidentally changed, this commit...

c298ed02 12/07/2012 03:24 pm Michael Hanselmann

htools: Add missing parameter to OpInstanceMultiAlloc

Somehow this went missing in commit 1f1188c.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Michele Tartara <>

1f1188c3 12/07/2012 02:36 pm Michael Hanselmann

cmdlib: Opportunistic locking on instance creation

Adds a new parameter to “OpInstanceCreate” and “OpInstanceMultiAlloc” to
use opportunistic locks.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Guido Trotter <>

fa23de0b 12/07/2012 11:45 am Helga Velroyen

Revert "Network and address pool"

This reverts commit b9a616e132af9bba718d2da8c94eeec7af886814, which
depends on the "bitvec" library. We need to investigate a bit further that
dependency, as it in turns depends on "vector" 0.9.1 or below, since
0.10.* removed support for Data.Vector.Unboxed.Safe which it uses....

b9a616e1 12/06/2012 07:13 pm Helga Velroyen

Network and address pool

Implementation of the network and address pool class in
Haskell. Not complete yet. Includes unit tests that cover
all functionality that is so far implemented.

Signed-off-by: Helga Velroyen <>
Reviewed-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....

3516b09a 12/06/2012 11:15 am Iustin Pop

Fix build breakage in Jobs.hs test code

Commit 3bdbe4b3 (“Jobs.hs: move OpStatus and JobStatus ADTs to
Types.hs”) removed the TemplateHaskell language pragma from
htest/Test/Ganeti/Jobs.hs due to a hlint warning, but that is bad: it
means the testSuite call is no longer interpreted as a splice, so it results in:...

3bdbe4b3 12/05/2012 09:03 pm Dato Simó

Jobs.hs: move OpStatus and JobStatus ADTs to Types.hs

This leaves Ganeti/Jobs.hs and Test/Ganeti/Jobs.hs empty, but they're the
target of a future move of some functions, so we leave them around, and
don't delete them, to avoid unnecessary delete/create diffs....

8e6623c8 12/04/2012 06:46 pm Guido Trotter

Add Ganeti.HTools.Graph

This module implements some algorithms on Data.Graph data structures.
At the moment its main functionality is an LF-color implementation
(greedy coloring in descending order of degree). There are also a few
extra functions to calculate the degree order, and convert the node to...

742bd043 12/04/2012 06:46 pm Guido Trotter

Add Dsatur implementation

Implement the Dsatur algorithm for Graph coloring. This also abstracts
the neighColors function into two subfunctions that this algorithm can
reuse.

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

faef859e 12/04/2012 06:46 pm Guido Trotter

Ganeti/HTools/Graph Add isColorable

Check whether coloring on a given graph makes sense. This is the case
only if there are no loops and the graph is undirected.

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

34a21cc4 12/04/2012 06:46 pm Guido Trotter

Add tests for verticesByDegree{Asc,Desc}

This brings our coverage of Graph.hs to 100%

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

dae1f9cb 12/04/2012 06:46 pm Guido Trotter

HTools/Node: add mkNodeGraph function

This function helps treating node node problems as graph problems.
It can transform a list of nodes plus a list of instances into a graph
which uses the nodes as vertices, and instances as edges connecting them
(as long as they have both a primary and a secondary node)...

8b50de5c 12/04/2012 06:46 pm Guido Trotter

Fix Dsatur and add Dcolor

Our Dsatur implementation was incorrect: while the paper defined the
degree of saturation of a vertex as the number of different colors it is
adjacent to, we were using the number of colors, without considering
uniqueness. This effectively implemented a different algorithm, which is...

c94f9990 12/04/2012 06:46 pm Guido Trotter

Add "proper coloring" unittest check

We have to check that for each edge its vertices have different colors.

This is very easy to do with a vertex-to-color map, but not so easy with
a color-to-vertex one. Since all our coloring algorithms created a
vertex-to-color map behind the scenes and then converted it, we flip...

c67b908a 12/04/2012 01:44 pm Iustin Pop

Add a negative type

This mirrors the positive one, and will be needed for relative job
IDs.

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

b46ba79c 12/04/2012 01:44 pm Iustin Pop

Add types and parameters for common opcode implementation

This will go into a separate type; this patch adds the needed
underlying types and parameters.

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

4a826364 12/04/2012 01:44 pm Iustin Pop

Add CommonOpParams and MetaOpCode types

This patch adds the "meta" opcode type and the common op
params. Compatibility tests with Python are changed to pass Meta
opcodes.

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

3d7e87b8 12/04/2012 01:44 pm Iustin Pop

Rework/enhance original htools opcodes

The original htools opcodes were minimalistic and not 1:1 equivalent
with the Python ones. Let's add all missing fields and, since we
changed the order, switch to more readable record syntax for building
the opcodes....

67fc4de7 12/04/2012 01:44 pm Iustin Pop

Add a few missing fields from opcodes

Due to manual conversion, a few fields were missing from the
conversion, but as they were optional our type equivalence checking
didn't detect this.

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

1dbceab9 12/04/2012 01:44 pm Iustin Pop

Fix Haskell OpNetworkAdd

Commit 213076f (“Fix locking in networks”) changed Python OpNetworkAdd
without corresponding Haskell definition changes.

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

d1ac695f 12/04/2012 01:44 pm Iustin Pop

Add test for opcode fields equivalence

As opposed to the existing test, which tests the type/serialisation of
fields, this one simply tests the equivalence of the list of fields
for each opcode.

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

6903fea0 12/04/2012 01:44 pm Iustin Pop

Add type for finalised job statuses

For now, we don't need a pending job status type as well, so we'll
delay adding that until later.

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

c48711d5 12/04/2012 01:44 pm Iustin Pop

Add a 'real' type for JobIds

Currently, the job ID is a simple type alias. This is suboptimal, as
it means we can't use a custom JSON (or Arbitrary) instance for it.

The patch changes it into a newtype, and then a) simplifies some
deserialisation code and b) changes some more fields to this new type...

5f4fdf93 12/04/2012 01:44 pm Iustin Pop

Fix generation of clusters via 'genEmptyCluster'

The current uniqueness algorithm (generate random node names, suffix
them with node index) is actually wrong: a node named "21" at index 5
will end up with the same name as a node named "2" at position 15....

2188740e 12/03/2012 12:45 pm Michele Tartara

Add JSON serialization capabilities for DRBD status

The serialized JSON is not a 1:1 dump of the data structures
populated by the parser. This is done intentionally, with the
aim of producing a more stable and more meaningful output to
be used by the (future) monitoring agent and stand-alone data...

9de303af 12/03/2012 12:45 pm Michele Tartara

Add unit tests for the JSON serialization of DRBD status

The serialization itself is done by Text.JSON, so the tests deal with checking
that Text.JSON objects are created correctly from the DRBD parser data
structures.

Signed-off-by: Michele Tartara <>...

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 <>

9f80119c 12/03/2012 11:41 am Guido Trotter

Add generator for an instance on a node list

Given a node list in input, we get an instance that had nodes in it.

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

bdb7dbbb 12/03/2012 11:18 am Guido Trotter

Add generator for list of arbitrary instances

This takes an instance generator and produces a possibly empty list of
instances.

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

736ba160 12/03/2012 11:18 am Guido Trotter

Add generator for list of arbitrary nodes

This generates a minimum of one node, because legal clusters never have
zero nodes.

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

50c302ca 11/30/2012 06:33 pm Guido Trotter

Create a genInstanceMaybeBiggerThan function

This is used only once when testing Cluster.hs, but having it abstracted
clarifies there what that call is about, makes that test shorter, and
allows us to better do refactoring of the main genInstanceSmallerThan...

1cd563e2 11/30/2012 03:54 pm Iustin Pop

Add two last missing opcodes

OpInstanceQuery was missing accidentally, whereas OpRestrictedCommand
was just recently added without Haskell definitions.

The patch also slightly improves the OpNodeQuery arbitrary generation.

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

9b773665 11/30/2012 03:54 pm Iustin Pop

Enable equivalence checks of opcode list

This patch enhances the opcode list checks - instead of spawning a
Python interpreter to display the opcode list, we export it statically
in Constants.hs via a slight convert-constants change.

Furthermore, since we now have opcode parity, we enable full opcode...

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*....

3131adc7 11/30/2012 03:54 pm Iustin Pop

Abstract query common opcode definitions

It would be even better if the opcodes would actually have all the
same definitions, until then we have two sets of definitions.

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

7d421386 11/30/2012 03:54 pm Iustin Pop

Remove remaining in-line parameters

… except one, and replace them with separately-defined ones in
OpParams.

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

139c0683 11/30/2012 03:54 pm Iustin Pop

Remove read instances from our Haskell code

It turns out that optimising 'read' derived instances (via -O) for
complex data types (like OpCode, or the various objects) can be slow
to very slow. Disabling such instances results in (time make
$all_our_haskell_binaries) large compile-time savings and also smaller...

dc4b5c42 11/30/2012 03:54 pm Iustin Pop

Add explicit test for wrong OpCode arbitrary instances

I've been bitten a couple of times with arbitrary opcodes working on
UTF-8 locale, but failing on buildbot (ASCII). So let's add an
explicit test that checks always (even with UTF-8) for correct
arbitrary values, showing explicitly which opcodes fail....

c2d3219b 11/30/2012 03:54 pm Iustin Pop

Complete the instance OpCodes and parameters

Only the original instance opcodes (used in htools) are left
non-converted to only parameter style; they'll be cleaned up later,
once the htools codebase itself migrates to safer types.

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

398e9066 11/30/2012 03:54 pm Iustin Pop

Add Group, OS and Backup opcodes

This also corrects a docstring in OpBackupExport on the Python side.

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

a451dae2 11/30/2012 03:54 pm Iustin Pop

Complete the Tag opcodes and fix OpTestDelay missing param

The regexp in OpTagsSearch is loaded as is, without testing for
validity; the rest of the patch is trivial.

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

a3f02317 11/30/2012 03:54 pm Iustin Pop

Complete the Test opcodes

This adds the OpTestAllocator, OpTestJqueue and OpTestDummy
opcodes. The OpTestAllocator seems to need some cleanup (on the Python
side), for now we implement it as is. As for the other two, while not
used in production, we should have full coverage for them as well....

497beee2 11/30/2012 03:54 pm Iustin Pop

Move NICMode from Objects.hs to Types.hs

Also add some unittests for this type.

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

8d239fa4 11/30/2012 03:54 pm Iustin Pop

Add types, parameters and the opcodes for networks

This completes the last missing opcode group. The only difficulty was
with the ip addresses, where we used simple strings to represent them
and (for IPv4) a few helpers to generate arbitrary instances;
otherwise, the patch is trivial....

6d558717 11/30/2012 03:48 pm Iustin Pop

Add types and parameters for OpInstanceCreate

This is a "big" opcode, so sending it separately.

A few types needed changing, and a few parameters were renamed to make
it more clear which are cluster-level and which are instance-level
parameters.

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

c65621d7 11/30/2012 03:48 pm Iustin Pop

Move FileDriver from Objects to Types

Another base type that we need in opcodes as well.

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

fd80be11 11/27/2012 12:06 pm Michele Tartara

Small improvements to the DRBD parser and tests

  • Now the parser completely consumes the input, up to the end of the text.
  • Name of the test suite module changed to adhere to naming conventions.
  • Some reformatting of the source code.

Signed-off-by: Michele Tartara <>...

51f2650e 11/23/2012 06:47 pm Michele Tartara

Fix wrong edge case in a QuickChek Drbd property

The bug was in the test itself, not in the tested code.

Also, fixed a line longer than 80 characters in the same file.

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

18837cd8 11/23/2012 06:11 pm Michele Tartara

QuickCheck Tests for the commaIntParser, part of DRBD Parser

These new tests substitute the HTests, as by the suggestion
received after submitting the previous patch.

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

417ab39c 11/21/2012 04:58 pm Iustin Pop

A few more hlint fixes

I'm ignoring the use of Control.Arrow.*** since it's a non-obvious
function, and we're not widely using Arrows in the code base, so I
think switching to it would make the code less readable to most
people.

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

5ef4fbb1 11/21/2012 04:58 pm Iustin Pop

Fix OpCode arbitrary generation w.r.t. non-ASCII chars

Since we generate arbitrary strings and then we send them over a pipe
to Python, we can (and will) generate non-ascii chars, which means
when run in a non-UTF8 locale, this will break with ghc 6.12 and...

c66f09f5 11/21/2012 04:58 pm Iustin Pop

Bulk add of remaining cluster/node opcodes

These are tested for equivalence with the Python code using existing
tests. These tests are not perfect - for many "TDict" we simply send
empty dicts, as we don't have a way to generate proper data, but the
tests did catch many trivial errors during writing of this patch...

c7d249d0 11/21/2012 04:58 pm Iustin Pop

Convert a few existing opcode parameters to safer types

This does a partial conversion of existing opcodes to the new
non-empty string type, which is needed so that we don't add even more
opcodes without this safety net (and to have consistent "target_node",...

6a28e02c 11/21/2012 04:58 pm Iustin Pop

Add two more basic types

These are needed for completing the node opcode parameters.

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

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 <>

48755fac 11/21/2012 03:51 pm Iustin Pop

Move StorageType from RPC.hs to Types.hs

This fixes a FIXME actually recommending this move :)

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

1283cc38 11/21/2012 03:51 pm Iustin Pop

Split 'Query.Language.ItemType' in two sub-types

The QR_VIA_OP/QR_VIA_LUXI types in Python are using yet another
validation mode: QR_VIA_OP is the base type, and QR_VIA_LUXI extends
it (when doing luxi queries). But on the wire they have the same
representation....

22381768 11/21/2012 03:51 pm Iustin Pop

Move the 'Hypervisor' type from Objects to Types

This is a very basic type and 'Objects' is a heavy-weight module. By
moving it to 'types' we simplify (in the future) the import chains.

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

edc1acde 11/21/2012 03:51 pm Iustin Pop

Generalise the JSON "Container" type

Currently, we have some types that we kept as dictionaries in the
objects representation (due to inconsistent behaviour, or other
technical reasons). This should be improved in the future, but in the
meantime we can improve the Container type by allowing its keys to be...

d696bbef 11/21/2012 03:51 pm Iustin Pop

Add more basic Ganeti types

These are needed both in opcodes and (potentially) outside, so we add
them in the main Types module.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

39573352 11/20/2012 08:04 pm Iustin Pop

Fix some more hlint warnings

Sorry…

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

edb5a1c8 11/20/2012 05:39 pm Iustin Pop

Add more basic validation types

This mirrors the ht.py types PositiveInt, NonNegative, etc., except
that they work at a more generic level (any numeric type, respectively
any non-empty list).

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

469a1490 11/20/2012 05:38 pm Iustin Pop

Fix a hlint warning

This is yet-another version-specific warning (fixed in later hlint
versions), but it's better to keep it clean.

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

a52f8e72 11/20/2012 01:02 pm Michele Tartara

Add DRBD parser unit tests

This adds tests that existing test files can be parsed by the Haskell
parser as well, plus one new test file.

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

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 <>

5e9deac0 11/20/2012 11:16 am Iustin Pop

Create a new Ganeti/Types.hs module

There are already three cases where we copied type definitions between
the htools-specific types into the main ganeti code. Let's stop doing
this ☺ and create a common types module that holds these.

Note that there already exists BasicTypes.hs, but that refers to very...

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 <>

ff247692 11/16/2012 12:00 pm Michele Tartara

Improved TestHelper module docstring

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

32a569fe 11/15/2012 12:20 pm Iustin Pop

Cleanup THH function use from built module namespace

Currently, THH.hs "injects" into the built code names of library
functions like Text.JSON.makeObj, Ganeti.JSON.fromObj, etc. built
directly from strings, via (e.g.)

varE (mkName "makeObj")

This means that the "makeObj" name must exist in the target module,...

61899e64 11/14/2012 06:05 pm Iustin Pop

Switch Attoparsec/unicode test from QC to HUnit

This is not a quickcheck property, since it doesn't have any
variable/arbitrary inputs. So let's make it a test case, and shorten a
bit the name.

Also, sorry for not catching this in the review.

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

f63ffb37 11/13/2012 09:28 pm Michael Hanselmann

Expose changing job priority via LUXI

A new LUXI request is added, in both Python and Haskell.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Bernardo Dal Seno <>
Reviewed-by: Iustin Pop <>

39f0eea5 11/13/2012 03:42 pm Iustin Pop

Automatically enable version-dependent GHC flags

Some GHC flags are very useful, but only appear in more recent GHC
versions. To support the use of such flags while still supporting
older compilers, let's add conditional checks and enabling based on
the results....

43b3b5c1 11/13/2012 01:38 pm Michele Tartara

Added attoparsec unit test for Unicode parsing

Attoparsec is known to have had issues with parsing non-ASCII strings.
This test makes sure that parsing of Unicode characters works fine.

Signed-off-by: Michele Tartara <>
[iustin: small doc string fixes]...

67e4fcf4 11/13/2012 10:28 am Iustin Pop

Fix two hlint warnings

Sorry, I broke lint again :), by introducing two sub-standard changes.

Additionally, this silences an older existing warning that only
triggers with some versions of hlint (e.g. 1.8.28 which is present in
Wheezy).

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

29a30533 11/12/2012 01:21 pm Iustin Pop

Remove unsafePerformIO usage

We need to change a few things, most importantly CLI options defaults,
but otherwise we already used the path to files from functions which
were already in the I/O monad, so we don't have to change much of the
code flow.

Additionally, Path.hs now has an explicit export list, to stop...

37904802 11/12/2012 01:21 pm Iustin Pop

Change keyToFilename/readSSconfFile interaction

Currently, keyToFilename uses itself the default config path. In the
light of making that an function in the IO monad, let's remove the
"default" path functionality from this function and make it always
require the config path; its caller, readSSConfFile, can then do the...

d66aa238 11/12/2012 01:19 pm Iustin Pop

Change type of program options to 'IO [Options]'

Some options have defaults that depend on the environment, and we
could handle these in two ways:

- use a place-holder value (e.g. data X a = Default | Custom a) that
is later read from the environment
- move the options list to IO monad, where it can read the...