1N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
1N/A ! The contents of this file are subject to the terms of the 1N/A ! Common Development and Distribution License, Version 1.0 only 1N/A ! (the "License"). You may not use this file except in compliance 1N/A ! You can obtain a copy of the license at 1N/A ! See the License for the specific language governing permissions 1N/A ! and limitations under the License. 1N/A ! When distributing Covered Code, include this CDDL HEADER in each 1N/A ! file and include the License file at ! 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] ! Copyright 2007-2008 Sun Microsystems, Inc. <
defaultcall function="main_indexes" />
<
function name="main_indexes">
<
function-
required-
arg name="STAXParentID"/>
<!--- Load the job environment for the test group execution --> <
import machine="STAF_LOCAL_HOSTNAME" <
call function="'loadJobEnvironment'">
{ 'parent' : STAXParentID }
CurrentTestPath={'group':'indexes','suite':'indexes'}
_setupSteps=['testGroup_Preamble','testSuite_Preamble',
_testSteps=['indexes_search', 'indexes_dynamic_modify',
'indexes_dynamic_add', 'indexes_remove', 'indexes_add']
_cleanupSteps=['indexes_cleanup','testSuite_Postamble',
#@TestSuitePurpose test the database index feature from ldap <!-- the pre-requisites are in a separate iteration --> <
iterate in="_setupSteps" var="_setupStep">
<
call function="_setupStep" />
<
iterate in="_testSteps" var="_testStep" indexvar="_testStepNumber">
<
call function="_testStep" />
<
message log="1" level="'fatal'">
'Could not create the topology. Bailing out.'
<
message log="1" level="'fatal'">
<
iterate in="_cleanupSteps" var="_cleanupStep">
<
call function="_cleanupStep" />
<
function name="indexes_search" scope="local">
This set of tests loop through a set of search filters to verify that the default indexes behave as expected #@TestName indexes_search #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose harden the default indexes #@TestResult Success if entry are indexed correctly <
message log="1" level="'info'">
'starting the search tests'
<
call function="'loopThroughFilters'">
<
function name="indexes_modify" scope="local">
This test alters the uid default index so that it does subString search and then verifies that it worked #@TestName indexes_search #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose harden the default indexes #@TestResult Success if entry are indexed correctly <
call function="'loopThroughFilters'">
{ 'filters' : 'before-modify' }
<
call function="'runFunction'">
{ 'functionName' : 'modifyIndex',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionMessage' : 'Adding substring index to attribute uid',
'functionArguments' : { 'operation' : 'add',
'indexAttribute' : 'uid',
'indexProperty' : 'index-type',
'indexPropertyValue' : 'substring'
<
call function="'runFunction'">
{ 'functionName' : 'StopDsWithScript',
'functionFailureTC' : 'Indexes - Modify' ,
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
'dsHost' : DIRECTORY_INSTANCE_HOST,
'dsPort' : DIRECTORY_INSTANCE_PORT,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
<
call function="'runFunction'">
{ 'functionName' : 'CLI_rebuild-index' ,
'functionFailureTC' : 'Indexes - Modify' ,
'functionArguments' : { 'baseDN' : DIRECTORY_INSTANCE_SFX ,
<
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript',
'functionFailureTC' : 'Indexes - Modify' ,
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-modify' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to alter index for attribute uid'
<
message log="1" level="'fatal'">
'Fatal Error: Failed to rebuild index for attribute uid'
<
function name="indexes_dynamic_modify" scope="local">
This test alters dynamically the uid default index so that it does subString search and then verifies that it worked #@TestName indexes_dynamic_modify #@TestPurpose harden the default indexes #@TestResult Success if entry are indexed correctly <
call function="'loopThroughFilters'">
{ 'filters' : 'before-modify' }
<
call function="'runFunction'">
{ 'functionName' : 'modifyIndex',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionMessage' : 'Adding substring index to attribute uid',
'functionArguments' : { 'operation' : 'add',
'indexAttribute' : 'uid',
'indexProperty' : 'index-type',
'indexPropertyValue' : 'substring'
<
call function="'runFunction'">
{ 'functionName' : 'rebuildIndexTask' ,
'functionFailureTC' : 'Indexes - Dynamic Modify' ,
{ 'location' : STAF_REMOTE_HOSTNAME,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'taskID' : 'rebuild uid index task',
'baseDN' : DIRECTORY_INSTANCE_SFX ,
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-modify' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to alter index for attribute uid'
<
message log="1" level="'fatal'">
'Fatal Error: Failed to rebuild index for attribute uid'
<
function name="indexes_add" scope="local">
This test adds a new presence and equality index for l attribute and then verifies that it worked #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose check if the user can add her own indexes #@TestStep iterate through filters prior to adding indexes #@TestStep add the indexes #@TestStep iterate through filters after to adding indexes #@TestResult Success if entry are indexed correctly <
call function="'loopThroughFilters'">
{ 'filters' : 'before-add' }
<
call function="'runFunction'">
{ 'functionName' : 'addIndex',
'functionFailureTC' : 'Indexes - Add',
'functionMessage' : 'Adding presence and equality index to \
'functionArguments' : { 'indexAttribute' : 'l',
'indexTypes' : [ 'presence',
<
call function="'runFunction'">
{ 'functionName' : 'StopDsWithScript',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
'dsHost' : DIRECTORY_INSTANCE_HOST,
'dsPort' : DIRECTORY_INSTANCE_PORT,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'runFunction'">
{ 'functionName' : 'CLI_rebuild-index' ,
'functionFailureTC' : 'Indexes - Modify' ,
'functionArguments' : { 'baseDN' : DIRECTORY_INSTANCE_SFX ,
<
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript',
'functionFailureTC' : '%s: %s: ' ,
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-add' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to add index for attribute l'
<
message log="1" level="'fatal'">
'Fatal Error: Failed to rebuild index for attribute l'
<
function name="indexes_dynamic_add" scope="local">
This test adds dynamically a new presence and equality index for l attribute and then verifies that it worked #@TestName indexes_dynamic_add #@TestPurpose check if the user can add her own indexes #@TestStep iterate through filters prior to adding indexes #@TestStep add the indexes #@TestStep iterate through filters after to adding indexes #@TestResult Success if entry are indexed correctly <
call function="'loopThroughFilters'">
{ 'filters' : 'before-add' }
<
call function="'runFunction'">
{ 'functionName' : 'addIndex',
'functionFailureTC' : 'Indexes - Add',
'functionMessage' : 'Adding presence and equality index to \
'functionArguments' : { 'indexAttribute' : 'l',
'indexTypes' : [ 'presence',
<
call function="'runFunction'">
{ 'functionName' : 'rebuildIndexTask' ,
'functionFailureTC' : 'Indexes - Dynamic Add' ,
{ 'location' : STAF_REMOTE_HOSTNAME,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'taskID' : 'rebuild l index task',
'baseDN' : DIRECTORY_INSTANCE_SFX ,
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-add' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to add index for attribute l'
<
message log="1" level="'fatal'">
'Fatal Error: Failed to rebuild index for attribute l'
<
function name="indexes_remove" scope="local">
This test does a bunch of searches on the and then verifies that it worked #@TestName indexes_remove #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose Check if the user can remove indexes #@TestStep iterate through filters prior to removing index #@TestStep iterate through filters after to removing index #@TestResult Success if entry are indexed as expected <
call function="'loopThroughFilters'">
{ 'filters' : 'before-remove' }
<
call function="'runFunction'">
{ 'functionName' : 'removeIndex',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionMessage' : 'Removing index on attribute l' ,
'functionArguments' : { 'indexAttribute' : 'l' }
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-remove' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to remove index for attribute l'
<
function name="indexes_entry_limit">
This test does a bunch of searches on the and then verifies that it worked #@TestName indexes_remove #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose Check if the user can remove indexes #@TestStep iterate through filters prior to removing index #@TestStep iterate through filters after to removing index #@TestResult Success if entry are indexed as expected <
block name="'Entry_Limit'">
<
call function="'loopThroughFilters'">
{ 'filters' : 'before-entry-limit' }
<
call function="'runFunction'">
{ 'functionName' : 'modifyIndex',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionMessage' : 'Modify index entry limit on attribute \
'functionArguments' : { 'operation' : 'set',
'indexAttribute' : 'uid',
'indexProperty' : 'index-entry-limit',
'indexPropertyValue' : '3'
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-entry-limit' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to remove index for attribute l'
<
function name="indexes_vlv_add">
This test does a bunch of searches on the and then verifies that it worked #@TestName indexes_vlv_add #@TestIssue TODO: look up the issue in issue tracker #@TestPurpose Check if the user can remove indexes #@TestStep iterate through filters prior to removing index #@TestStep iterate through filters after to removing index #@TestResult Success if entry are indexed as expected <
block name="'Entry_Limit'">
<
call function="'loopThroughFilters'">
{ 'filters' : 'before-entry-limit' }
<
call function="'runFunction'">
{ 'functionName' : 'modifyIndex',
'functionFailureTC' : '%s: %s: %s' % (CurrentTestPath['group'],
CurrentTestPath['suite'],
'functionMessage' : 'Modify index entry limit on attribute \
'functionArguments' : { 'operation' : 'set',
'indexAttribute' : 'uid',
'indexProperty' : 'index-entry-limit' ,
'indexPropertyValue' : '3'
<
call function="'loopThroughFilters'">
{ 'filters' : 'after-entry-limit' }
<
message log="1" level="'fatal'">
'Fatal Error: Failed to remove index for attribute l'
<
function name="loopThroughFilters" scope="local">
<
function-
arg-
def name="filters" type="required" />
"Describes an index test with indexed attribute, filter to test with \
def __init__(self, attribute,testName,filter,expectedValue,isIndexed):
def getSearchString(self):
description = 'test:: name=[%s]\n' %
self.name description += 'test:: rc=[%s]\n' %
self.rc testLine[3], testLine[4]))
<
iterate var="test" in="indexTests">
indexTestNumber=indexTestNumber+1
<
testcase name="'%s: %d.%s: %03d-%03d.%s: %s%02d' % ( CurrentTestPath['group'], len(_testSteps)-_testStepNumber, filters, len(indexTests)-indexTestNumber, indexTestNumber, <
call function="'testCase_Preamble'" />
<
message log="1" level="'trace'">
'Searching attribute [%s] with filter[%s]' \
<
call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsBaseDN' : 'ou=People,dc=example,%s' \
% DIRECTORY_INSTANCE_SFX ,
'attributes' : 'debugsearchindex',
searchReturnCode, searchResultString = STAXResult[0]
# chop off the first line that contains the dn
searchResultString =
re.compile(r'^dn:.*\n?').sub('',
# join multiple lines into a single one
searchResultString =
re.compile(r'[ \t]*\r?\n[ \t]*').sub('',
if (str(searchReturnCode) == str(
test.getRC())) and \
<
message level="'trace'">
'%s\nsearchReturnCode=[%s]\nldapsearch return \
string=[%s]\nchunk to parse=[%s]\nstring looked for=[%s]' \
% (
test.desc(), searchReturnCode, searchResultString, srt,
<
call function="'testCase_Postamble'" />
<!-- Setup the instance for indexes tests --> <
function name="indexes_setup">
<
call function="'runFunction'">
{ 'functionName' : 'createTopology',
'functionMessage' : 'Create DS topology as described in
config.py',
'functionArguments' : { 'initialiseInstance' : True }
<
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript' ,
'functionMessage' : 'Start DS to run on port %s' \
% (DIRECTORY_INSTANCE_PORT) ,
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME }
<
call function="'runFunction'">
{ 'functionName' : 'isAlive',
'functionMessage' : 'Checking if the server is available',
'functionArguments' : { 'noOfLoops' : 5,
'noOfMilliSeconds' : 2000
<!-- cleanup after the tests --> <
function name="indexes_cleanup">
<
call function="'runFunction'">
{ 'functionName' : 'StopDsWithScript' ,
'functionMessage' : 'Stop DS running on port %s' \
% (DIRECTORY_INSTANCE_PORT),
'functionArguments' : { 'location' : STAF_REMOTE_HOSTNAME,
'dsHost' : DIRECTORY_INSTANCE_HOST,
'dsPort' : DIRECTORY_INSTANCE_PORT,
'dsBindDN' : DIRECTORY_INSTANCE_DN,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
<
call function="'runFunction'">
{ 'functionName' : 'removeTopology',
'functionMessage' : 'Remove DS topology created for the Test Suite'