| Branch: | Tag: | Revision:

root / htest / Test / Ganeti / OpCodes.hs @ da1dcce1

History | View | Annotate | Download (23.8 kB)

# Date Author Comment
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....

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

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

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

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

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

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

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

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

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

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

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

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

d8e7c45e 11/12/2012 12:00 pm Iustin Pop

Convert tag objects to a safer type

Currently, we keep information about the "target" of a tag operation
in a data type similar to (TagKind, Maybe String). This is unsafe, as
nothing (at the type level) prevents us from accidentally having
(TagCluster, Just ""), or (TagInstance, Nothing)....

3bebda52 11/08/2012 12:31 pm Dato Simó

OpCodes.hs: add OpTagsSet and OpTagsDel

Also, adjust comment to $(genOpCode) block to avoid repetition of

Signed-off-by: Dato Simó <>
Reviewed-by: Iustin Pop <>

367c4241 11/08/2012 12:31 pm Dato Simó

htools: move TagObject from Luxi.hs to OpCodes.hs

In addition to ReqQueryTags in Luxi.hs, the TagObject ADT is also
required for the "kind" attribute of OpTagsSet and OpTagsDel, which
are coming to OpCodes.hs next. Hence, we move TagObject there, and
adjust imports accordingly....

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

7022db83 09/05/2012 05:18 pm Iustin Pop

Replace manual arbitrary instances with genArbitrary

There are a few more that could be replaces, once we start using
appropriate (new)types.

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

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

20bc5360 09/05/2012 03:34 pm Iustin Pop

Simplify property and test case names

Since we now have separate namespaces due to the multi-file split, we
don't need to keep the name of the module in the property names, as we
don't have so many potential conflicts anymore.

We remove the group prefix handling from TestHelper and simply do a...

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