clu_rebuild-index_checkbehavior.xml revision 28eeffb99d4c7f8ff501c22d1d21501cbfe3ad32
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, exclude this CDDL HEADER in each
! file and exclude the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
! Portions Copyright 2008-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="clu_rebuild-index_checkbehavior"/>
<function name="clu_rebuild-index_checkbehavior">
<sequence>
<block name="'clu_rebuild-index_checkbehavior'">
<try>
<sequence>
<!--- Test Suite information
#@TestSuiteName rebuild-index check behavior tests
#@TestSuitePurpose Test the results of rebuild-index command.
#@TestSuiteGroup rebuild-index check behavior tests
#@TestScript clu_rebuild-index_checkbehavior.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'clu'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<call function="'common_setup'">
{
'quickStart' : False ,
'loadData' : True ,
'ldifFile' : '%s/clu/clu_start.ldif' % remote.data ,
'startServer' : True ,
'stopServer' : False ,
'allowPreEncodePassword' : True
}
</call>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: online mode
#@TestIssue none
#@TestPurpose Verify that online rebuild-index command
succeeds that the output is correct.
#@TestPreamble none
#@TestStep Do a online rebuild-index on a single index.
#@TestStep Check that the rebuild-index task is
completed successfuly.
#@TestPostamble none
#@TestResult Success if online rebuild-index return 0.
-->
<testcase name="getTestCaseName('rebuild-index: online')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: online'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'uid' ]
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: check on a single index
#@TestIssue none
#@TestPurpose Verify that rebuild-index without credential
command failed if the server is started and
successful otherwise and that the output is
correct.
#@TestPreamble none
#@TestStep Do a rebuild-index (without credential)
on a single index.
#@TestStep Check the output of the command.
#@TestStep Create a new index using dsconfig for the
other testcases.
#@TestStep Stop the server.
#@TestStep Do a rebuild-index (without credential)
on a single index.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 1 when the
server is running, 0 when the server is
stopped and the outputs are correct.
-->
<testcase name="getTestCaseName('rebuild-index: single index')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: try to rebuild a single index while the \
server is running'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'uid' ] ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'An error occurred while attempting to acquire a'
msg2 = 'exclusive lock for backend userRoot'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<message>
'rebuild-index: create a new index for the other testcases'
</message>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'create-local-db-index' ,
'objectType' : 'backend-name' ,
'objectName' : DIRECTORY_INSTANCE_BE ,
'optionsString' : '--index-name st --set index-type:equality'
}
</call>
<message>
'rebuild-index: stop the server'
</message>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<message>
'rebuild-index: rebuild a single index with the server stopped'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'uid' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Rebuild of index\(es\) uid started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'Rebuild complete. Processed 1048 entries'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: check without index option
#@TestIssue none
#@TestPurpose Verify that rebuild-index command failed
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index without index option.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 1 and the
output is correct.
-->
<testcase name="getTestCaseName('rebuild-index: without index')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: without index'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'At least one index must be specified'
msg2 = 'for the rebuild process'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: check on multiple indexes
#@TestIssue none
#@TestPurpose Verify that rebuild-index command is
successful and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index on multiple indexes.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 0 and the
output is correct.
-->
<testcase name="getTestCaseName('rebuild-index: multiple indexes')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: multiple indexes'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'uid', 'cn' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Rebuild of index\(es\) uid, cn started'
msg2 = 'with 1048 total entries to process'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'Rebuild complete. Processed 1048 entries'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: check on a non existing index
#@TestIssue none
#@TestPurpose Verify that rebuild-index command failed
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index on a non existing index.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 1 and the
output is correct.
-->
<testcase name="getTestCaseName('rebuild-index: non existing index')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: non existing index'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'myindex' ] ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'There is no index configured for'
msg2 = 'attribute type \'myindex\''
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: after creation
#@TestIssue none
#@TestPurpose Verify that rebuild-index command is
successfull on a newly created index
and that the output is correct.
#@TestPreamble none
#@TestStep Do a verifiy-index before rebuild on
the new index.
#@TestStep Check the output of the command.
#@TestStep Do a rebuild-index on the new index.
#@TestStep Check the output of the command.
#@TestStep Do a verify-index after rebuild on
the new index.
#@TestStep Check the output of the command.
#@TestStep Do again a rebuild-index on the new index.
#@TestStep Check the output of the command.
#@TestStep Re-start the server.
#@TestPostamble none
#@TestResult Success if all the commands return 0 and
the outputs are correct.
-->
<testcase name="getTestCaseName
('rebuild-index: rebuild index after creation')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: verify index st before rebuild'
</message>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'st' ] ,
'dsCountErrors' : 'TRUE'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_st is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Statistics for records that have'
msg2 = 'exceeded the entry limit:'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg1 = 'File dc_com_st.equality has 51 such record\(s\)'
msg2 = 'min=14 max=31 median=20'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<message>
'rebuild-index: rebuild index st'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'st' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_st is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Rebuild of index\(es\) st started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<message>
'rebuild-index: verify index st after rebuild'
</message>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'st' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_st is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'checktestStringNotPresent'">
{
'returnString' : returnString ,
'testString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg = 'Checked 1048 entries and found 0 error'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<message>
'rebuild-index: rebuild again index st'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'st' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_st is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'checktestStringNotPresent'">
{
'returnString' : returnString ,
'testString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Rebuild of index\(es\) st started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: rebuild option
#@TestIssue none
#@TestPurpose Verify that rebuild-index command succeeds
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index on a non existing index.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 0 and the
output is correct.
-->
<testcase name="getTestCaseName
('rebuild-index: rebuildAll option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: rebuildAll'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsRebuildAll' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: rebuildAll and i options
#@TestIssue none
#@TestPurpose Verify that rebuild-index command failed
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index with rebuildAll
and i options.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 1 and the
output is correct.
-->
<testcase name="getTestCaseName
('rebuild-index: rebuildAll and i option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: rebuildAll and i'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsRebuildAll' : 'True' ,
'dsIndexList' : [ 'uid' ] ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Index \"-i\" option cannot be specified with'
msg2 = 'the \"--rebuildAll\" option'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: tmpdirectory option
#@TestIssue none
#@TestPurpose Verify that rebuild-index command succeeds
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index with tmpdirectory option.
#@TestStep Check the output of the command.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 0 and the
output is correct.
-->
<testcase name="getTestCaseName
('rebuild-index: tmpdirectory option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'rebuild-index: tmpdirectory'
</message>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsIndexList' : [ 'uid' ] ,
'dsTmpDir' : '%s/index_tmp' % DIRECTORY_INSTANCE_DIR
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global CLU Cleanup.'</message>
<try>
<call function="'common_cleanup'" />
<catch exception="'STAFException'">
<sequence>
<message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
</sequence>
</catch>
<finally>
<call function="'testSuite_Postamble'"/>
</finally>
</try>
</sequence>
</finally>
</try>
</block>
</sequence>
</function>
</stax>