Skip to content

Commit

Permalink
Make model-intest security tests run faster
Browse files Browse the repository at this point in the history
By reducing the amount of audit records fetched.
  • Loading branch information
mederly committed Apr 11, 2019
1 parent 0e015db commit c08a5a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Expand Up @@ -1001,7 +1001,7 @@ protected void assertAuditReadDeny() throws Exception {

protected void assertAuditReadAllow() throws Exception {
assertAllow("auditHistory", (task,result) -> {
List<AuditEventRecord> auditRecords = getAllAuditRecords(task, result);
List<AuditEventRecord> auditRecords = getAuditRecords(10, task, result);
assertTrue("No audit records", auditRecords != null && !auditRecords.isEmpty());
});
}
Expand Down
Expand Up @@ -2800,7 +2800,7 @@ public void test310AutzJackNoRolePrivileged() throws Exception {
assertSuperuserAccess(NUMBER_OF_ALL_USERS + 1);

} catch (Exception e) {
new RuntimeException(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}

return null;
Expand Down Expand Up @@ -2831,7 +2831,7 @@ public void test312AutzAnonymousPrivileged() throws Exception {
assertSuperuserAccess(NUMBER_OF_ALL_USERS + 1);

} catch (Exception e) {
new RuntimeException(e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}

return null;
Expand Down
Expand Up @@ -5047,6 +5047,12 @@ protected List<AuditEventRecord> getAllAuditRecords(Task task, OperationResult r
return modelAuditService.listRecords("from RAuditEventRecord as aer order by aer.timestamp asc", params, task, result);
}

protected List<AuditEventRecord> getAuditRecords(int maxRecords, Task task, OperationResult result) throws SecurityViolationException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException {
Map<String,Object> params = new HashMap<>();
params.put("setMaxResults", maxRecords);
return modelAuditService.listRecords("from RAuditEventRecord as aer order by aer.timestamp asc", params, task, result);
}

protected List<AuditEventRecord> getObjectAuditRecords(String oid) throws SecurityViolationException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException {
Task task = createTask("getObjectAuditRecords");
OperationResult result = task.getResult();
Expand Down

0 comments on commit c08a5a4

Please sign in to comment.