Skip to content

Commit

Permalink
[#13126] Fix failing component test cases (#13127)
Browse files Browse the repository at this point in the history
* Fix failing test cases

* Update test logs with unique sorting order

* Revert AccountRequestDbIT
  • Loading branch information
dishenggg authored Jun 11, 2024
1 parent 06bfafd commit 7b75dad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ protected void tearDown() {
for (AccountRequest ar : accountRequests) {
logic.deleteAccountRequest(ar.getId());
}

logic.deleteAccount(getTypicalAccount().getGoogleId());
HibernateUtil.commitTransaction();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,47 +82,52 @@ String getRequestMethod() {
@Override
protected void testExecute() {
______TS("No spam all logs added");

// Gap is larger than spam filter
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(), startTime.toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusMillis(SPAM_FILTER + 1).toEpochMilli());

// Different Types
long padding = 3 * SPAM_FILTER;
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(100).toEpochMilli());
startTime.plusMillis(padding).toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.SUBMISSION.getLabel(),
startTime.plusSeconds(100).toEpochMilli());
startTime.plusMillis(padding + 1).toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.VIEW_RESULT.getLabel(),
startTime.plusSeconds(100).toEpochMilli());
startTime.plusMillis(padding + 2).toEpochMilli());

// Different feedback sessions
padding = 5 * SPAM_FILTER;
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(200).toEpochMilli());
startTime.plusMillis(padding).toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session2InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(200).toEpochMilli());
startTime.plusMillis(padding + 1).toEpochMilli());

// Different Student
padding = 7 * SPAM_FILTER;
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(300).toEpochMilli());
startTime.plusMillis(padding).toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student2InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(300).toEpochMilli());
startTime.plusMillis(padding + 1).toEpochMilli());

// Different course
padding = 9 * SPAM_FILTER;
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(400).toEpochMilli());
startTime.plusMillis(padding).toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course3.getId(), student1InCourse3.getId(),
session1InCourse3.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusSeconds(400).toEpochMilli());

// Gap is larger than spam filter
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(), startTime.toEpochMilli());
mockLogsProcessor.insertFeedbackSessionLog(course1.getId(), student1InCourse1.getId(),
session1InCourse1.getId(), FeedbackSessionLogType.ACCESS.getLabel(),
startTime.plusMillis(SPAM_FILTER + 1).toEpochMilli());
startTime.plusMillis(padding + 1).toEpochMilli());

UpdateFeedbackSessionLogsAction action = getAction();
getJsonResult(action);
Expand Down

0 comments on commit 7b75dad

Please sign in to comment.