From ffb90539ab2527ab4063edcff0a69ef1bbde41d5 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Fri, 13 Dec 2013 14:46:45 +0000
Subject: [PATCH] Add capability for debugging tests
---
opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover_tests.xml | 23 +++++++----
opends/tests/staf-tests/shared/topology/basic_topology.txt | 3 +
opends/tests/staf-tests/shared/tests/config.py.stubs | 1
opends/tests/staf-tests/shared/functions/tools.xml | 10 +++--
opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate_tests.xml | 12 +++--
opends/tests/staf-tests/shared/functions/topology.xml | 8 +++-
opends/tests/staf-tests/shared/topology/3server_topology.txt | 4 ++
opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog_consistency/externalchangelog_consistency_tests.xml | 5 +-
opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml | 2
opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_consistency_tests.xml | 5 +-
opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_common_ecl_tests.xml | 5 +-
opends/tests/staf-tests/shared/ant/build.properties | 3 +
opends/tests/staf-tests/shared/python/replication.py | 11 ++++-
opends/tests/staf-tests/shared/functions/dsadm.xml | 17 ++++++++
14 files changed, 77 insertions(+), 32 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_common_ecl_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_common_ecl_tests.xml
index f136145..1cba164 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_common_ecl_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_common_ecl_tests.xml
@@ -106,8 +106,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_consistency_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_consistency_tests.xml
index 68d1a34..539ac5e 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_consistency_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog/externalchangelog_consistency_tests.xml
@@ -93,8 +93,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog_consistency/externalchangelog_consistency_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog_consistency/externalchangelog_consistency_tests.xml
index 182a978..8b0137f 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog_consistency/externalchangelog_consistency_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/externalchangelog_consistency/externalchangelog_consistency_tests.xml
@@ -93,8 +93,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover_tests.xml
index 6de3dc2..19c7bf9 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover_tests.xml
@@ -23,7 +23,7 @@
! CDDL HEADER END
!
! Copyright 2007-2010 Sun Microsystems, Inc.
- ! Portions Copyright 2011-2012 ForgeRock AS.
+ ! Portions Copyright 2011-2013 ForgeRock AS.
! -->
<stax>
@@ -82,8 +82,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
@@ -226,14 +227,16 @@
<!-- Start the server again -->
<call function="'StartDsWithScript'">
- { 'location' : server.getHostname(),
- 'dsPath' : serverPath
+ { 'location' : server.getHostname(),
+ 'dsPath' : serverPath,
+ 'dsDebugPort' : server.getDebugPort()
}
</call>
<if expr="globalSplitServers">
<call function="'StartDsWithScript'">
{ 'location' : replServer.getHostname(),
- 'dsPath' : replServerPath
+ 'dsPath' : replServerPath,
+ 'dsDebugPort' : replServer.getDebugPort()
}
</call>
</if>
@@ -451,14 +454,16 @@
<!-- Start the server again -->
<call function="'StartDsWithScript'">
- { 'location' : server.getHostname(),
- 'dsPath' : serverPath
+ { 'location' : server.getHostname(),
+ 'dsPath' : serverPath,
+ 'dsDebugPort' : server.getDebugPort()
}
</call>
<if expr="globalSplitServers">
<call function="'StartDsWithScript'">
{ 'location' : replServer.getHostname(),
- 'dsPath' : replServerPath
+ 'dsPath' : replServerPath,
+ 'dsDebugPort' : replServer.getDebugPort()
}
</call>
</if>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
index 1b76901..6dcb765 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/replication.xml
@@ -61,9 +61,9 @@
suiteList.append('encryption')
suiteList.append('changelog')
suiteList.append('conflict')
+ suiteList.append('aci')
suiteList.append('externalchangelog')
suiteList.append('externalchangelog_consistency')
- suiteList.append('aci')
globalAssuredReplication = None
diff --git a/opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate_tests.xml
index 8609d82..d729920 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate_tests.xml
@@ -23,7 +23,7 @@
! CDDL HEADER END
!
! Copyright 2007-2010 Sun Microsystems, Inc.
- ! Portions Copyright 2012 ForgeRock AS.
+ ! Portions Copyright 2012-2013 ForgeRock AS.
! -->
<stax>
@@ -86,8 +86,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
@@ -447,8 +448,9 @@
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
- { 'location' : masterHost,
- 'dsPath' : masterPath
+ { 'location' : masterHost,
+ 'dsPath' : masterPath,
+ 'dsDebugPort' : master.getDebugPort()
}
</call>
diff --git a/opends/tests/staf-tests/shared/ant/build.properties b/opends/tests/staf-tests/shared/ant/build.properties
index 4ff73e3..fcf3103 100644
--- a/opends/tests/staf-tests/shared/ant/build.properties
+++ b/opends/tests/staf-tests/shared/ant/build.properties
@@ -112,9 +112,10 @@
sdk.dir=
temp.dir=/tmp
test.plan.custom=
-test.plan.functional.default=aci,backends,clu,clu_secure,core,dsconfig,dsml,fractional-replication,groups,i18n,indexes,logging,monitoring,password_policy,plugins,privileges,pta,replication,schema,security,setup,snmp,tasks,virtualAttributes,replication-safe-data,replication-safe-read
+test.plan.functional.default=aci,backends,clu,clu_secure,connection_handlers,core,dsconfig,dsml,fractional-replication,groups,i18n,indexes,logging,monitoring,password_policy,plugins,privileges,pta,replication,schema,security,setup,snmp,tasks,virtualAttributes,replication-safe-data,replication-safe-read
test.plan.stress.default=import_ldif,operations,replication
verbose.mode=false
+debug.port=
product.name=OpenDJ
logs.uri=file://
diff --git a/opends/tests/staf-tests/shared/functions/dsadm.xml b/opends/tests/staf-tests/shared/functions/dsadm.xml
index e568324..90839e2 100755
--- a/opends/tests/staf-tests/shared/functions/dsadm.xml
+++ b/opends/tests/staf-tests/shared/functions/dsadm.xml
@@ -589,6 +589,12 @@
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
+ <function-arg-def name="dsDebugPort" type="optional" default="DEBUG_PORT">
+ <function-arg-description>
+ Directory Server debug port
+ </function-arg-description>
+ <function-arg-property name="type" value="Port number"/>
+ </function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0.
@@ -710,6 +716,14 @@
</sequence>
</if>
+ <message>'DEBUG PORT: %s' % dsDebugPort</message>
+
+ <script>
+ if dsDebugPort != '' and STAFCmdParams == '':
+ envCmd = [ 'OPENDJ_JAVA_ARGS=-agentlib:jdwp=transport=dt_socket,address=%s,server=y,suspend=y' % dsDebugPort ]
+ else:
+ envCmd = []
+ </script>
<call function="'runCommand'">
{ 'location' : location,
@@ -717,7 +731,8 @@
'arguments' : STAFCmdParams,
'location' : location,
'expectedRC': expectedRC,
- 'knownIssue': knownIssue
+ 'knownIssue': knownIssue,
+ 'envCmd' : envCmd
}
</call>
<return>STAXResult</return>
diff --git a/opends/tests/staf-tests/shared/functions/tools.xml b/opends/tests/staf-tests/shared/functions/tools.xml
index 39b80e9..6fd37a4 100755
--- a/opends/tests/staf-tests/shared/functions/tools.xml
+++ b/opends/tests/staf-tests/shared/functions/tools.xml
@@ -1079,8 +1079,9 @@
<!--- Start DS -->
<call function="'StartDsWithScript'">
- { 'location' : server.getHostname(),
- 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
+ { 'location' : server.getHostname(),
+ 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
+ 'dsDebugPort' : server.getDebugPort()
}
</call>
@@ -1110,8 +1111,9 @@
<!--- Start DS -->
<call function="'StartDsWithScript'">
- { 'location' : server.getHostname(),
- 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
+ { 'location' : server.getHostname(),
+ 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
+ 'dsDebugPort' : server.getDebugPort()
}
</call>
diff --git a/opends/tests/staf-tests/shared/functions/topology.xml b/opends/tests/staf-tests/shared/functions/topology.xml
index 9e5a67d..4d0c725 100755
--- a/opends/tests/staf-tests/shared/functions/topology.xml
+++ b/opends/tests/staf-tests/shared/functions/topology.xml
@@ -1492,6 +1492,7 @@
rootPwd = None
baseDn = None
changelogport = None
+ debugPort = None
suffixList = []
changelogList = []
serverId = 1
@@ -1521,13 +1522,15 @@
baseDn = line[line.find('BaseDn') + 7:].strip()
elif line.find('Changelogport') != -1:
changelogport = line[line.find('Changelogport') + 14:].strip()
+ elif line.find('Debugport') != -1:
+ debugPort = line[line.find('Debugport') + 10:].strip()
elif line.find('SynchronizedSuffix') != -1:
suffixList.append( line[line.find('SynchronizedSuffix') + 19:].strip() )
elif line.find('ChangelogServer') != -1:
changelogList.append( line[line.find('ChangelogServer') + 16:].strip() )
elif (line.isspace()) or (len(line) == 0):
server = Server(hostname, dir, port, adminport, sslport, jmxport,
- rootDn, rootPwd, baseDn, remote.data)
+ rootDn, rootPwd, baseDn, debugPort, remote.data)
if changelogport != None:
changelogServer = ChangelogServer(changelogport, serverId)
@@ -1557,13 +1560,14 @@
rootPwd = None
baseDn = None
changelogport = None
+ debugPort = None
suffixList = []
changelogList = []
serverId += 1
if hostname != None:
server = Server(hostname, dir, port, adminport, sslport, jmxport,
- rootDn, rootPwd, baseDn, remote.data)
+ rootDn, rootPwd, baseDn, debugPort, remote.data)
if changelogport != None:
changelogServer = ChangelogServer(changelogport, serverId)
diff --git a/opends/tests/staf-tests/shared/python/replication.py b/opends/tests/staf-tests/shared/python/replication.py
index 64a72a2..1a4e4dc 100644
--- a/opends/tests/staf-tests/shared/python/replication.py
+++ b/opends/tests/staf-tests/shared/python/replication.py
@@ -76,7 +76,7 @@
# Define Server class
class Server:
- def __init__(self, hostname, dir, port, adminPort, sslPort, jmxPort, rootDn, rootPwd, baseDn, datadir):
+ def __init__(self, hostname, dir, port, adminPort, sslPort, jmxPort, rootDn, rootPwd, baseDn, debugPort, datadir):
self.hostname = hostname
self.dir = dir
self.temp = '%s/temp' % dir
@@ -92,6 +92,7 @@
self.rootPwd = rootPwd
self.baseDn = baseDn
self.changelogServer = None
+ self.debugPort = debugPort
self.synchronizedSuffixList = []
def __repr__(self):
@@ -139,6 +140,9 @@
def getChangelogServer(self):
return self.changelogServer
+ def getDebugPort(self):
+ return self.debugPort
+
def getSynchronizedSuffixList(self):
return self.synchronizedSuffixList
@@ -161,11 +165,12 @@
new_rootDn = self.rootDn
new_rootPwd = self.rootPwd
new_baseDn = self.baseDn
- new_changelogServer = self.changelogServer
+ new_changelogServer = self.changelogServer
+ new_debugPort = self.debugPort
self.changelogServer = None
replServer = Server(new_hostname, new_dir, new_port, new_adminPort, new_sslPort,
- new_jmxPort, new_rootDn, new_rootPwd, new_baseDn, self.data)
+ new_jmxPort, new_rootDn, new_rootPwd, new_baseDn, self.debugPort, self.data)
replServer.addChangelogServer(new_changelogServer)
return replServer
diff --git a/opends/tests/staf-tests/shared/tests/config.py.stubs b/opends/tests/staf-tests/shared/tests/config.py.stubs
index cd13c56..6f59236 100644
--- a/opends/tests/staf-tests/shared/tests/config.py.stubs
+++ b/opends/tests/staf-tests/shared/tests/config.py.stubs
@@ -82,6 +82,7 @@
SNMP_OPENDMK_JARFILE = '${snmp.opendmk.lib.dir}/jdmkrt.jar'
SNMP_PORT = '8085'
SNMP_TRAP_PORT = '8086'
+DEBUG_PORT = '${debug.port}'
LDCLT_DIR = '${ldclt.dir}'
VERBOSE_MODE = '${verbose.mode}'
TEST_PLAN_CUSTOM = '${test.plan.custom}'
diff --git a/opends/tests/staf-tests/shared/topology/3server_topology.txt b/opends/tests/staf-tests/shared/topology/3server_topology.txt
index bc2c6c8..5ab35a0 100644
--- a/opends/tests/staf-tests/shared/topology/3server_topology.txt
+++ b/opends/tests/staf-tests/shared/topology/3server_topology.txt
@@ -21,6 +21,7 @@
#
#
# Copyright 2007-2009 Sun Microsystems, Inc.
+# Portions Copyright 2013 Forgerock AS
#
Hostname: ${remote.hostname}
Directory: ${tests.tmp.dir}/opends-synchro-tests/server1
@@ -32,6 +33,7 @@
RootPwd: secret12
BaseDn: o=example
Changelogport: 11112
+#Debugport: 8081
SynchronizedSuffix: o=example
ChangelogServer: ${remote.hostname}:11112
ChangelogServer: ${remote.hostname}:22222
@@ -47,6 +49,7 @@
RootPwd: secret12
BaseDn: o=example
Changelogport: 22222
+#Debugport: 8082
SynchronizedSuffix: o=example
ChangelogServer: ${remote.hostname}:11112
ChangelogServer: ${remote.hostname}:22222
@@ -62,6 +65,7 @@
RootPwd: secret12
BaseDn: o=example
Changelogport: 33333
+#Debugport: 8083
SynchronizedSuffix: o=example
ChangelogServer: ${remote.hostname}:11112
ChangelogServer: ${remote.hostname}:22222
diff --git a/opends/tests/staf-tests/shared/topology/basic_topology.txt b/opends/tests/staf-tests/shared/topology/basic_topology.txt
index d30a6a8..9132a72 100644
--- a/opends/tests/staf-tests/shared/topology/basic_topology.txt
+++ b/opends/tests/staf-tests/shared/topology/basic_topology.txt
@@ -21,6 +21,7 @@
#
#
# Copyright 2007-2009 Sun Microsystems, Inc.
+# Portions Copyright 2013 Forgerock AS
#
Hostname: ${remote.hostname}
Directory: ${tests.tmp.dir}/opends-synchro-tests/server1
@@ -32,6 +33,7 @@
RootPwd: secret12
BaseDn: o=example
Changelogport: 11112
+#Debugport: 8081
SynchronizedSuffix: o=example
ChangelogServer: ${remote.hostname}:11112
ChangelogServer: ${remote.hostname}:22222
@@ -46,6 +48,7 @@
RootPwd: secret12
BaseDn: o=example
Changelogport: 22222
+#Debugport: 8082
SynchronizedSuffix: o=example
ChangelogServer: ${remote.hostname}:11112
ChangelogServer: ${remote.hostname}:22222
--
Gitblit v1.10.0