-
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?
San 6078 #2029
Changes from all commits
0fb3101
b0e9c38
7081162
9004c98
5374e39
048f077
b937e89
2208562
85796d4
e519fb7
933f315
8ef0303
11a3f75
File filter
Filter by extension
Conversations
Jump to
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 | ||
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, | ||
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 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, | ||
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 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