zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone
Blob Blame History Raw
From 96e4ad85a6fce9e140658b57146830b85c951415 Mon Sep 17 00:00:00 2001
From: Akshay Adhikari <aadhikar@redhat.com>
Date: Fri, 28 Jun 2019 17:27:08 +0530
Subject: [PATCH 04/12] Issue 50177 - Add a new CI test case, also added fixes
 in lib389

Bug Description: Import task should not be deleted too rapidely after import finishes
to be able to query the status.

Fix Description: A new attribute 'ttl' is order to tune the life time of the task.
The default value is increased to '86400'. Added a test to check that and added it
to ImportTask & ExportTask classes in lib389 so it will create ttl attribute by default.

Fixes: https://pagure.io/389-ds-base/issue/50177

Review by: mreynolds (Thanks!)
---
 dirsrvtests/tests/suites/basic/basic_test.py | 1 +
 src/lib389/lib389/_constants.py              | 2 ++
 src/lib389/lib389/tasks.py                   | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
index 1e8662642..d2f8262fb 100644
--- a/dirsrvtests/tests/suites/basic/basic_test.py
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
@@ -274,6 +274,7 @@ def test_basic_import_export(topology_st, import_example_ldif):
     assert r.present('nstasklog')
     assert r.present('nstaskcurrentitem')
     assert r.present('nstasktotalitems')
+    assert r.present('ttl')
 
     r.wait()
 
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index ee5ed9e3e..e65613128 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -20,6 +20,8 @@ INSTALL_LATEST_CONFIG = '999999999'
 
 REPLICA_FLAGS_CON = 0
 
+TTL_DEFAULT_VAL = '86400'
+
 # The structure is convenient for replica promote/demote methods
 ReplicaRole = Enum("Replica role", "CONSUMER HUB MASTER STANDALONE")
 
diff --git a/src/lib389/lib389/tasks.py b/src/lib389/lib389/tasks.py
index 6a86a422a..f12943fed 100644
--- a/src/lib389/lib389/tasks.py
+++ b/src/lib389/lib389/tasks.py
@@ -275,6 +275,7 @@ class ImportTask(Task):
         _properties = {
             'nsFilename': ldiffile,
             'nsIncludeSuffix': suffix,
+            'ttl': TTL_DEFAULT_VAL,
         }
         self.create(properties=_properties)
 
@@ -300,6 +301,7 @@ class ExportTask(Task):
         _properties = {
             'nsFilename': ldiffile,
             'nsIncludeSuffix': suffix,
+            'ttl': TTL_DEFAULT_VAL,
         }
         self.create(properties=_properties)
 
-- 
2.21.0