From f4fe389c8dfda3d27d0724ef954e9a77c3b0b1d1 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Fri, 31 May 2013 16:34:38 +0000
Subject: [PATCH] CR-1761 Increased pta cached password ttl to avoid random failure on Windows

---
 opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml           |   43 ++++++++++++---------
 opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml             |   23 +++++++++--
 opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog_tests.xml |   32 ++++++++++++----
 3 files changed, 67 insertions(+), 31 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml
index a3b59ca..d84b9f5 100755
--- a/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/pta/basic/pta_basic_tests.xml
@@ -23,7 +23,7 @@
  !
  ! CDDL HEADER END
  !
- !      Copyright 2011 ForgeRock AS
+ !      Copyright 2011-2013 ForgeRock AS
  ! -->
 <stax>
 
@@ -1139,6 +1139,19 @@
                'Test Name = %s' % STAXCurrentTestcase
             </message>
 
+            <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
+              <script>
+                ttl = 10
+              </script>
+              <else>
+                <!-- Windows -->
+                <script>
+                  ttl = 30
+                </script>
+              </else>
+            </if>
+
             <script>
               userDNsAndPswds={}
               userDNsAndPswds['uid=jwallace, ou=People, dc=AD,dc=com'] = ['linear',ldapPtaPolicyName]
@@ -1163,7 +1176,7 @@
             </call>
 
             <call function="'testStep'">
-              { 'stepMessage' : 'Configure LDAP PTA Policy to use password caching with short ttl (10s).' }
+              { 'stepMessage' : 'Configure LDAP PTA Policy to use password caching with short ttl (%ss).' % ttl }
             </call>
 
             <script>
@@ -1171,7 +1184,7 @@
               options.append('--set primary-remote-ldap-server:%s:%s' % (primaryHost,primaryPort))
               options.append('--set mapping-policy:unmapped')
               options.append('--set cached-password-storage-scheme:Clear')
-              options.append('--set cached-password-ttl:10s')
+              options.append('--set cached-password-ttl:%ss' % ttl)
               options.append('--set secondary-remote-ldap-server:%s:%s' % (secondaryHost,secondaryPort))
               options.append('--set use-password-caching:true')
               options.append('--type ldap-pass-through')
@@ -1264,11 +1277,11 @@
             </iterate>
 
             <call function="'testStep'">
-              { 'stepMessage' : 'Waiting 10 s for password ttl to expire.' }
+              { 'stepMessage' : 'Waiting %ss for password ttl to expire.' % ttl }
             </call>
 
             <call function="'Sleep'">
-              { 'sleepForMilliSeconds'  : 10000 }
+              { 'sleepForMilliSeconds'  : ttl*1000 }
             </call>
 
             <call function="'testStep'">
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog_tests.xml
index 9d4b649..f65fc6f 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog_tests.xml
@@ -104,12 +104,14 @@
             </call>                                                                                 
 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -274,12 +276,14 @@
             </call>                                          
                                             
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -438,12 +442,14 @@
             </call>                                          
 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -529,12 +535,14 @@
             </call>                                          
 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -819,12 +827,14 @@
             </call>                                          
 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -894,12 +904,14 @@
             </call>                                          
 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -1177,12 +1189,14 @@
             </call>
                                         
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
@@ -1460,12 +1474,14 @@
             </call>
                                                 
             <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
               <script>
                 sleepTime = 2000
               </script>
               <else>
+                <!-- Windows -->
                 <script>
-                  sleepTime = 5000
+                  sleepTime = 6000
                 </script>
               </else>
             </if>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
index 8caeaf0..2a66b93 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
@@ -1698,24 +1698,31 @@
               }
             </call>
 
-            <script>
-              opendmkJarFile = '%s/%s/wrong_file' \
-                               % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
-              if is_windows_platform(DIRECTORY_INSTANCE_HOST):
-                opendmkJarFile = opendmkJarFile.replace('/', '\\')
-
-              msg1 = 'The specified OpenDMK jar file'
-              msg2 = '\'%s\' could not be found.' % opendmkJarFile
-              msg = '%s %s' % (msg1, msg2)
-            </script>
-
-            <call function="'grep'">
-              {
-              'location'  : STAF_REMOTE_HOSTNAME ,
-              'filename'  : serverLogFile ,
-              'testString': msg
-              }
-            </call>
+            <!-- Run this check only on Unix.
+                 Difficult to check that on Windows due to '\' characters -->
+            <if expr="not is_windows_platform(STAF_REMOTE_HOSTNAME)">
+              <!-- Unix -->
+              <sequence>
+	            <script>
+	              opendmkJarFile = '%s/%s/wrong_file' \
+	                               % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
+	              if is_windows_platform(DIRECTORY_INSTANCE_HOST):
+	                opendmkJarFile = opendmkJarFile.replace('/', '\\')
+	
+	              msg1 = 'The specified OpenDMK jar file'
+	              msg2 = '\'%s\' could not be found.' % opendmkJarFile
+	              msg = '%s %s' % (msg1, msg2)
+	            </script>
+	
+	            <call function="'grep'">
+	              {
+	              'location'  : STAF_REMOTE_HOSTNAME ,
+	              'filename'  : serverLogFile ,
+	              'testString': msg
+	              }
+	            </call>
+              </sequence>
+            </if>
             
             <script>
               msg1 = 'Verify that the value set in the opendmk-jarfile'

--
Gitblit v1.10.0