<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! 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
! 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-2010 Sun Microsystems, Inc.
! Portions Copyright 2012-2013 ForgeRock AS
! -->
<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 ,
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<message>
'rebuild-index: create a new index st 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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'searchString'">
{
'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="'searchString'">
{
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<call function="'searchString'">
{
'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="'searchString'">
{
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</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="'searchString'">
{
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<script>
msg = 'Checked 1048 entries and found 0 error'
</script>
<call function="'searchString'">
{
'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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<script>
msg1 = 'Rebuild of index\(es\) st started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'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>
msg1 = 'Rebuild of all indexes started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'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="'searchString'">
{
'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' ] ,
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: clearDegradedState option in
offline mode
#@TestIssue none
#@TestPurpose Verify that rebuild-index command succeeds
and that the output is correct.
#@TestPreamble none
#@TestStep Create two new indexes using dsconfig.
#@TestStep Check index status using dbtest command.
#@TestStep Do a verify-index before rebuild.
#@TestStep Do a rebuild-index with clearDegradedState
option in offline mode.
#@TestStep Check the output of the command.
#@TestStep Check index status using dbtest command.
#@TestStep Do a verify-index after rebuild.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 0 and the
output is correct.
-->
<testcase name="getTestCaseName
('rebuild-index: clearDegradedState option in offline mode')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index l' }
</call>
<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 l --set index-type:equality'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index homePhone' }
</call>
<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 homePhone --set index-type:equality'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Check indexes status using dbtest command before rebuild' }
</call>
<call function="'dbtestWithScript'">
{
'subcommand' : 'list-index-status' ,
'dsBaseDN' : 'dc=com' ,
'dsBackendID' : DIRECTORY_INSTANCE_BE
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'l\.equality\\s+Index\\s+dc_com_l\.equality\\s+false\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<script>
msg = 'homePhone\.equality\\s+Index\\s+dc_com_homePhone\.equality\\s+false\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes before rebuild' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_l is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_homePhone is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 0 error'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Stop the server' }
</call>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Clear degraded state for indexes l and homePhone' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsClearDegradedState' : 'True' ,
'dsIndexList' : [ 'l', 'homePhone' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Degraded state of index\(es\) \[l, homePhone\] has been cleared'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the server' }
</call>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Check index status using dbtest command after rebuild' }
</call>
<call function="'dbtestWithScript'">
{
'subcommand' : 'list-index-status' ,
'dsBaseDN' : 'dc=com' ,
'dsBackendID' : DIRECTORY_INSTANCE_BE
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'l\.equality\\s+Index\\s+dc_com_l\.equality\\s+true\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<script>
msg = 'homePhone\.equality\\s+Index\\s+dc_com_homePhone\.equality\\s+true\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes after rebuild' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_l is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_homePhone is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<!-- 1040 errors for index l
1040 errors for index homePhone -->
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 2080 error'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Stop the server' }
</call>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Rebuild all the indexes in offline mode' }
</call>
<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="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the server' }
</call>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes after rebuildAll' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 0 error'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: clearDegradedState option in
online mode
#@TestIssue none
#@TestPurpose Verify that rebuild-index command succeeds
and that the output is correct.
#@TestPreamble none
#@TestStep Create a new index using dsconfig.
#@TestStep Check index status using dbtest command.
#@TestStep Do a verify-index before rebuild.
#@TestStep Do a rebuild-index with clearDegradedState
option in offline mode.
#@TestStep Check the output of the command.
#@TestStep Check index status using dbtest command.
#@TestStep Do a verify-index after rebuild.
#@TestPostamble none
#@TestResult Success if rebuild-index returns 0 and the
output is correct.
-->
<testcase name="getTestCaseName
('rebuild-index: clearDegradedState option in online mode')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index pager' }
</call>
<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 pager --set index-type:equality'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Check index status using dbtest command before rebuild' }
</call>
<call function="'dbtestWithScript'">
{
'subcommand' : 'list-index-status' ,
'dsBaseDN' : 'dc=com' ,
'dsBackendID' : DIRECTORY_INSTANCE_BE
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'pager\.equality\\s+Index\\s+dc_com_pager\.equality\\s+false\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_pager is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 0 error'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Clear degraded state for index pager' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsClearDegradedState' : 'True' ,
'dsIndexList' : [ 'pager' ]
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Degraded state of index\(es\) \[pager\] has been cleared'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<script>
msg = 'The backend userRoot is now taken offline'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg ,
'expectedRC' : 1
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Check index status using dbtest command after rebuild' }
</call>
<call function="'dbtestWithScript'">
{
'subcommand' : 'list-index-status' ,
'dsBaseDN' : 'dc=com' ,
'dsBackendID' : DIRECTORY_INSTANCE_BE
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'pager\.equality\\s+Index\\s+dc_com_pager\.equality\\s+true\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes after rebuild' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_pager is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<!-- 1040 errors for index pager -->
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 1040 error'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Rebuild al the indexes in online mode' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsRebuildAll' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes after rebuildAll' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 0 error'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: clearDegradedState and
rebuildAll options
#@TestIssue none
#@TestPurpose Verify that rebuild-index command failed
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index with clearDegradedState
and rebuildAll 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: clearDegradedState and rebuildAll options')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Run rebuild-index with clearDegradedState and rebuildAll options' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsClearDegradedState' : 'True' ,
'dsRebuildAll' : 'True' ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check rebuild-index output' }
</call>
<script>
msg1 = 'Option \"--rebuildAll\" cannot be specified with'
msg2 = 'the \"--clearDegradedState\"%soption' % newLine
</script>
<call function="'searchString'">
{
'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: clearDegradedState and
rebuildDegraded options
#@TestIssue none
#@TestPurpose Verify that rebuild-index command failed
and that the output is correct.
#@TestPreamble none
#@TestStep Do a rebuild-index with rclearDegradedState
and rebuildDegraded 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: clearDegradedState and rebuildDegraded options')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Run rebuild-index with clearDegradedState and rebuildDegraded options' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsClearDegradedState' : 'True' ,
'dsRebuildDegraded' : 'True' ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check rebuild-index output' }
</call>
<script>
msg1 = 'Option \"--rebuildDegraded\" cannot be specified with'
msg2 = 'the \"--clearDegradedState\"%soption' % newLine
</script>
<call function="'searchString'">
{
'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: rebuildDegraded option
#@TestIssue none
#@TestPurpose Verify that rebuild-index command succeeds
that the output is correct.
#@TestPreamble none
#@TestStep Create two new indexes using dsconfig, these
indexes are in degraded state.
#@TestStep Do a rebuild-index with rebuildDegraded
option.
#@TestStep Check the output of the command.
#@TestStep Do a verify-index after rebuild.
#@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: rebuildDegraded option')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index street' }
</call>
<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 street --set index-type:equality'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index postalCode' }
</call>
<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 postalCode --set index-type:equality'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Create a new index postalAddress' }
</call>
<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 postalAddress --set index-type:equality'
}
</call>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Clear degraded state for index postalAddress' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsBaseDN' : 'dc=com' ,
'dsClearDegradedState' : 'True' ,
'dsIndexList' : [ 'postalAddress' ]
}
</call>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_street is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_postalCode is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3)
}
</call>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_postalAddress is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<!-- 1040 errors for index postalAddress -->
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 1040 error'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run rebuild-index with rebuildDegraded option' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsRebuildDegraded' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check rebuild-index output' }
</call>
<script>
msg1 = 'Rebuild of all degraded indexes started with 1048'
msg2 = 'total entries to process'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</call>
<script>
msg = 'Rebuild complete. Processed 1048 entries'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Check indexes status using dbtest command after rebuild' }
</call>
<call function="'dbtestWithScript'">
{
'subcommand' : 'list-index-status' ,
'dsBaseDN' : 'dc=com' ,
'dsBackendID' : DIRECTORY_INSTANCE_BE
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg = 'street\.equality\\s+Index\\s+dc_com_street\.equality\\s+true\\s+1040'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<script>
msg = 'postalCode\.equality\\s+Index\\s+dc_com_postalCode\.equality\\s+true\\s+1037'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<script>
msg = 'postalAddress\.equality\\s+Index\\s+dc_com_postalAddress\.equality\\s+true\\s+0'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Run verify-index to verify the indexes after rebuild' }
</call>
<call function="'verifyIndexWithScript'">
{
'dsBaseDN' : 'dc=com'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_street is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<script>
msg1 = 'Due to changes in the configuration, index'
msg2 = 'dc_com_postalCode is currently operating in a degraded'
msg3 = 'state and must be rebuilt before it can be used'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s %s' % (msg1, msg2, msg3) ,
'expectedRC' : 1
}
</call>
<!-- 1040 errors for index postalAddress -->
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : 'Checked 1048 entries and found 1040 error'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker rebuild-index check behavior tests
#@TestName rebuild-index: rebuildDegraded 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 rebuildDegraded
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: rebuildDegraded and i options')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Run rebuild-index with rebuildDegraded and i options' }
</call>
<call function="'rebuildIndexWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'dc=com' ,
'dsRebuildDegraded' : 'True' ,
'dsIndexList' : [ 'uid' ] ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check rebuild-index output' }
</call>
<script>
msg1 = 'Option \"--rebuildDegraded\" cannot be specified'
msg2 = 'with the \"--index\" option'
</script>
<call function="'searchString'">
{
'returnString' : returnString ,
'expectedString' : '%s %s' % (msg1, msg2)
}
</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>