Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
San 6078#2029
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
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
San 6078 #2029
Changes from all commits
0fb3101b0e9c3870811629004c985374e39048f077b937e89220856285796d4e519fb7933f3158ef030311a3f75File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -335,13 +335,14 @@ BuildService._buildBuild = function (build, buildInfo, sessionUser) { | ||
| /** | ||
| * @param {String} buildId | ||
Contributor 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. nit update jsdoc | ||
| * @param {object} imageData - the image data to attach to the context version, | ||
| * @return {Promise} | ||
| */ | ||
| BuildService.updateSuccessfulBuild = (buildId) => { | ||
| BuildService.updateSuccessfulBuild = (buildId, imageData) => { | ||
| var log = logger.child({ method: 'updateSuccessfulBuild' }) | ||
| log.info({ buildId }, 'updateSuccessfulBuild called') | ||
| return ContextVersion.updateAndGetSuccessfulBuild(buildId) | ||
| return ContextVersion.updateAndGetSuccessfulBuild(buildId, imageData) | ||
| .tap((SuccessfullContextVersions) => { | ||
| var contextVersionIds = SuccessfullContextVersions.map(pluck('_id')) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -309,7 +309,7 @@ describe('Context Version Unit Test', function () { | ||
| done() | ||
| }) | ||
| it('should save a successful build', (done) => { | ||
| it('should save a successful build with no image data', (done) => { | ||
| const buildId = 12341 | ||
| ContextVersion.updateAndGetSuccessfulBuild(buildId).asCallback(() => { | ||
| @@ -320,12 +320,70 @@ describe('Context Version Unit Test', function () { | ||
| $set: { | ||
| 'build.failed': false, | ||
| 'build.completed': sinon.match.number, | ||
| 'state': ContextVersion.states.buildSucceeded | ||
| 'state': ContextVersion.states.buildSucceeded, | ||
| imageData: undefined | ||
| } | ||
| }) | ||
| sinon.assert.calledOnce(ContextVersion.findByAsync) | ||
| sinon.assert.calledWith(ContextVersion.findByAsync, 'build._id', buildId) | ||
| sinon.assert.calledWithExactly(ContextVersion.findByAsync, 'build._id', buildId) | ||
| done() | ||
| }) | ||
| }) | ||
| it('should save a successful build with image data', (done) => { | ||
| const buildId = 12341 | ||
| const imageData = { | ||
| ports: [{ | ||
| protocol: 'Omega', | ||
| port: '13' | ||
| }], | ||
| cmd: ['cmd 1'], | ||
| entryPoint: ['entry 1'] | ||
| } | ||
| ContextVersion.updateAndGetSuccessfulBuild(buildId, imageData).asCallback(() => { | ||
| sinon.assert.calledOnce(ContextVersion.updateByAsync) | ||
| sinon.assert.calledWith(ContextVersion.updateByAsync, | ||
Member 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. if possible use ContributorAuthor 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. Was able to switch it below but this one causes issues. | ||
| 'build._id', | ||
| buildId, { | ||
| $set: { | ||
| 'build.failed': false, | ||
| 'build.completed': sinon.match.number, | ||
| 'state': ContextVersion.states.buildSucceeded, | ||
| 'imageData': imageData | ||
| } | ||
| }) | ||
| sinon.assert.calledOnce(ContextVersion.findByAsync) | ||
| sinon.assert.calledWithExactly(ContextVersion.findByAsync, 'build._id', buildId) | ||
| done() | ||
| }) | ||
| }) | ||
| it('should save a successful build with empty image data', (done) => { | ||
| const buildId = 12341 | ||
| const imageData = { | ||
| ports: [], | ||
| cmd: [], | ||
| entryPoint: [] | ||
| } | ||
| ContextVersion.updateAndGetSuccessfulBuild(buildId, imageData).asCallback(() => { | ||
| sinon.assert.calledOnce(ContextVersion.updateByAsync) | ||
| sinon.assert.calledWith(ContextVersion.updateByAsync, | ||
Member 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. if possible use ContributorAuthor 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. Was able to switch it below but this one causes issues. | ||
| 'build._id', | ||
| buildId, { | ||
| $set: { | ||
| 'build.failed': false, | ||
| 'build.completed': sinon.match.number, | ||
| 'state': ContextVersion.states.buildSucceeded, | ||
| 'imageData': imageData | ||
| } | ||
| }) | ||
| sinon.assert.calledOnce(ContextVersion.findByAsync) | ||
| sinon.assert.calledWithExactly(ContextVersion.findByAsync, 'build._id', buildId) | ||
| done() | ||
| }) | ||
| }) | ||
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.
nit: update jsdoc