Statistics
| Branch: | Tag: | Revision:

root / test / py / cmdlib / testsupport @ ac156ecd

# Date Author Comment
a09639d1 11/11/2013 10:29 pm Santi Raffa

Remove hardcoded references to File, SharedFile templates

DTS_FILEBASED is a constant that exists and this commit makes sure
that it is used whenever sensible, rather than resorting to hardcoding
the pair of templates in very many files.

Signed-off-by: Santi Raffa <>...

3388debb 10/15/2013 02:54 pm Thomas Thrainer

Add unit tests for LUBackupPrepare

This patch adds unit tests for LUBackupPrepare.

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

f3cb57d5 09/27/2013 02:25 pm Michele Tartara

Prevent lint error in mocked classes

Accessing private methods of parent classes is bad, but it is sometimes the best
approach for classes mocking them for testing reasons.
Selectively disable the related lint error just for the few functions that need
to do it....

317a3fdb 09/27/2013 02:24 pm Michele Tartara

Fix indentation for newer lints

Newer versions of pylint are more strict regarding indentation rules. This
commit fixes a couple of indentations that they consider wrong.

Signed-off-by: Michele Tartara <>
Reviewed-by: Jose A. Lopes <>

fd424c8a 09/24/2013 09:17 am Thomas Thrainer

Remove physical_id from config mock

Disk objects no longer support the physical_id field, so remove it from
mocked disk objects.

Signed-off-by: Thomas Thrainer <>
Reviewed-by: Jose A. Lopes <>

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

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

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

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

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

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

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

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

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