From 8306873be29e0d9690f43f655a21abf543393e62 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 2 Feb 2009 19:29:52 +0000 Subject: [PATCH] speed up kpasswd tests Reorder some tests and tune delays, so that we don't need to run for much more than twice the min-password-life interval when testing that functionality. (This could be made faster if we can assume that init_db will always have been run immediately before the tests start.) In my tests, this cuts something like 11 seconds off the run time (now down to about 65 seconds). ticket: 6358 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21867 dc483132-0cff-0310-8789-dd5450dbe970 --- .../passwd/unit-test/kpasswd.0/changing.exp | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/kadmin/passwd/unit-test/kpasswd.0/changing.exp b/src/kadmin/passwd/unit-test/kpasswd.0/changing.exp index 740d7e62b..25c2a59c4 100644 --- a/src/kadmin/passwd/unit-test/kpasswd.0/changing.exp +++ b/src/kadmin/passwd/unit-test/kpasswd.0/changing.exp @@ -12,6 +12,23 @@ if [info exist env(DEBUG)] { debug 1 } # Here are the tests # +# Under "make check", init_db will just have been run and we could +# jump right into the too-soon test. But if someone is working with +# the test suite manually, init_db may have been run a while ago. +# So, force some known state, first. +verbose "(sleeping 30 seconds so pol2 password can be changed)" +sleep 30 + +test_win {pol2} {successful change} pol2 pol222222 polbbbbbb + +set pol2_time [expr 31 + [timestamp]] + +test_3pass {pol2} {D.15: too soon to change password} pol2 \ + polbbbbbb pol333333 pol333333 \ + 4 {Password cannot be changed because it was changed too recently. Please wait until .*[12][0-9][0-9][0-9] before you change it. If you need to change your password before then, contact your system security administrator.} + +# + test_3pass {test2} {D.5: different new passwords} test2 test2 test2 foobar \ 4 {New passwords do not match - password not changed.} @@ -89,17 +106,11 @@ test_win {pol1} {successful change} pol1 polAAAAAA polBBBBBB test_win {pol1} {successful change} pol1 polBBBBBB polCCCCCC test_win {pol1} {successful change} pol1 polCCCCCC pol111111 -verbose "(sleeping 30 seconds)" -catch "exec sleep 30" - -test_win {pol2} {successful change} pol2 pol222222 polbbbbbb - -test_3pass {pol2} {D.15: too soon to change password} pol2 \ - polbbbbbb pol222222 pol222222 \ - 4 {Password cannot be changed because it was changed too recently. Please wait until .*[12][0-9][0-9][0-9] before you change it. If you need to change your password before then, contact your system security administrator.} - -verbose "(sleeping 30 seconds)" -catch "exec sleep 30" +# Now delay a little longer (if needed) and try changing pol2's +# password again. +set delay [expr $pol2_time - [timestamp]] +verbose "(sleeping $delay seconds)" +sleep $delay -test_win {pol2} {password min life passed} pol2 polbbbbbb pol222222 +test_win {pol2} {password min life passed} pol2 polbbbbbb pol333333 -- 2.26.2