Hi All,

This review is new proposal to implement CI test cases inside 389-DS.
The layout of the tests will be:

<head>/dirsrvtests/
    tickets/
        ticket_
abc_test.py
        ticket_xyz_test.py

        ...
                  finalizer

    testsuites/
        acl_test.py
        replication_test.py
        ...

Each ticket_xyz_test.py will contain "framework" functions that will allocate a fresh installed instance then the test functions:
"framework" functions are _ds_create_standalone, DSInstance class and ds_instance pytest fixture.
tests functions are named 'test_ticket_xyz' with 'ds_instance' fixture as argument.

py.test will call the test functions 'test_ticket_xyz'. Its argument is an instance (ds_instance) of DSInstance where ds_instance.instance is a connection to the instance.

The first instance of DSInstance (first ticket being tested), get a newly created instance (e.g. slapd-standalone) and creates a backup of the instance (under /tmp/slapd-standalone.bck/backup_HHMMSS.tar.gz).
Then when running others  ticket test cases, the instance is reinitialized from the backup.
So each ticket test case will have an instance almost like it was just created.

py.test will discover all the ticket_xxx_test.py files and run them.
In order to remove the created instances, py.test is called a second time to run finalizer.py.
So a jenkins job script, will do something like:
cd <head>/dirsrvtests/tickets
py.test -v   # that will run all the ticket_xxx_tests and create the instance
py.test -v finalizer.py

Note: in order to check/backup/restore instance, new functions are added in lib389 (

checkInstanceBackupFS, instanceBackupFS, instanceRestoreFS), I will send an other review for them as it is not in 389-DS repos.
https://fedorahosted.org/389/attachment/ticket/47575/0002-Ticket-47575-CI-test-add-test-case-for-ticket47560.patch