-
Notifications
You must be signed in to change notification settings - Fork 73
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
📦 DOP-4497 updtes the mongodb node driver #1035
Conversation
Your feature branch infrastructure has been deployed! Your webhook URL is: https://jxt5lhic6i.execute-api.us-east-2.amazonaws.com/prod/webhook/githubEndpoint/trigger/build For more information on how to use this endpoint, follow these instructions. |
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.
Hmm, this makes me a teeny bit nervous because this change could/is more wide-ranging.
- Do we know where in breaking changes for the Node driver this occurs? lol @ searching our own documentation
- This (the
value
property) definitely is accessed other places.
- one example: in the same file (
src/repositories/jobRepository
) in the functionupdateWithStatus
.
…ModifyResult is not retuned due to includeResultMetadata being false
…eof' is not callable'
…or for updateWithStatus method
For test sake, I applied the following option async updateWithStatus(
id: string | mongodb.ObjectId,
result: any,
status: JobStatus,
shouldNotifySqs = true
): to allow the |
src/repositories/jobRepository.ts
Outdated
); | ||
if (response.value) { | ||
const job: Job = response.value; | ||
if (response) { | ||
const job: Job = response; |
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.
We should change this back!
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.
@mmeigs even when all the tests are working? I guess you are right, this will keep things consistent.
const testData = TestDataProvider.getFindOneAndUpdateCallInfo(); | ||
const mockVal = { value: getBuildJobPlain() }; | ||
const mockVal = getBuildJobPlain(); | ||
jest.spyOn(jobRepo, 'notify').mockResolvedValueOnce(true); | ||
dbRepoHelper.collection.findOneAndUpdate.mockResolvedValueOnce(mockVal); | ||
|
||
await expect(jobRepo.getOneQueuedJobAndUpdate()).resolves.toEqual(mockVal.value); | ||
await expect(jobRepo.getOneQueuedJobAndUpdate()).resolves.toEqual(mockVal); |
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.
And change this back, I believe!
…r i.e. value as a response
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.
LGTM
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.
minor nitpick below but overall LGTM 👍 thanks for testing and providing changelog documents!
src/repositories/jobRepository.ts
Outdated
@@ -115,7 +115,7 @@ export class JobRepository extends BaseRepository { | |||
|
|||
async findOneAndUpdateJob(query): Promise<Job | null> { | |||
const update = { $set: { startTime: new Date(), status: 'inProgress' } }; | |||
const options = { sort: { priority: -1, createdTime: 1 }, returnNewDocument: true }; | |||
const options = { sort: { priority: -1, createdTime: 1 }, returnNewDocument: true, includeResultMetadata: true }; |
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.
good catch! think this can be a default option for BaseRepository so we don't have to repeat it on each call
…seRepository findOneAndUpdate
Stories/Links:
DOP-4497
Notes
This PR was focused on updating MongoDB Node Driver from
v5.1.0
tov6.5
. With upgrading the version, an issue occurred where the build would hang.Upon running the AB locally, I was able to discover that
value
was not a property of the response, which lead me to remove thevalue
proeprty and return just the response.After the above change, I was able to successfully trigger the AB build using the webhook, resulting in the following master and DOP-4497 build results.
The page can be viewed here.
Update
After some additional research, the reason for this change was because in 6.0+ sets
includeResultMetadata
to false by default. AddingincludeResultMetadata
true as an option would allow us to returnvalue
which would contain our returned document.Resource Links
Behavioral Changes to Find One Family APIs
Server Release Compatibility Changes
README updates