-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#4079 - Queue Monitoring - Schedulers Refactor (Part 6) #4177
Merged
andrewsignori-aot
merged 7 commits into
main
from
feature/#4076-schedulers-refactor-part-6
Dec 26, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
588818a
Refactor enqueuer/retry
andrewsignori-aot e324481
ATBC refactor and others.
andrewsignori-aot 285ebed
Adjusted ATBC E2E for consistency.
andrewsignori-aot 35566c3
Application changes reports refactor
andrewsignori-aot f4a6350
Adding log summary to the result also.
andrewsignori-aot 070e1db
Updated message as per PR suggestion.
andrewsignori-aot 2d333e3
Remove unnecessary log
andrewsignori-aot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ import { | |
ApplicationChangesReportHeaders, | ||
APPLICATION_CHANGES_DATE_TIME_FORMAT, | ||
} from "@sims/integrations/esdc-integration"; | ||
import MockDate from "mockdate"; | ||
import * as dayjs from "dayjs"; | ||
|
||
describe( | ||
describeProcessorRootTest(QueueNames.ApplicationChangesReportIntegration), | ||
|
@@ -49,6 +51,7 @@ describe( | |
let sftpClientMock: DeepMocked<Client>; | ||
let auditUser: User; | ||
let sharedStudent: Student; | ||
let expectedFileName: string; | ||
|
||
beforeAll(async () => { | ||
const { nestApplication, dataSource, sshClientMock } = | ||
|
@@ -70,6 +73,10 @@ describe( | |
}, | ||
{ previousDateChangedReportedAssessment: { id: null } }, | ||
); | ||
// Mock the current date. | ||
const now = new Date(); | ||
MockDate.set(now); | ||
expectedFileName = `DPBC.EDU.APPCHANGES.${formatFileNameDate(now)}.csv`; | ||
}); | ||
|
||
it("Should generate application changes report and update the reported date when there is one or more application changes which are not reported.", async () => { | ||
|
@@ -89,16 +96,14 @@ describe( | |
const mockedJob = mockBullJob<void>(); | ||
|
||
// Act | ||
const processingResult = await processor.processApplicationChanges( | ||
mockedJob.job, | ||
); | ||
const result = await processor.processQueue(mockedJob.job); | ||
|
||
// Assert | ||
// Assert process result. | ||
expect(processingResult).toContain("Process finalized with success."); | ||
expect(processingResult).toContain("Applications reported: 2"); | ||
expect( | ||
mockedJob.containLogMessages(["Found 2 application changes."]), | ||
).toBe(true); | ||
expect(result).toStrictEqual([ | ||
"Applications reported: 2", | ||
`Uploaded file name: ${expectedFileName}`, | ||
]); | ||
const uploadedFile = getUploadedFile(sftpClientMock); | ||
const expectedFirstRecord = getExpectedApplicationChangesCSVRecord( | ||
firstApplication, | ||
|
@@ -176,16 +181,13 @@ describe( | |
const mockedJob = mockBullJob<void>(); | ||
|
||
// Act | ||
const processingResult = await processor.processApplicationChanges( | ||
mockedJob.job, | ||
); | ||
const result = await processor.processQueue(mockedJob.job); | ||
// Assert | ||
// Assert process result. | ||
expect(processingResult).toContain("Process finalized with success."); | ||
expect(processingResult).toContain("Applications reported: 1"); | ||
expect( | ||
mockedJob.containLogMessages(["Found 1 application changes."]), | ||
).toBe(true); | ||
expect(result).toStrictEqual([ | ||
"Applications reported: 1", | ||
`Uploaded file name: ${expectedFileName}`, | ||
]); | ||
const uploadedFile = getUploadedFile(sftpClientMock); | ||
const expectedFirstRecord = getExpectedApplicationChangesCSVRecord( | ||
application, | ||
|
@@ -226,16 +228,19 @@ describe( | |
const mockedJob = mockBullJob<void>(); | ||
|
||
// Act | ||
const processingResult = await processor.processApplicationChanges( | ||
mockedJob.job, | ||
); | ||
const result = await processor.processQueue(mockedJob.job); | ||
|
||
// Assert | ||
// Assert process result. | ||
expect(processingResult).toContain("Process finalized with success."); | ||
expect(processingResult).toContain("Applications reported: 0"); | ||
expect(result).toStrictEqual([ | ||
"Applications reported: 0", | ||
`Uploaded file name: ${expectedFileName}`, | ||
]); | ||
expect( | ||
mockedJob.containLogMessages([ | ||
"Retrieving all application changes that have not yet been reported.", | ||
"Found 0 application changes.", | ||
`Application changes report with file name ${expectedFileName} has been uploaded successfully.`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
"Report date update not required as no application changes are reported.", | ||
]), | ||
).toBe(true); | ||
|
@@ -397,5 +402,14 @@ describe( | |
newOffering.studyEndDate, | ||
].join(","); | ||
} | ||
|
||
/** | ||
* Format date to be used in file name. | ||
* @param date date. | ||
* @returns file name date format. | ||
*/ | ||
function formatFileNameDate(date: Date): string { | ||
return dayjs(date).format("YYYY-MM-DD_HH.mm.ss"); | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍