Skip to content

Commit f1a209e

Browse files
authored
AuditLogHelper.checkAuditEventDiffCountForLastTransaction debugging for unexpected number of events case (#2594)
1 parent e8d9a6b commit f1a209e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/org/labkey/test/util/AuditLogHelper.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,14 @@ public Integer checkAuditEventDiffCountForLastTransaction(String containerPath,
248248
{
249249
Integer transactionId = getLastTransactionId(containerPath, auditEventName);
250250
List<Filter> transactionFilter = List.of(new Filter("TransactionId", transactionId, Filter.Operator.EQUAL));
251-
int eventCount = getAuditLogsFromLKS(containerPath, auditEventName, List.of("NewRecordMap"), transactionFilter, null, ContainerFilter.CurrentAndSubfolders).getRows().size();
251+
List<Map<String, Object>> events = getAuditLogsFromLKS(containerPath, auditEventName, List.of("Comment", "UserComment", "NewRecordMap"), transactionFilter, null, ContainerFilter.CurrentAndSubfolders).getRows();
252252
if (expectedEventCount != null)
253-
assertEquals("Unexpected number of events for transactionId " + transactionId, expectedEventCount.intValue(), eventCount);
254-
List<Integer> expectedChangeCounts = Collections.nCopies(eventCount, expectedDiffCount);
253+
{
254+
if (expectedEventCount.intValue() != events.size())
255+
TestLogger.log("Last audit event info: " + events.get(0));
256+
assertEquals("Unexpected number of events for transactionId " + transactionId, expectedEventCount.intValue(), events.size());
257+
}
258+
List<Integer> expectedChangeCounts = Collections.nCopies(events.size(), expectedDiffCount);
255259
checkAuditEventDiffCount(containerPath, auditEventName, transactionFilter, expectedChangeCounts);
256260
return transactionId;
257261
}

0 commit comments

Comments
 (0)