tests: Increase minPwdAge used for PSO tests
authorTim Beale <timbeale@catalyst.net.nz>
Sun, 17 Jun 2018 21:03:40 +0000 (09:03 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Jun 2018 22:18:19 +0000 (00:18 +0200)
The PSO minPwdAge test was using a 1 second timeout. While this seemed
to work fine most of the time, we did see a rackspace failure that was
presumably due to the test taking longer than 1-second to execute
(which resulted in the password not being correctly rejected).

This patch increases the minPwdAge used, to try to avoid this problem
happening.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/password_settings.py

index d072a8fa165eb140e27f43ebae06ef7b07d86cb5..12779a033c61f7e46baa7e698b3a68a4dbdd0881 100644 (file)
@@ -451,7 +451,7 @@ class PasswordSettingsTestCase(PasswordTestCase):
     def test_pso_min_age(self):
         """Tests that a PSO's min-age is enforced"""
         pso = PasswordSettings("min-age-PSO", self.ldb, password_len=10,
-                               password_age_min=1, complexity=False)
+                               password_age_min=2, complexity=False)
         self.add_obj_cleanup([pso.dn])
 
         # create a user and apply the PSO
@@ -462,8 +462,8 @@ class PasswordSettingsTestCase(PasswordTestCase):
         # changing the password immediately should fail, even if password is valid
         valid_password = "min-age-passwd"
         self.assert_password_invalid(user, valid_password)
-        # then trying the same password later (min-age=1sec) should succeed
-        time.sleep(1.5)
+        # then trying the same password later should succeed
+        time.sleep(pso.password_age_min + 0.5)
         self.assert_password_valid(user, valid_password)
 
     def test_pso_max_age(self):