From 2e0e84f4548ec911ff200aa437d6a57bbb1640be Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Tue, 02 Aug 2011 14:58:08 +0000
Subject: [PATCH] Improve ldif-import tests and remove known issue tag
---
opends/tests/staf-tests/functional-tests/testcases/backends/import/import_tests.xml | 57 ++++++++------
opends/tests/staf-tests/shared/functions/utils.xml | 2
opends/tests/staf-tests/shared/functions/dsadm.xml | 63 +++++++++++++--
opends/tests/staf-tests/functional-tests/testcases/backends/import-tasks/import-tasks_tests.xml | 92 +++++++++++++----------
4 files changed, 138 insertions(+), 76 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/backends/import-tasks/import-tasks_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/backends/import-tasks/import-tasks_tests.xml
index ff7ba92..903a042 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/backends/import-tasks/import-tasks_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/backends/import-tasks/import-tasks_tests.xml
@@ -1161,31 +1161,37 @@
<call function="'testCase_Preamble'"/>
+ <!-- Import Example.ldif -->
<call function="'ImportLdifWithScript'">
- { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
- 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
- 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
- 'append' : 'TRUE'
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'ldifFile' : '%s/backends/Example.ldif' % remote.data,
+ 'backEnd' : DIRECTORY_INSTANCE_BE
}
</call>
+ <!-- Import Example.ldif -->
+ <call function="'ImportLdifWithScript'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
+ 'append' : 'TRUE'
+ }
+ </call>
+
<call function="'checkImport'">
- { 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
+ { 'dsBaseDN' : 'dc=example,dc=com',
+ 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
'uid=fvinker,ou=Departed,ou=People,dc=example,dc=com',
- 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'],
- 'startDS' : 'no'
- }
+ 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'] ,
+ 'expectedNoEntries' : '163' ,
+ 'startDS' : 'no'
+ }
</call>
-
- <if expr="RC != 0">
- <sequence>
- <call function="'setKnownIssue'">
- { 'issueId' : 6962694 }
- </call>
- </sequence>
- </if>
</sequence>
@@ -1226,32 +1232,38 @@
<call function="'testCase_Preamble'"/>
+ <!-- Import Example.ldif -->
<call function="'ImportLdifWithScript'">
- { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
- 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
- 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
- 'append' : 'TRUE',
- 'replaceExisting' : 'TRUE'
- }
- </call>
-
- <call function="'checkImport'">
- { 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
- 'uid=fvinker,ou=Departed,ou=People,dc=example,dc=com',
- 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'],
- 'startDS' : 'no'
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'ldifFile' : '%s/backends/Example.ldif' % remote.data,
+ 'backEnd' : DIRECTORY_INSTANCE_BE
}
</call>
- <if expr="RC != 0">
- <sequence>
- <call function="'setKnownIssue'">
- { 'issueId' : 6962694 }
- </call>
- </sequence>
- </if>
+ <!-- Import Example.ldif -->
+ <call function="'ImportLdifWithScript'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
+ 'append' : 'TRUE',
+ 'replaceExisting' : 'TRUE'
+ }
+ </call>
+
+ <call function="'checkImport'">
+ { 'dsBaseDN' : 'dc=example,dc=com',
+ 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
+ 'uid=fvinker,ou=Departed,ou=People,dc=example,dc=com',
+ 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'] ,
+ 'expectedNoEntries' : '163' ,
+ 'startDS' : 'no'
+ }
+ </call>
</sequence>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/backends/import/import_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/backends/import/import_tests.xml
index f5b3032..e9c3420 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/backends/import/import_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/backends/import/import_tests.xml
@@ -1130,26 +1130,31 @@
<sequence>
<call function="'testCase_Preamble'"/>
-
+
+ <!-- Import Example.ldif -->
<call function="'ImportLdifWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME,
- 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
- 'append' : 'TRUE',
- 'backEnd' : DIRECTORY_INSTANCE_BE
+ { 'ldifFile' : '%s/backends/Example.ldif' % remote.data,
+ 'backEnd' : DIRECTORY_INSTANCE_BE
+ }
+ </call>
+
+ <!-- Import Example.ldif -->
+ <call function="'ImportLdifWithScript'">
+ { 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
+ 'append' : 'TRUE',
+ 'backEnd' : DIRECTORY_INSTANCE_BE
}
</call>
<call function="'checkImport'">
- { 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
+ { 'dsBaseDN' : 'dc=example,dc=com',
+ 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
'uid=fvinker,ou=Departed,ou=People,dc=example,dc=com',
- 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com']
+ 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'] ,
+ 'expectedNoEntries' : '163'
}
</call>
- <call function="'setKnownIssue'">
- { 'issueId' : 6962694 }
- </call>
-
</sequence>
<catch exception="'STAXException.*'" typevar="eType" var="eInfo">
@@ -1187,28 +1192,32 @@
<sequence>
<call function="'testCase_Preamble'"/>
-
+
+ <!-- Import Example.ldif -->
<call function="'ImportLdifWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME,
- 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
- 'append' : 'TRUE',
- 'replaceExisting' : 'TRUE',
- 'backEnd' : DIRECTORY_INSTANCE_BE,
- 'knownIssue' : '6927338'
+ { 'ldifFile' : '%s/backends/Example.ldif' % remote.data,
+ 'backEnd' : DIRECTORY_INSTANCE_BE
+ }
+ </call>
+
+ <!-- Import Example.ldif -->
+ <call function="'ImportLdifWithScript'">
+ { 'ldifFile' : '%s/backends/Append.ldif' % remote.data,
+ 'append' : 'TRUE',
+ 'replaceExisting' : 'TRUE',
+ 'backEnd' : DIRECTORY_INSTANCE_BE
}
</call>
<call function="'checkImport'">
- { 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
+ { 'dsBaseDN' : 'dc=example,dc=com',
+ 'expectedEntries' : ['ou=Departed,ou=People,dc=example,dc=com',
'uid=fvinker,ou=Departed,ou=People,dc=example,dc=com',
- 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com']
+ 'uid=brammage,ou=Departed,ou=People,dc=example,dc=com'] ,
+ 'expectedNoEntries' : '163'
}
</call>
- <call function="'setKnownIssue'">
- { 'issueId' : 6962694 }
- </call>
-
</sequence>
<catch exception="'STAXException.*'" typevar="eType" var="eInfo">
diff --git a/opends/tests/staf-tests/shared/functions/dsadm.xml b/opends/tests/staf-tests/shared/functions/dsadm.xml
index 0f422af..b7f0aec 100755
--- a/opends/tests/staf-tests/shared/functions/dsadm.xml
+++ b/opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -1043,7 +1043,7 @@
</function>
<!-- Check Import Function -->
- <function name="checkImport">
+ <function name="checkImport" scope="local">
<function-prolog>
This function verifies an import of an ldif file
</function-prolog>
@@ -1104,6 +1104,12 @@
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
+ <function-arg-def name="dsBaseDN" type="optional">
+ <function-arg-description>
+ The baseDN for the search operation
+ </function-arg-description>
+ <function-arg-property name="type" value="dn"/>
+ </function-arg-def>
<function-arg-def name="expectedEntries" type="required">
<function-arg-description>
Entries expected to be present after import
@@ -1134,6 +1140,14 @@
</function-arg-description>
<function-arg-property name="type" value="list"/>
</function-arg-def>
+ <function-arg-def name="expectedNoEntries"
+ type="optional"
+ default="None">
+ <function-arg-description>
+ Optional no of entries expected after import
+ </function-arg-description>
+ <function-arg-property name="type" value="integer"/>
+ </function-arg-def>
<function-arg-def name="suffix"
type="optional"
default="DIRECTORY_INSTANCE_SFX">
@@ -1161,6 +1175,7 @@
myadminport=dsAdminPort
mydn=dsDn
mypswd=dsPswd
+ mybasedn=dsBaseDN
</script>
<!-- Assume that if DS is not started then there is no need to stop it -->
@@ -1194,27 +1209,53 @@
</sequence>
</if>
-
+
+ <!-- Count number of expected entries after import -->
+ <if expr="expectedNoEntries != None">
+
+ <sequence>
+ <message>'Expected number of entries is %s' % expectedNoEntries</message>
+
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstanceHost' : myhost ,
+ 'dsInstancePort' : myport ,
+ 'dsInstanceDn' : mydn ,
+ 'dsInstancePswd' : mypswd ,
+ 'dsBaseDN' : mybasedn ,
+ 'dsFilter' : 'objectclass=*',
+ 'dsAttributes' : 'dn',
+ 'dsCountEntries' : True
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'searchString'">
+ { 'expectedString' : 'Total number of matching entries: %s' % expectedNoEntries,
+ 'returnString' : returnString ,
+ 'expectedRC' : expectedRC ,
+ }
+ </call>
+
+ </sequence>
+ </if>
+
<!-- Search for expected entries -->
<iterate var="expectedEntry" in="expectedEntries">
<sequence>
- <call function="'SearchObject'">
- { 'location' : myLocation ,
- 'dsPath' : myPath,
- 'dsInstanceHost' : myhost ,
+ <call function="'ldapSearchWithScript'">
+ { 'dsInstanceHost' : myhost ,
'dsInstancePort' : myport ,
'dsInstanceDn' : mydn ,
'dsInstancePswd' : mypswd ,
'dsBaseDN' : '%s' % expectedEntry ,
'dsScope' : 'base' ,
'dsFilter' : 'objectclass=*',
- 'attributes' : 'dn'
+ 'dsAttributes' : 'dn'
}
</call>
- <call function="'checktestRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
- </call>
</sequence>
</iterate>
diff --git a/opends/tests/staf-tests/shared/functions/utils.xml b/opends/tests/staf-tests/shared/functions/utils.xml
index 5ec0b12..f0e831b 100755
--- a/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opends/tests/staf-tests/shared/functions/utils.xml
@@ -249,7 +249,7 @@
<!-- Search string -->
<function name="searchString" scope="local">
<function-prolog>
- This function search for a string in the retrun string of a testcase
+ This function search for a string in the return string of a testcase
Return 0 if the string is found, 1 otherwise
</function-prolog>
--
Gitblit v1.10.0