Skip to content

Commit ecf4bef

Browse files
committed
Refactored the interoperability process code into GetInteroperabilityProcesses
1 parent 959a61c commit ecf4bef

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

cls/TestCoverage/Manager.cls

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,27 @@ Method CoverageTargetsSet(%value) As %Status [ Internal, Private ]
179179
Quit $$$OK
180180
}
181181

182+
/// Collect the list of PIDs used by Interoperability processes in the current namespace
183+
/// In order to run unit tests collecting coverage in that specific list of processes (plus the current process)
184+
Method GetInteropProcesses(Output tProcessIDs)
185+
{
186+
&sql(select %DLIST(Process) into :tProcessIDs from %SYS.ProcessQuery_SS() where "User" = '_Ensemble' and Namespace = $Namespace)
187+
If (SQLCODE < 0) {
188+
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
189+
}
190+
if ('$LISTFIND(tProcessIDs, $Job)) {
191+
set $LIST(tProcessIDs, *+1) = $Job
192+
}
193+
}
194+
182195
/// Overriden LogAssert method because we want to be able to hook into the StartProduction() call in subclasses of %UnitTest.TestProduction
183196
/// in order to get the interoperability process list after the production has started
184197
Method LogAssert(success, action, description, extra, args...)
185198
{
186199
do ##super(.success, .action, .description, .extra, args...)
187200
if (..InteroperabilityProcesses && (description = "StartProduction()")) {
188-
// Collect the list of PIDs used by Interoperability processes in the current namespace
189-
// Run unit tests collecting coverage in that specific list of processes (plus the current process)
190-
&sql(select %DLIST(Process) into :tProcessIDs from %SYS.ProcessQuery_SS() where "User" = '_Ensemble' and Namespace = $Namespace)
191-
If (SQLCODE < 0) {
192-
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
193-
}
194-
if ('$LISTFIND(tProcessIDs, $Job)) {
195-
set $LIST(tProcessIDs, *+1) = $Job
196-
}
201+
202+
do GetInteropProcesses(.tProcessIDs)
197203
set ..ProcessIDs = tProcessIDs
198204
$$$ThrowOnError(..EndCoverageTracking())
199205
$$$ThrowOnError(..StartCoverageTracking())
@@ -268,15 +274,7 @@ Method StartCoverageTracking() As %Status [ Private ]
268274
}
269275
ElseIf ($list(tProcessIDs, 1)="Interop")
270276
{
271-
// Collect the list of PIDs used by Interoperability processes in the current namespace
272-
// Run unit tests collecting coverage in that specific list of processes (plus the current process)
273-
&sql(select %DLIST(Process) into :tProcessIDs from %SYS.ProcessQuery_SS() where "User" = '_Ensemble' and Namespace = $Namespace)
274-
If (SQLCODE < 0) {
275-
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
276-
}
277-
if ('$LISTFIND(tProcessIDs, $Job)) {
278-
set $LIST(tProcessIDs, *+1) = $Job
279-
}
277+
do GetInteropProcesses(.tProcessIDs)
280278
}
281279
Set tMetrics = $ListBuild("RtnLine") _ $Select(..Timing:$ListBuild("Time","TotalTime"),1:"")
282280
$$$ThrowOnError(..Monitor.StartWithScope(tRelevantTargets,tMetrics,tProcessIDs))

0 commit comments

Comments
 (0)