zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0008-Issue-50177-Add-a-new-CI-test-case-also-added-fixes-.patch

232633
From 96e4ad85a6fce9e140658b57146830b85c951415 Mon Sep 17 00:00:00 2001
232633
From: Akshay Adhikari <aadhikar@redhat.com>
232633
Date: Fri, 28 Jun 2019 17:27:08 +0530
232633
Subject: [PATCH 04/12] Issue 50177 - Add a new CI test case, also added fixes
232633
 in lib389
232633
232633
Bug Description: Import task should not be deleted too rapidely after import finishes
232633
to be able to query the status.
232633
232633
Fix Description: A new attribute 'ttl' is order to tune the life time of the task.
232633
The default value is increased to '86400'. Added a test to check that and added it
232633
to ImportTask & ExportTask classes in lib389 so it will create ttl attribute by default.
232633
232633
Fixes: https://pagure.io/389-ds-base/issue/50177
232633
232633
Review by: mreynolds (Thanks!)
232633
---
232633
 dirsrvtests/tests/suites/basic/basic_test.py | 1 +
232633
 src/lib389/lib389/_constants.py              | 2 ++
232633
 src/lib389/lib389/tasks.py                   | 2 ++
232633
 3 files changed, 5 insertions(+)
232633
232633
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
232633
index 1e8662642..d2f8262fb 100644
232633
--- a/dirsrvtests/tests/suites/basic/basic_test.py
232633
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
232633
@@ -274,6 +274,7 @@ def test_basic_import_export(topology_st, import_example_ldif):
232633
     assert r.present('nstasklog')
232633
     assert r.present('nstaskcurrentitem')
232633
     assert r.present('nstasktotalitems')
232633
+    assert r.present('ttl')
232633
 
232633
     r.wait()
232633
 
232633
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
232633
index ee5ed9e3e..e65613128 100644
232633
--- a/src/lib389/lib389/_constants.py
232633
+++ b/src/lib389/lib389/_constants.py
232633
@@ -20,6 +20,8 @@ INSTALL_LATEST_CONFIG = '999999999'
232633
 
232633
 REPLICA_FLAGS_CON = 0
232633
 
232633
+TTL_DEFAULT_VAL = '86400'
232633
+
232633
 # The structure is convenient for replica promote/demote methods
232633
 ReplicaRole = Enum("Replica role", "CONSUMER HUB MASTER STANDALONE")
232633
 
232633
diff --git a/src/lib389/lib389/tasks.py b/src/lib389/lib389/tasks.py
232633
index 6a86a422a..f12943fed 100644
232633
--- a/src/lib389/lib389/tasks.py
232633
+++ b/src/lib389/lib389/tasks.py
232633
@@ -275,6 +275,7 @@ class ImportTask(Task):
232633
         _properties = {
232633
             'nsFilename': ldiffile,
232633
             'nsIncludeSuffix': suffix,
232633
+            'ttl': TTL_DEFAULT_VAL,
232633
         }
232633
         self.create(properties=_properties)
232633
 
232633
@@ -300,6 +301,7 @@ class ExportTask(Task):
232633
         _properties = {
232633
             'nsFilename': ldiffile,
232633
             'nsIncludeSuffix': suffix,
232633
+            'ttl': TTL_DEFAULT_VAL,
232633
         }
232633
         self.create(properties=_properties)
232633
 
232633
-- 
232633
2.21.0
232633