#49055 Clean up topology fixtures in suites and tickets
Closed: wontfix None Opened 7 years ago by spichugi.

We have a lot of redundant fixture code in suite and ticket dirs. It would be better to have all standard topology fixtures inside lib389, and then we can only import them to the test code.


Add all topology fixtures in conftest.py for all suites and refactor them accordingly.
Fix PEP8 and some logic issues. Set 2016 date in licenses.

For now we have:
- topology_st - with topology_st.standalone inst;
- topology_m2 and topology_m4 - with dicts
{{{
topology_mN.ms["masterX"]
topology_mN.ms["masterX_agmts"]["mX_mY"]
}}}

Using this setup we can easily run through masters
and agreements in loops.

Also, I've added comment to this ticket - https://fedorahosted.org/389/ticket/47747#comment:5

You have been busy! This looks like a great cleanup and fix, assuming you are moving the fixtures to a single location. Great!

My only concern is that if I run a single test, how many instances are being setup for it. IE when I request a fixture, does it only create the servers needed?

Otherwise, I'm really happy with this change, this is a great improvement. Can you adjust the test-creation script also to use the same system?

Replying to [comment:3 firstyear]:

You have been busy! This looks like a great cleanup and fix, assuming you are moving the fixtures to a single location. Great!

My only concern is that if I run a single test, how many instances are being setup for it. IE when I request a fixture, does it only create the servers needed?

There would be no problem.
For example, one test case asks for "topology_m2" fixture. So only this fixture will be executed (and cleaned up in the end of the module).

Otherwise, I'm really happy with this change, this is a great improvement. Can you adjust the test-creation script also to use the same system?

Sure, I've adjusted create_test.py too.
I've removed all topology creations from 'suites' create_test.py option. But I've left it for tickets, because our tickets should be able stand on its own (we attach them to the bugzillas sometimes, for instance).
Though I have an idea how to make developer's testing experience better. For the discussion, please, join here - https://fedorahosted.org/389/ticket/47747#comment:5

Replying to [comment:4 spichugi]:

Replying to [comment:3 firstyear]:

You have been busy! This looks like a great cleanup and fix, assuming you are moving the fixtures to a single location. Great!

My only concern is that if I run a single test, how many instances are being setup for it. IE when I request a fixture, does it only create the servers needed?

There would be no problem.
For example, one test case asks for "topology_m2" fixture. So only this fixture will be executed (and cleaned up in the end of the module).

Otherwise, I'm really happy with this change, this is a great improvement. Can you adjust the test-creation script also to use the same system?

Sure, I've adjusted create_test.py too.
I've removed all topology creations from 'suites' create_test.py option. But I've left it for tickets, because our tickets should be able stand on its own (we attach them to the bugzillas sometimes, for instance).
Though I have an idea how to make developer's testing experience better. For the discussion, please, join here - https://fedorahosted.org/389/ticket/47747#comment:5

They aren't that standalone. Make the topology_ part of lib389, and just do import from lib389.fixtures., then it will work out what's needed.

That way we can clean up the tickets too.

How about I ack this patch, because I think it looks good, then you add the fixtures to lib389, and make them importable so we can clean up the tickets.

I've changed the commit subject and removed conftest.py. I think we don't need the redundancy (as long as we have fixtures in lib389).

Now we will import and use topology fixtures like that:
'''from lib389.topologies import topology_st'''

You can review lib389 patch here - https://fedorahosted.org/389/ticket/47747
I will refactor lib389 tests later.

The next stop - tickets.

To ssh://git.fedorahosted.org/git/389/ds.git
251424e..82030d1 master -> master
commit 82030d1
Author: Simon Pichugin spichugi@redhat.com
Date: Fri Nov 18 10:17:27 2016 +0100

Looks like there a big problem with all of this. There is no way to set DEBUGGING from the test script. So I'm trying to debug cleanallruv test suite (failures could actually be related to this ticket?), but I can't set it to "debug" without editing lib389 source code. This needs to be fixed.

Replying to [comment:9 mreynolds]:

Looks like there a big problem with all of this. There is no way to set DEBUGGING from the test script. So I'm trying to debug cleanallruv test suite (failures could actually be related to this ticket?), but I can't set it to "debug" without editing lib389 source code. This needs to be fixed.
Somehow I've missed the notification email about your comment.
I am working on it together with other clean up changes, and I'll put this fix soon then, as I know now it is a blocker for you.

Btw, my idea is to use an environment variable.

Please, review the lib389 patch.

To ssh://git.fedorahosted.org/git/389/lib389.git
756f51e..5c9e2c9 master -> master
commit 5c9e2c9981edffed232ecea3495ecac347dff794
Author: Simon Pichugin spichugi@redhat.com
Date: Mon Jan 2 08:28:27 2017 +0100

I will refactor create_test.py for tickets with a next patch.

To ssh://git.fedorahosted.org/git/389/ds.git
017469a..54e9036 master -> master
commit 54e9036
Author: Simon Pichugin spichugi@redhat.com
Date: Fri Dec 23 19:04:57 2016 +0100

Now create_test.py works considering new changes in tickets, suites and topology fixtures.
- If you choose a topology that already exists, create_test.py will just import the suitable fixture.
- And if you choose a non existing topology, create_test.py will make it for you. So you can move it to lib389/topologies.py later.

Also, rename dirsrvtests/cmd dir to dirsrvtests/cmds, because it conflicts with another Python module.

I really like this patch, it makes our tests much better.

If you want, you can delete the contents of cmds instead since these now exist in lib389 instead.

Thanks, William. I've removed it.

To ssh://git.fedorahosted.org/git/389/ds.git
e361837..98c88d0 master -> master
commit 98c88d0
Author: Simon Pichugin spichugi@redhat.com
Date: Thu Jan 5 16:01:54 2017 +0100

Hi Simon,

it seems that create_test is broken. I'm on 98c88d0 and lib389 is 5c9e2c9981edffed232ecea3495ecac347dff794.
Standalone topology:
{{{
root@rhel7ds dirsrvtests# ./create_test.py -t 1
Created: ticket1_test.py
root@rhel7ds dirsrvtests
# py.test -s -v ticket1_test.py
========================================================== test session starts ==========================================================
platform linux2 -- Python 2.7.5, pytest-3.0.4, py-1.4.31, pluggy-0.4.0 -- /usr/bin/python
cachedir: .cache
rootdir: /root/src/ds/dirsrvtests, inifile:
plugins: html-1.11.0, cov-2.4.0, beakerlib-0.6
collected 0 items / 1 errors

================================================================ ERRORS =================================================================
_______ ERROR collecting ticket1_test.py _______
/usr/lib/python2.7/site-packages/
pytest/python.py:415: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/site-packages/py/_path/local.py:650: in pyimport
import
(modname)
E File "/root/src/ds/dirsrvtests/ticket1_test.py", line 24
E @pytest.fixture(scope="module")
E ^
E IndentationError: expected an indented block
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================== 1 error in 0.15 seconds ========================================================
}}}

2MMR topology:
{{{
root@rhel7ds dirsrvtests*# ./create_test.py -t 2 -m 2
Traceback (most recent call last):
File "./create_test.py", line 659, in <module>
if repl_deployment:
NameError: name 'repl_deployment' is not defined
}}}

Topologies with hubs and consumers work fine.

To ssh://git.fedorahosted.org/git/389/ds.git
4ce95a7..8a99552 master -> master
commit 8a99552
Author: Simon Pichugin spichugi@redhat.com
Date: Tue Jan 10 11:47:16 2017 +0100

Metadata Update from @spichugi:
- Issue assigned to spichugi
- Issue set to the milestone: CI test 1.0

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/2114

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

3 years ago

Login to comment on this ticket.

Metadata