Statistics
| Branch: | Tag: | Revision:

root / test / py / cmdlib @ 55ba3ad6

# Date Author Comment
55ba3ad6 09/17/2013 06:45 pm Sebastian Gebhard

Add unittests for OpenvSwitch in LUNodeAdd

This patch adds node_unittest.py containing the framework for unit
testing LUNodeAdd.
At this point, only test setup and tests for OpenvSwitch are
implemented.

Signed-off-by: Sebastian Gebhard <>...

4256f8fe 09/17/2013 06:45 pm Sebastian Gebhard

Replace more IPs with reserved adresses

Recently, some IP addresses were changed to TEST-NETs from RFC 5737.
This patch changes some more occurences of wrong IPs and replaces them.

TEST-NET-1 is used for primary_ips, TEST-NET-2 for networks and TEST-NET-3 for...

d45574de 09/17/2013 06:45 pm Sebastian Gebhard

Mock RPC for unit tests

This patch enables patching the rpc module to create a mocked version
which can be used to mock a rpc.DnsOnlyRunner(). This is needed for
unit testing LUNodeAdd, as it need to run RPCs against nodes not yet
present in the configuration....

11414807 09/13/2013 02:20 pm Klaus Aehlig

Fix example IPs and hostnames in tests

Our tests are a form of documentation, and hence should use
IPs from the TEST-NET ranges according to RFC 5737. They definitely
should not use real public IP addresses.

Similarly, example host names should be from one of the reserved...

2f3230f6 09/12/2013 03:56 pm Thomas Thrainer

Add unit test for LUInstanceQuery and -QueryData

This patch provides rudimentary unit test coverage for LUInstanceQuery
and LUInstanceQueryData.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Klaus Aehlig <>

d1b2ffe8 09/12/2013 03:56 pm Thomas Thrainer

Add unit tests for LUInstanceMigrate and -Failover

This patch adds rudimentary unit test coverage for LUInstanceMigrate and
LUInstanceFailover.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Klaus Aehlig <>

b02063fe 09/12/2013 03:56 pm Thomas Thrainer

Add unit tests for LUInstanceChangeGroup

This patch provides unit test coverage for LUInstanceChangeGroup.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Klaus Aehlig <>

27619aac 09/12/2013 03:56 pm Thomas Thrainer

Add unit tests for LUInstanceSetParams

This patch adds unit tests for LUInstanceSetParams. It does not provide
100% coverage, but covers a significant portion.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Klaus Aehlig <>

f41b569f 09/12/2013 03:56 pm Thomas Thrainer

Fix testMasterNetmask in TestLUClusterSetParams

The netmask was previously wrongly given as a bitmask, now it's given as
the net prefix length.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Klaus Aehlig <>

0c5f1b13 09/12/2013 03:23 pm Thomas Thrainer

Merge branch 'stable-2.9' into master

  • stable-2.9
    Fix bridging in net-common
    Sync build_chroot with buildbot slack role
    Auto-upgrade of disks' config wrt LD-renaming
    Fix tests regarding DISK_LD_DEFAULTS
    Fixing renaming of DISK_LD_DEFAULTS
    Replace LD_* constants with DT_* constants...
31ccfc0e 08/27/2013 04:50 pm Helga Velroyen

cluster modify: deprecate --no-drbd-storage

As in the previous patch, the option '--no-drbd-storage'
is deprectated, because it is subsumed by the non-inclusion
of 'drbd' in the list of enabled disk templates.

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

7c577910 08/27/2013 04:50 pm Helga Velroyen

cmdlib/cluster.py: unit tests for usermode helper

This patch factors out the functions that deal with setting
and modifying the DRBD usermode helper in cluster.py in
order to make them more unittestable. The unit tests are
provided as well. No functional changes otherwise....

1583d0e4 08/21/2013 10:27 am Thomas Thrainer

Adapt tests for merged changes in IPolicy handling

The enabled disk templates in IPolicies are stricter checked after the
merge from 2.9, so adapt the tests to follow those changes.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Helga Velroyen <>

4a8c84f3 08/21/2013 10:27 am Thomas Thrainer

Add unit tests for LUInstanceMultiAlloc

This patch adds unit test coverage for LUInstanceMultiAlloc.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

bf2a3eba 08/21/2013 10:27 am Thomas Thrainer

Add unit test for LUInstanceRename

This patch adds unit test coverage for LUInstanceRename.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

72bac0c5 08/21/2013 10:27 am Thomas Thrainer

Add basic unit tests for instance import

This patch adds basic unit tests for instance import in
LUInstanceCreate. It does not provide full coverage though.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

57da0458 08/21/2013 10:27 am Thomas Thrainer

Introduce GetMockLU and reduce use of _FakeLU

Introduce a new method of creating a mocked LU for tests, and reduce the
use of the legacy _FakeLU class.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

e066018b 08/21/2013 10:27 am Thomas Thrainer

Add unit tests for LUInstanceRemove and -Move

This patch adds unit test coverage for LUInstanceRemove and
LUInstanceMove.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

66222813 08/21/2013 10:27 am Thomas Thrainer

Add unit tests for LUInstanceCreate and move tests

- Move instance related tests to instance_unittest.py
- Adapt moved tests to the new test framework where appropriate
- Add unit test coverage for LUInstanceCreate
- Only instance creation is covered yet, no imports...

3c768f88 08/14/2013 03:19 pm Thomas Thrainer

Add unit test for LUGroupVerifyDisks

This patch adds unit test coverage for LUGroupVerifyDisks.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

4b8f9420 08/14/2013 03:19 pm Thomas Thrainer

Add unit test for LUGroupEvacuate

This patch adds unit test coverage for LUGroupEvacuate.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

7ac3f7b0 08/14/2013 03:19 pm Thomas Thrainer

Add unit tests for LUGroupRename

This patch adds unit test coverage for LUGroupRename.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

8ef0c3eb 08/14/2013 03:19 pm Thomas Thrainer

Add unit tests for LUGroupRemove

This patch adds unit test coverage for LUGroupRemove.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

67d2f602 08/14/2013 03:19 pm Thomas Thrainer

Add unit tests for LUGroupSetParams

This adds unit test coverage for LUGroupSetParams.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

ae904a6b 08/14/2013 03:19 pm Thomas Thrainer

Add unit test for LUGroupQuery

Provide unit test coverage for LUGroupQuery.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

d189f139 08/14/2013 03:19 pm Thomas Thrainer

Add unit tests for LUGroupAssignNodes

Add unit test coverage for LUGroupAssignNodes, including the split
instances check.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

9051a390 08/14/2013 03:19 pm Thomas Thrainer

Add unit tests for LUGroupAdd

Provide unit test coverage for LUGroupAdd.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

8129eac1 08/14/2013 03:19 pm Thomas Thrainer

Move TestLUGroupAssignNodes to group_unittest.py

While moving the test, it is adapted to the new test framework.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

570b6322 08/13/2013 12:02 pm Thomas Thrainer

Add test for LUClusterVerifyDisks

This LU only creates additional jobs as result, so this is a trivial
unit test.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Guido Trotter <>

9fdb10be 08/13/2013 12:02 pm Thomas Thrainer

Extend unit tests for LUClusterVerifyGroup

- Add tests for additional Verify* methods
- Converted test for VerifyFiles to the new test framework
- Added possibility to prepare the LU in a test class before actually
executing the test method with it

Signed-off-by: Thomas Thrainer <>...

b8f45292 08/08/2013 05:21 pm Thomas Thrainer

Add possibility to access locked LU in tests

This features is useful to test (private) methods of LU's during tests,
where those methods rely on the LU being completely initialized and
locking already performed.

An initial version of unit tests for LUClusterVerifyGroup makes use of...

850be460 08/08/2013 05:20 pm Thomas Thrainer

Add test for LUClusterVerifyConfig

Add unit test covering LUClusterVerifyConfig.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Helga Velroyen <>

c60f7675 08/08/2013 05:20 pm Thomas Thrainer

Add test for LUClusterVerify

As this LU returns other jobs as result, submitting jobs from within
LU's is now mocked too.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Helga Velroyen <>

08cef8fc 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterRename

Also mock the netutils and ssh module in order to test all code paths.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

c487ae24 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterRepairDiskSizes

Also add build method for easy building of disk objects to the test
framework.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

f02733cc 08/07/2013 06:52 pm Thomas Thrainer

Introduce shortcut properties for config objects

Some configuration objects are accessed quite often, so introduce
shortcut properties for those.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

a794b8d7 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterSetParams

Some changes to the test framework were performed while writing this
test:
- Extended builder for disks
- Introduced builder for NICs
- Fixed bugs in RpcResultsBuilder

Signed-off-by: Thomas Thrainer <>...

812e07ab 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterPostInit

Also extract common assertion logic for hook invocations to
CmdlibTestCase.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

b730e2a7 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterQuery

Unit-test LUClusterQuery. Some changes in the mocked cluster
configuration are made, because the configuration was not completely
valid before.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

6aac41fa 08/07/2013 06:52 pm Thomas Thrainer

Add unit test for LUClusterRedistConf

Unit-test LUClusterRedistConf. Given the simplicity of the LU, this unit
test only exercises the LU code.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

bd6fb93b 08/07/2013 06:52 pm Thomas Thrainer

Add unit tests for LUClusterDestroy

This patch adds unit test for the LUClusterDestroy Logical Unit.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

1fa88aa6 08/07/2013 06:51 pm Thomas Thrainer

Move cmdlib-related unittests to cmdlib/

ganeti.cmdlib_unittest.py and
ganeti.cmdlib.instance_storage_unittest.py are moved to the
test/py/cmdlib directory. Also, they are renamed to match the names in
this module.

Additionally, instance_storage_unittest.py was added to the makefile, so...

0e1b5262 08/07/2013 06:51 pm Thomas Thrainer

Move cluster-related unittest to cluster_unittest

cmdlib_unittest should still be split further, but at least the cluster
related tests are moved to the proper file yet.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

eb172e55 08/07/2013 06:51 pm Thomas Thrainer

Add unit tests for LUClusterConfigQuery

Also, proper initialization of the runtime architecture information was
added.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

e0b8df13 08/07/2013 06:51 pm Thomas Thrainer

Add unit test for LUClusterDeactivateMasterIp

This patch adds unit tests for the LUClusterDeactivateMasterIp Logical
Unit.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

19830e88 08/07/2013 06:48 pm Thomas Thrainer

Add unit test for LUClusterActivateMasterIp

In order to properly assert the called RPC method, eq is implemented
on ConfigObject as well.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

e969a81f 08/07/2013 06:48 pm Thomas Thrainer

Add unit test for LUTestAllocator

Additionally to adding unit tests for LUTestAllocator, the test
framework was adapted for its requirements.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Michele Tartara <>

bd39b6bb 08/07/2013 06:48 pm Thomas Thrainer

Enable pylint and PEP8 for test support code

The test support code is mainly written from scratch, so in order to
ensure to keep the code quality high, enable pylint and PEP8 checks
for it.

Due to some specialities of the test code, a dedicate pylintrc-test file...

3efa7659 08/07/2013 06:48 pm Thomas Thrainer

Initial version of cmdlib test framework

The initial version of the cmdlib test framework is able to execute LU's
with the following components mocked:

  • Configuration
  • IAllocator interface
  • Lock manager
  • MCPU processor
  • RPC runner

A base test class is provided which makes it easy to execute opcodes and...