René Nussbaumer [Wed, 12 Sep 2012 11:43:28 +0000 (13:43 +0200)]
Rework the required_nodes field
This was used to verify the result of instance allocation. However, this
is not logic which belongs to the cmdlib rather than to the iallocator
request itself. So abstract it by its own function. And update the
ValidateResult accordingly.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Wed, 12 Sep 2012 12:42:40 +0000 (14:42 +0200)]
objects, rpc: Code cleanup
objects.Disk.ComputeLDParams: Simplify structure, don't use and
overwrite local variables.
rpc.AnnotateDiskParams: Replace explicit loop.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Wed, 12 Sep 2012 09:53:09 +0000 (11:53 +0200)]
RAPI client: Fix typo in docstring
Also update the copyright header.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
René Nussbaumer [Tue, 11 Sep 2012 08:37:59 +0000 (10:37 +0200)]
Disable pylint warnings for unknown members
For some reason pylint can't determine, that the members are calculated
upon runtime and complains. This is weird as the same mechanism works on
opcode/objects. I haven't found the issue for it yet, so let's just
ignore the warnings for now.
This is a separate patch for easier revert later on, once it's fixed.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Thu, 6 Sep 2012 14:18:05 +0000 (16:18 +0200)]
Adapt gnt-debug iallocator
Add the new multi-alloc request to the test allocation framework. For
now we just create --count identical instances. This might need further
improvements later.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Thu, 6 Sep 2012 14:17:21 +0000 (16:17 +0200)]
Adding new multi-allocation request
Now that we've the refactoring done, we can easily add the new mode and
everything works.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Thu, 6 Sep 2012 11:45:04 +0000 (13:45 +0200)]
Switch all iallocator calls to the new one
After the refactor, the old calls are not working anymore, so we switch
to the new ones.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Thu, 6 Sep 2012 11:23:49 +0000 (13:23 +0200)]
Refactor IAllocator code
The IAllocator class was handling all the requests on its own, passing
in parameters on top level which works, but is hard to maintain and not
flexible.
With the upcoming change to the IAllocator for MultiAllocate we can't
use the toplevel parameters anymore. Therefore, we refactor the code
into separate classes, which just do their own stuff. It works similiar
to Opcode containers.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Fri, 7 Sep 2012 12:53:03 +0000 (14:53 +0200)]
Make the __slots__ functionality more modular
As we will introduce another set of containers using the __slots__ trick
we abstract away as much as possible to separate bases classes. The
child classes then adapt them for their needs. This leads to less code
duplication.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Fri, 7 Sep 2012 11:52:26 +0000 (13:52 +0200)]
Move _MakeLegacyNodeInfo to rpc
This function will also be needed for the iallocator refactor. Also this
function does not belong to cmdlib but rather to rpc. Lets move it
there.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
René Nussbaumer [Fri, 7 Sep 2012 11:26:32 +0000 (13:26 +0200)]
Move _CalculateGroupIPolicy and _ComputeDiskSize
This makes it possible to better untangle the IAllocator code, which
would otherwise lead to a recursive import structure as we need those
helpers there as well.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Mon, 10 Sep 2012 12:51:59 +0000 (14:51 +0200)]
Update documentation for "gnt-job list"
Commit
f037e9d7 added command line flags to filter jobs, but the
documentation was not updated. Also mention the ability to use
more complex filters.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 6 Sep 2012 21:57:17 +0000 (06:57 +0900)]
Simplify a bit more the test harness
We can build the test groups directly in the `testSuite' helper,
instead of doing it (much later) in the test harness.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 21:47:28 +0000 (06:47 +0900)]
Remove the slow/fast tests functionality
Since the recent commits improved the speed of the two "slow" test
groups to regular test speed, we can remove this kludge and simplify
significantly our test runner, yay!
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 20:57:41 +0000 (05:57 +0900)]
Fix arbitrary ConfigData object generation
The Cluster object, as it is defined right now, has many '[String]'
members, which means that in a standard arbitrary generator these will
become very big, which is the reason for the current slowness of the
test 'Config_serialisation'.
By resizing the generator to 8 (arbitrary chosen to limit the list
length and the string sizes), and by reducing a bit the node count, we
can make this test be as fast as the others (about 10x
improvement). This means we can test more cases, for the same cost.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 18:17:12 +0000 (03:17 +0900)]
Improve the `AllocPolicy' test
This test has a few deficiencies, which this patch addresses:
- using arbitrary 1 or 2 node count for allocation is obsolete,
nowadays we need to use a number appropriate for the instance's disk
template (and we should remove that parameter…)
- generating a random node is sub-optimal, since we could generate an
offline node, and no instance will fit on a cluster composed of only
offline nodes
- generating arbitrary instances "such that" they can be allocated is
an expensive test; let's rather generate instances smaller than our
template node, and add a check that they indeed can be allocated
- using boolean return type, instead of nicely annotated properties
For the nice annotation and the extra check, we need to change a
helper function's signature, so that we can extract a bit more
information out of it.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 17:19:46 +0000 (02:19 +0900)]
Improve the `CanTieredAlloc' test
Currently, this test is very slow. Upon investigation, this is due to
how `tieredAlloc' works:
- tries to allocate one instance
- if failed, shrink the instance by the "most failed" resource
- restart
In this algorithm, if the "most failed" resource is e.g. memory, and
the maximum available memory is much smaller than the current
template, it means we will have to shrink and try to allocate many
many times until we finally get with the to-be-allocated instance
memory size to a reasonable value. In the real world, this is not the
case, but when testing with arbitrary memory/node values, it can be
that we execute the shrink hundreds of thousands of times per test.
So we "improve" the test by directly generating an instance just
slightly bigger than the node, so that we don't have to shrink too
many times. This requires a new export from test/…/Instance.hs.
Additionally, we allow up to 5 instances to be tiered-allocated, and
we cleanup the test checks, making the conditions much, much more
readable (IMHO).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 16:01:21 +0000 (01:01 +0900)]
Add new test for checking multi-allocations
This test expands the "single-alloc-no-rebalance" by allocating a few
instances on a small cluster, and ensuring that after we allocate all
of them, either we can't rebalance or if we rebalance the score
improvement is very small.
The last condition is needed because sometime rounding errors (we're
using double-precision floating point) can accumulate and result in
what is a no real change in the cluster state, but with an
infinitesimal score decrease (e.g. 1e-14).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Thu, 6 Sep 2012 15:59:50 +0000 (00:59 +0900)]
Improve the prop_Alloc_sane test to detect mis-allocations
Currently, this just checks that a cluster cannot be rebalanced after
a single instance allocation. However, we can also test whether the
allocation decision computed a correct new cluster score, by checking
that against the one computed from the actual new node list.
Also, for nicer display, we convert the test from a Boolean to a
Property, with nice annotations.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Fri, 7 Sep 2012 21:19:30 +0000 (06:19 +0900)]
Merge branch 'devel-2.6' into submit
* devel-2.6:
Fix bug in non-mirrored instance allocation
Fix gnt-debug iallocator
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 7 Sep 2012 21:13:15 +0000 (06:13 +0900)]
Merge branch 'stable-2.6' into devel-2.6
* stable-2.6:
Fix bug in non-mirrored instance allocation
Fix gnt-debug iallocator
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Thu, 6 Sep 2012 16:08:43 +0000 (01:08 +0900)]
Fix bug in non-mirrored instance allocation
The function `allocateOnSingle' has a bug in the calculation of the
cluster score used for deciding which of the many target nodes to use
in placing the instance: it uses the original node list for the score
calculation.
Due to this, since the original node list is the same for all target
nodes, it means that basically `allocateOnSingle' returns the same
score, no matter the target node, and hence the choosing of the node
is arbitrary, instead of being done on the basis of the algorithm.
This has gone uncaught until reported because the unittests only test
1 allocation at a time on an empty cluster, and do not check the
consistency of the score. I'll send separate patches on the master
branch for adding more checks to prevent this in the future.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Tue, 4 Sep 2012 19:55:11 +0000 (21:55 +0200)]
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
another 128 suggestions:
- Error: Eta reduce (2)
- Error: Redundant bracket (4)
- Error: Redundant do (17)
- Error: Redundant lambda (7)
- Error: Redundant return (1)
- Warning: Avoid lambda (2)
- Warning: Redundant $ (42)
- Warning: Redundant bracket (35)
- Warning: Use : (1)
- Warning: Use String (4)
- Warning: Use camelCase (10)
- Warning: Use section (3)
which are fixed by the current patch. Note that the 10 "Use camelCase"
were all due to hlint not “knowing” the idiom of ‘case_’ (it does for
‘prop_’), for which I filled
http://code.google.com/p/ndmitchell/issues/detail?id=558.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Sun, 2 Sep 2012 16:03:52 +0000 (18:03 +0200)]
Rework CLI modules and tests
While investigating how we could test the Daemon.hs module, I realised
that we have a very, erm, sub-optimal situation:
- HTools/CLI.hs has a nice IO/pure separation testing in cmdline
parsing, which allows some basic functionality to be tested, but
uses direct 'read' in many options, which fails at runtime when
evaluating the argument, and not when parsing the options
- Daemon.hs lacks that, but has a much nicer 'reqWithConversion'
helper that can be used for nicer option parsing, and uses that +
tryRead instead of plain 'read'
Since this situation is very bad, let's clean it up. We introduce yet
another module, Common.hs, that holds functionality common to all
command line programs (daemons or not). We move the parsing to this
module, and introduce a type class to handle option types which
support --help/--version. This allows removal of duplicated code from
CLI.hs and Daemon.hs.
The other part of the patch is cleanup/rework of the tests for this
code: we introduce some helpers (checkOpt, passFailOpt,
checkEarlyExit) that can be used from the much-slimmer now tests for
CLI and Daemon. In the common module, we just test the yes/no helper
we have. Many new tests for boolean options and numeric options are
added.
A side change is the removal of the obsolete `--replay-count',
`--test-size' options (unused since commit
95f6c931, “Switch Haskell
test harness to test-framework”).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Sat, 1 Sep 2012 22:21:32 +0000 (00:21 +0200)]
Fix deserialisation bug in ResultEntry
Found via the newly added unit-tests, which test most of the
serialisation code in Query/Language (except for QueryResult, for
which we already tests both sub-components separately).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 12:54:38 +0000 (14:54 +0200)]
Add query filter tests
These tests are node specific only because we don't have other query
types implemented yet, but what they actually test is the various
filter types.
The tests are trying to cover most filter functionality; missing for
now is proper checking for ContainsFilter and TrueFilter, the rest
should be more or less covered.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 12:32:11 +0000 (14:32 +0200)]
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
queried, and the length of the field definitions returned
- the length of the rows corresponds to the number of nodes
- querying fields on empty fields returns all fields
Finally this patch found a bug, in that the pinst_list/sinst_list
fields were declared as QFTNumber (copy-paste error from
pinst_cnt/sinst_cnt), yay!
I also changed genEmptyCluster to ensure that it generates unique node
names, so that the number of result rows is consistent with what we
requested, and switched ResultEntry from a normal constructor to
record syntax, so that we can extract the fields without having to use
pattern matching.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 12:10:48 +0000 (14:10 +0200)]
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 <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 10:54:07 +0000 (12:54 +0200)]
Add entire ConfigData serialisation tests
Using the recently-added genArbitrary, we can now implement Arbitrary
instances for even "huge" objects like Cluster, so let's use that to
implement entire ConfigData serialisation tests.
Note that, as we don't have yet proper types for some of the Params
fields, we have to cheat via FlexibleInstances and
TypeSynonymInstances, using either empty items or real arbitrary
values.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 10:42:04 +0000 (12:42 +0200)]
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 <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Fri, 31 Aug 2012 09:59:15 +0000 (11:59 +0200)]
Introduce a helper for simple Arbitrary instances
After getting really annoyed at yet another "<*> arbitrary", I thought
that we should be able to automate this, at least for types which are
simple enough and have already all the "prerequisites".
Hence the new genArbitrary function and its helpers, which can:
- build an arbitrary for Bounded types, using the regular "elements
[minBound..maxBound]" (20 manually defined cases right now)
- build an arbitrary instance for single-constructor data types,
e.g. "data A = A x y z", using a simple "arbitrary = pure A <*>
arbitrary <*> arbitrary <*> arbitrary"
- build an arbitrary instance for multi-constructor data types, using
"arbitrary = oneof [<arbitrary for each individual construct, per
the previous>]"
Both normal and record-based constructors are supported.
It can also build arbitrary instances for new types and type synonyms,
although for these last two I'm not so confident on the soundness of
the instances.
Note that this helper won't work for types which are not well behaved;
for example, Node has the name as String not as FQDN, so our manually
written arbitrary instance has just a few overrides as getFQDN instead
of arbitrary, so we can't automate this particular type yet; this only
means we get another push to use proper types, instead of primitive
ones, for fields which have any kinds of restrictions ("what's good
for arbitrary is good for regular code" too).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Thu, 30 Aug 2012 18:01:03 +0000 (20:01 +0200)]
Add Instance serialisations tests
This is not perfect, as for many of the parameters we don't have good
Arbitrary instances, but is better than nothing.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Thu, 30 Aug 2012 17:40:41 +0000 (19:40 +0200)]
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
different error messages) across the tests with a single function
call.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Thu, 30 Aug 2012 17:27:42 +0000 (19:27 +0200)]
Add unit test for serialisation of DiskLogicalId and Nodes
Since the DiskLogicalId type is manually serialised/deserialised (see
Objects.hs, `encodeDLid' and `decodeDLId'), let's add a test that
checks that these are idempotent when combined.
Since we're at it, let's add the same test for Node serialisation,
which already has an Arbitrary instance.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Thu, 30 Aug 2012 14:58:34 +0000 (16:58 +0200)]
Add unittests for the BasicTypes module
This adds test properties for the various laws that the instances of
Result should follow; I could not find (offline) laws about `mappend',
but otherwise I implemented all laws that I could find.
Note that we have to silence hlint warnings for the things we want to
test, as otherwise hlint is all "this is already true based on the
functor law, why 'fmap id' and not just 'id'?".
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 23:57:57 +0000 (01:57 +0200)]
Fixup test suite names
The names were not in a proper hierarchy, leading to inconsistencies
about what they were actually tested.
We change this by reproducing in the test names the relative hierarchy
within the Ganeti directory, leading to nicer test suite names (in
test-framework output).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 23:48:41 +0000 (01:48 +0200)]
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
sed over all the test files, removing it from the function names.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 23:25:45 +0000 (01:25 +0200)]
Move Version.hs up from under HTools/
This is another module that is generic, and not htools-specific.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Tue, 4 Sep 2012 21:11:43 +0000 (23:11 +0200)]
Two tiny makefile fixes
During the recent moves and renames, two things have slipped through,
since I didn't run make check-local…
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 23:20:56 +0000 (01:20 +0200)]
Remove QC.hs and replace it with an auto-generated file
In order to have correct code coverage results, we must somehow import
all production modules into the test runner. Until now, this was done
manually (when we didn't forget) in QC.hs.
To improve the situation, we remove QC.hs and replace it with an
auto-generated file which imports all modules. This reduces the
maintenance burden and ensures we'll always have correct coverage.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 29 Aug 2012 23:07:42 +0000 (01:07 +0200)]
Split the Makefile variable HS_LIB_SRCS
This currently holds both production files and test files; since we
want to treat these separately, let's split the variable in two, and
introduce another one for the old, inclusive one.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 29 Aug 2012 22:58:10 +0000 (00:58 +0200)]
Split last two remaining tests from QC.hs
This makes QC.hs obsolete, but we will remove it in a later patch,
once we automatically build a file with all the imports (to ensure
correct coverage results).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 22:45:15 +0000 (00:45 +0200)]
Move JSON.hs and Compat.hs out from under HTools/
These two files are not htools-specific, so let's move them out of the
HTools subdirectory/module hierarchy and directly under Ganeti.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 22:06:46 +0000 (00:06 +0200)]
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.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 20:34:09 +0000 (22:34 +0200)]
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 <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 16:01:37 +0000 (18:01 +0200)]
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 <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 15:49:14 +0000 (17:49 +0200)]
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 <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 15:24:00 +0000 (17:24 +0200)]
Split out Objects.hs from QC.hs
This is the first file split out from QC.hs - an easy one, since it
has just one test.
The patch changes the way we build hpc excludes, since now we'll have
many modules that need to be excluded, and hpc doesn't seem to be able
to do wildcards (it can do packages, but all our code is
not-package-based).
Further splitting will be done in bigger batches.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 14:30:34 +0000 (16:30 +0200)]
Move the unittest helper to a new Test/Ganeti dir
This patch starts the move of the test haskell code from
`htools/Ganeti/HTools/' to its more proper place of
`htest/Test/Ganeti'.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 14:10:41 +0000 (16:10 +0200)]
Move generated htools test stubs to htest/
This moves the last (I think) htools-related bits out of test/ under
htest/.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 14:05:53 +0000 (16:05 +0200)]
Move shelltests from test/ to htest/shelltests/
This is another rather trivial patch, moving all the (htools)
shelltests to their own directory.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 29 Aug 2012 13:59:11 +0000 (15:59 +0200)]
Move htools test files from test/data/htools to htest/data
Following up on the program moves, we now move the test data files.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 29 Aug 2012 11:53:48 +0000 (13:53 +0200)]
Move haskell test code to htest/
This is the first commit of a series that will attempt to cleanup the
test code organisation, which evolved somewhat organically from the
initial pure htools functionality.
The proposed organisation of the tree will be as follows:
- htools (or maybe renamed to haskell or hs): only production code
- htest: top-level test directory, containing test.hs, static helper
scripts, etc.
- htest/Ganeti/*.hs: modules implementing the actual test properties
and test cases for the correspondingly-named production code modules
- htest/data: containing test data files for the test cases
This particular patch moves all the test code (test.hs, hpc-htools.hs
symlink) and helper scripts (offline-test.sh, etc.) from htools/ to
htest/, while updating the files themselves (if they had paths
mentioning htools/), .gitignore and the Makefile.
The only special mention is that in Makefile, we used to have a BINARY
shell variable in binary build rule; that was computed via stripping
`htools/' prefix; I've cleaned that and replaced with $(notdir $@);
even though it's duplicated a few times, it leads to more readable
make output (and easier to copy-paste).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
René Nussbaumer [Tue, 28 Aug 2012 11:14:58 +0000 (13:14 +0200)]
Fix gnt-debug iallocator
There was an issue with the recent ipolicy introduction which lead to a
bug in gnt-debug iallocator. It was not providing the spindle_use field
and therefore it wont let you create a valid iallocator request.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Mon, 27 Aug 2012 15:56:41 +0000 (17:56 +0200)]
Implement compilation of regexes at creation time
This means that the verification of the correctness of the regex is
done once, at the deserialisation/creation time, as in the Python
code. To do this, we have to change the FilterRegex type from an alias
to String to a more complex data type, and we have to create manual
read/show/eq instance (phew!).
Unittests are added which test these instances, since it's the first time I do
this manually.
An additional improvement is that we now check that regex-pcre has
been compiled correctly, per the documentation (otherwise we get
runtime errors).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Sun, 26 Aug 2012 18:43:06 +0000 (20:43 +0200)]
Rename the Qlang and Queryd modules
Per the new query module hierarchy, rename Qlang to Query/Language and
Queryd to Query/Server. This way, all query-related functionality is
now "contained" in the Query/ directory.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 26 Aug 2012 18:22:44 +0000 (20:22 +0200)]
Add filtering support in Query
This adds basic infrastructure for filtering (fully functional except,
as usual, for runtime data), and then uses it for node queries.
Since the filtering exports regex matching as an external
functionality, we have to use a regex library. There are many flavours
of these in Haskell (see
http://www.haskell.org/haskellwiki/Regular_expressions), but since we
want to be as compatible as we can with Python's, we use the
regex-pcre one, which is a wrapper to the widely used 'pcre' library.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 26 Aug 2012 16:18:59 +0000 (18:18 +0200)]
Add an Applicative instance for our Result type
This will allow us to run generic computations in an Applicative
context, if a monadic one is not needed (or not applicable due to
class constraints).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 26 Aug 2012 13:00:31 +0000 (15:00 +0200)]
Parameterize the Filter type
In preparation for introducing filtering functionality, we convert the
'Filter' type from a '*' kind to a '* -> *' kind.
This allows us to define some general properties for the filter, and
for example introduce later an easy filter compilation, etc.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:46:32 +0000 (00:46 +0200)]
Implement QueryFields for Nodes
Since we have all the definitions already, we can easily enable
this. Manual testing shows no difference between the Python and the
Haskell versions of node list-fields.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Tue, 4 Sep 2012 10:56:21 +0000 (12:56 +0200)]
Merge branch 'devel-2.6'
* devel-2.6:
Fix warnings/errors with newer pylint
Fix decorator uses which crash newer pylint
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Iustin Pop [Tue, 4 Sep 2012 10:04:10 +0000 (12:04 +0200)]
Merge branch 'stable-2.6' into devel-2.6
* stable-2.6:
Fix warnings/errors with newer pylint
Fix decorator uses which crash newer pylint
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
René Nussbaumer [Mon, 27 Aug 2012 11:15:07 +0000 (13:15 +0200)]
Putting the multiallocate pieces together
This is the final part:
* Parsing the new request type
* Feed it to allocList
* Format the result
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Mon, 27 Aug 2012 11:13:55 +0000 (13:13 +0200)]
Adding allocList function
This function iterates over the tryMGAlloc function, updates the node
list and instance list, and refeeds it recursively until no new
instances are left.
This allows us then to allocate multiple instances and see if they would
fit together.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Mon, 27 Aug 2012 11:13:19 +0000 (13:13 +0200)]
Adding new IAllocator mode to constants
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Tue, 28 Aug 2012 23:12:19 +0000 (01:12 +0200)]
Fix warnings/errors with newer pylint
To help developing Ganeti on newer distributions, let's try to fix
pylint warnings/errors. I'm using pylint from current Debian wheezy:
pylint 0.25.1, astng 0.23.1, common 0.58.0, and we have 3 things that
needs fixing.
First, a really wide "except", with the silencing in the wrong
place. I'm not sure why this doesn't have "except Exception", so let's
add it. However, pylint still complains about "Catching too general
exception", even though we do want to catch both system and our
exception, so let's add a silence for W0703. It's true that we
shouldn't catch KeyboardInterrupt and friends, but that should be
cleaned up on the master branch.
Second, pylint complains about "redefining name builtin tuple",
because we do some pattern matching in the except blocks in
netutils. This seems to be a false positive, but let's clean the code
around this.
And finally, type inference again goes bad, so let's silence E1103
with its "boolean doesn't have 'get' method".
After this, I can run "make lint", and by extension "make
commit-check" on Debian Wheezy, yay! We might be able to bump our
required pylint versions to something not ancient…
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 3 Sep 2012 15:09:17 +0000 (16:09 +0100)]
Merge branch 'devel-2.6'
* devel-2.6:
Instance autorepair design
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Tue, 28 Aug 2012 22:59:00 +0000 (00:59 +0200)]
Fix decorator uses which crash newer pylint
Pylint version:
pylint 0.25.1,
astng 0.23.1, common 0.58.0
crashes when passing the fully-qualified decorator name with:
File "/usr/lib/pymodules/python2.7/pylint/checkers/base.py", line 161, in visit_function
if not redefined_by_decorator(node):
File "/usr/lib/pymodules/python2.7/pylint/checkers/base.py", line 116, in redefined_by_decorator
decorator.expr.name == node.name):
AttributeError: 'Getattr' object has no attribute 'name'
I found out that simply using a shortened name will 'fix' this issue,
so let's do this to allow running newer pylint versions.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Guido Trotter [Mon, 23 Jul 2012 15:09:36 +0000 (16:09 +0100)]
Instance autorepair design
This design describes a tool that will perform automatic repairs on
instances when they are detected to be unhealthy (living on offline or
drained nodes, at the moment). These repairs can be scheduled
automatically or requested as a one-off by a tool or person.
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:27:19 +0000 (00:27 +0200)]
Add missing luxi query 'QueryFields'
This was missed; we add the definition and the de-serialisation
support.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:18:16 +0000 (00:18 +0200)]
Add Query support for Nodes (no filtering, no RPC)
This is the initial support for Query2: basic infrastructure (except
filtering) and node query support (without RPC).
It implements all the fields (tests by comparison with list-fields on
the Python side), except that:
- filter is not done
- since RPC is not integrated yet, the runtime gathering/computing is
simply stubbed out
However, the infrastructure seems pretty reasonable, so I'm sending as
is.
Note that I've split the functions/declarations into multiple files,
to keep each file clean and readable.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 23:04:29 +0000 (01:04 +0200)]
Move parameter title definitions to constants
This fixes an old TODO for moving these; now they can be reused in the
Haskell Query2 implementation.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:15:14 +0000 (00:15 +0200)]
One more SADT type - VType
This adds the VTYPE_* conversion to VType, used for QFT equivalence
later.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:04:27 +0000 (00:04 +0200)]
Extend convert-constants support for dicts
This enhances convert-constants to not flatten dicts completely, but
also generate a so-called association list for them.
This allows either direct use of the 'lookup' function, or (for
performance) conversion to Data.Map and optimised lookup later.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 18:38:43 +0000 (20:38 +0200)]
Expand THH with more functionality for parameters
This adds two related improvements to THH:
- for parameters, we declare a list with all their fields, so that
Query2 can build the list of fields (e.g. for hvparams, or ndparams)
automatically
- we declare a new type class for "DictObjects", i.e. objects which
can be converted to a [(String, JSValue)] list of pairs; while this
applies to all our objects, it will be used first for filled
parameters, so that we can implement the lookup functions
generically
Note that we re-export the new class from Objects.hs, so that other
modules don't have to import THH.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 12:48:12 +0000 (14:48 +0200)]
Add more node-related data types and functions
This is a simple type declaration for NodeRole, a NdParamObject type
class, and a few related helper functions for nodes and node groups.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 22:47:16 +0000 (00:47 +0200)]
Fix typo in node role description
I'd rather not introduce this typo in the Haskell code too, and also
not having them identical is not good.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Fri, 24 Aug 2012 12:44:26 +0000 (14:44 +0200)]
Add type classes for common objects
These mirror the TaggableObject in Python, in the sense that we will
be able to define generic functions for querying such fields.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Thu, 23 Aug 2012 21:12:30 +0000 (23:12 +0200)]
Stub query2 call integration into QueryD
This patch corrects the definitions in Qlang.hs to match what Python
expects on the wire; this means replacing some manual data type
definitions with 'buildObject' so that we get serialisation (and field
names) for free, adding (manually) JSON instances for types which are
not represented as objects in JSON, etc. Due to more TH usage, I had
to shift some definitions around, since TH breaks the "define in any
order" property (☹).
After that, we simply add a call into the stub Query/Query.hs module
which, for all queries, responds with "query not supported". The
reason for the deep directory structure is because I want to separate
the functionality into multiple submodules, for smaller module size
and readability.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 26 Aug 2012 16:22:15 +0000 (18:22 +0200)]
Fix error reporting for bad Luxi arguments in QueryD
Currently, the query daemon would simply close the connection to the
client without issuing a response, if parsing the arguments failed;
the error was just logged.
Since this is very ugly from the client's point of view, we change it
so that the error is both logged and sent back to the
client. Furthermore, the execution block reporting is also cleaned up
a bit, to make the code more uniform.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 26 Aug 2012 16:20:08 +0000 (18:20 +0200)]
Improve error reporting in our JSON conversions
Reporting things such as the following in our error messages
(indentation added by me, not originally present, so it's even worse):
JSArray [JSArray [JSRational False (1 % 1),JSString
(JSONString {fromJSString = "a"})],
JSArray [JSRational False (2 % 1),
JSString (JSONString {fromJSString = "b"})]]
Is not really nice. This patch adds more 'pp_value' conversions so
that the above becomes:
[[1, "a"], [2, "b"]]
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Thu, 23 Aug 2012 20:53:20 +0000 (22:53 +0200)]
Cleanup query socket before attempting to bind
This patch adds a simple function to ensure a socket doesn't exist
before binding to it. Additionally, we cleanup the exports of
Queryd.hs.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 22 Aug 2012 16:53:34 +0000 (18:53 +0200)]
Complete and enable the haskell QueryClusterInfo call
Since we have now access to all cluster parameters, we can "fill" the
parameters, and can finally enable it in CLI/RAPI.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 22 Aug 2012 16:48:56 +0000 (18:48 +0200)]
Expand Objects.hs definitions
This patch adds the missing parameters in the cluster/group objects,
for now as simple maps (dictionaries), without type safety. The
rationale for adding them as such is:
- we need something to enable query functionality
- since we don't modify the values, we don't risk introducing bugs
- we can improve the types later, once we find a good way to declare
them
Also, I renamed a few of the parameters, dropping capitalisation of
acronyms (NIC → Nic, etc.).
At this point, I believe that the definitions are complete, with any
missing items being just oversight, and not intentionally removed (due
to lack of types, etc.).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 22 Aug 2012 16:44:19 +0000 (18:44 +0200)]
Add a fillDict function
This is similar to the Python version, objects.py:FillDict.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 22 Aug 2012 16:42:04 +0000 (18:42 +0200)]
Fix qualified import of Data.Map in QC.hs
As opposed to all other places in the code, we imported this as
Data.Map, leaving to longer names. Let's make it similar to the rest
of the code (import qualified Data.Map as Map).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Wed, 22 Aug 2012 15:57:33 +0000 (17:57 +0200)]
Enhance convert-constants list generation
While looking at the hypervisor types in Constants.hs, I saw that the
'hyperTypes' list is using strings instead of names. This is due to
the fact that we require the entire elements in the list to be
identified (homogeneous lists), but the string "xen-pvm" is declared
by both 'defaultEnabledHypervisor' and 'htXenPvm'.
We can improve convert-constants by adding a list of names that we
know (statically) don't declare, but instead reuse values. Unless we
have an ADT parser, this is the best we can do, I think.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Mon, 20 Aug 2012 19:44:52 +0000 (21:44 +0200)]
Add two confd library tests
These test that we encode requests correctly and decode good messages,
that a message with a too old/new timestamp is never accepted, and
that a message signed with a different key is never accepted.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Mon, 20 Aug 2012 18:18:37 +0000 (20:18 +0200)]
Reduce some more code duplication and split code
The Qlang module defines ResultStatus, but it was already defined in
Ganeti/Luxi.hs; let's remove the duplicate definition from there since
the proper place is in the newer module.
Also, in order to ease testing, we split some confd functions into a
separate module; this can be imported easily into QC for testing.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Mon, 20 Aug 2012 17:22:24 +0000 (19:22 +0200)]
Add test for checking Haskell/Python opcode equivalence
This is a very big hack for testing the equivalence of Python and
Haskell opcode definitions. See the docstring for details; I'm not
very happy with the solution but it does the job.
An alternate option would be to launch the Python code when
initialising the tests, pass (somehow) the resource through all of the
test suite to this function, and then use normal QuickCheck
properties. Or maybe we find a better solution later; for now, this
does the job.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Mon, 20 Aug 2012 17:13:15 +0000 (19:13 +0200)]
Create a custom type for disk indices
While (again) trying to test Python/Haskell encoding interoperability,
I found another bug: the disk index is declared in Python as
ht.TPositiveInt, but in Haskell just as Int, so it can take negative
values too. Clearly we can do better, so let's add a wrapper type that
protects creation of invalid indices via a smart constructor
(http://www.haskell.org/haskellwiki/Smart_constructors, the runtime
checking variant).
This means that outside of OpCodes.hs, it's not possible to load
invalid values, and this also applies to de-serialisation from JSON
data.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Mon, 20 Aug 2012 11:53:09 +0000 (13:53 +0200)]
Handle better 'null' values in optional fields
While testing Haskell⇔Python interoperability for opcode
serialisation, I found this bug: the Haskell code doesn't treat
optional fields with 'null' values as missing, which the Python code
does, leading to differences.
Investigating all uses of 'maybeFromObj' and the single use of
'fromObjWithDefault' shows that these are only used in cases where we
the rules are indeed "null == missing", so let's update the functions
and their docstrings accordingly.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 22:42:58 +0000 (00:42 +0200)]
Add test case for OpCode list equivalence
For now, we only test that we don't define extra opcodes in the
Haskell code; once we have parity, we can enable the (for now)
commented-out lines that check the reverse.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 22:41:26 +0000 (00:41 +0200)]
Add infrastructure for reading Python command output
This will be used in the future to make tests/assertions for
Python/Haskell codebase equivalence (e.g. checking that the same
opcodes are defined, etc.).
(Side-note: this might not work in VPATH builds; I'll see how it goes)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 22:25:49 +0000 (00:25 +0200)]
QCHelper: add support for defining HUnit test cases
This will allow us to use exactly the same method as for defining and
using QuickCheck properties. The differentiation is based on name,
which is not very nice but is the same method used in
test-framework-th, for example (so we will be able to switch
trivially).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 21:41:18 +0000 (23:41 +0200)]
Rename tests for nicer names in test output
With the change to test-framework, where individual tests are listed,
QCHelper tries to remove a "prop_$group_" prefix from the function
names, for shorter names. However, some test groups (LUXI) and test
functions are not uniform, leading to long names, so we should fix
them.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 21:33:45 +0000 (23:33 +0200)]
Switch Haskell test harness to test-framework
This patch replaces our home-grown, and quite limited, test runner
infrastructure with test-framework
(http://batterseapower.github.com/test-framework/). The rationale for
doing so is as follows:
- we will need to add support for HUnit tests, so either we add more
custom code or we switch to an existing library
- test-framework is mature and already packaged, at least in
Debian/Ubuntu
- it supports more features: parallel test running, better test
selection, etc.
As you can see, the changes are trivial, and don't touch the tests at
all; if/when we split the QC.hs file into per-module files, then we
could drop QCHelper too, and replace it with test-framework-th, which
does the same, but even more automated (auto-discovery, without having
to list the tests at all).
Dependencies are updated in devnotes.rst; note that I've already added
the hunit dependencies since we're going to use that soon.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 21:17:26 +0000 (23:17 +0200)]
Simplify the Luxi client-server test
Since now we have the recvMsgExt, we can remove the handleEOF
function.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 21:16:32 +0000 (23:16 +0200)]
Fix bug in the Luxi client-server test
We didn't close the server correctly, so for test sizes bigger than
the max-open-files ulimit, the tests were failing in accept().
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
Iustin Pop [Sun, 19 Aug 2012 18:01:18 +0000 (20:01 +0200)]
TH: one style fix and more docstrings
We were missing many docstrings in THH.hs, so let's add at least some
of them, and fix some unquoted '/'. Additionally one style change has
been done.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>