Merge pull request #174 from maheshkelkar/issues/172-mult-promos-dep-success-early
Fix a case where deployment with multiple promotions is prematurely marked as SUCCESS
This commit is contained in:
commit
93d46498ff
|
@ -682,8 +682,8 @@ class WorkFlow {
|
|||
|
||||
|
||||
/* Find out if any other promotions are waiting for results */
|
||||
models.PromotionResult startedPromotionResult = deployment.getPromotionResultSet().find() {
|
||||
pr -> pr.promotionIdent == Status.STARTED
|
||||
models.PromotionResult startedPromotionResult = deployment.promotionResultSet.find() {
|
||||
pr -> pr.status == Status.STARTED
|
||||
}
|
||||
if (startedPromotionResult != null) {
|
||||
/* Wait for more promotion results */
|
||||
|
|
|
@ -55,10 +55,12 @@ description: "Basic Smoke test for the Basic Service"
|
|||
promotionFile.write(fileContents)
|
||||
}
|
||||
|
||||
def createAnotherPromotionConfigFile() {
|
||||
def createManualPromotionConfigFile() {
|
||||
String fileContents = """
|
||||
type: deploydb.models.promotion.ManualLDAPPromotionImpl
|
||||
description: "Advanced Smoke test for the Basic Service"
|
||||
description: "Manual LDAP Promotion"
|
||||
attributes:
|
||||
allowedGroup: ManualPromotionGroup
|
||||
"""
|
||||
/* Create temp file */
|
||||
File promotionsDir = new File("${baseCfgDirName}/promotions")
|
||||
|
@ -66,7 +68,7 @@ description: "Advanced Smoke test for the Basic Service"
|
|||
promotionsDir.mkdirs()
|
||||
}
|
||||
|
||||
File promotionFile = new File(promotionsDir, "advancedPromo.yml")
|
||||
File promotionFile = new File(promotionsDir, "manualPromo.yml")
|
||||
promotionFile.write(fileContents)
|
||||
}
|
||||
|
||||
|
@ -180,6 +182,28 @@ environments:
|
|||
pipelineFile.write(fileContents)
|
||||
}
|
||||
|
||||
def createMultiPromoServiceConfigFile() {
|
||||
String fileContents = """
|
||||
description: "Basic Service"
|
||||
artifacts:
|
||||
- basic.group.1:bg1
|
||||
- basic.group.2:bg2
|
||||
pipelines:
|
||||
- basicPipe
|
||||
promotions:
|
||||
- basicPromo
|
||||
- manualPromo
|
||||
"""
|
||||
/* Create temp file */
|
||||
File servicesDir = new File("${baseCfgDirName}/services")
|
||||
if (!servicesDir.exists()) {
|
||||
servicesDir.mkdirs()
|
||||
}
|
||||
|
||||
File serviceFile = new File(servicesDir, "basicServ.yml")
|
||||
serviceFile.write(fileContents)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class WebhooksModelConfigHelper extends deploydb.ModelConfigHelper {
|
||||
|
|
|
@ -215,4 +215,43 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
|||
sleep(1000)
|
||||
integAppHelper.webhookRunner.requestWebhookObject.requestMessageBodies.size() == 4
|
||||
}
|
||||
|
||||
def "With multiple promotions, deployment status is not updated with first promotion completed trigger" () {
|
||||
given:
|
||||
// Create the required config
|
||||
mcfgHelper.createPromotionConfigFile()
|
||||
mcfgHelper.createManualPromotionConfigFile()
|
||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||
mcfgHelper.createPipelineConfigFile()
|
||||
mcfgHelper.createMultiPromoServiceConfigFile()
|
||||
|
||||
// load up the configuration
|
||||
integAppHelper.runner.getApplication().loadModelConfiguration()
|
||||
|
||||
// Setup deployment for promotion trigger
|
||||
setupDeploymentForPromotionTrigger()
|
||||
|
||||
when:
|
||||
boolean success = integModelHelper.sendPromotionCompletedTrigger()
|
||||
models.Deployment deployment
|
||||
Long deploymentId = 1
|
||||
integAppHelper.withSession {
|
||||
deployment = integAppHelper.runner.getApplication().workFlow.deploymentDAO
|
||||
.get(deploymentId)
|
||||
}
|
||||
|
||||
then:
|
||||
success == true
|
||||
sleep(1000)
|
||||
deployment.promotionResultSet.size() == 2
|
||||
deployment.status == Status.COMPLETED
|
||||
models.PromotionResult manualPromoResult = deployment.promotionResultSet.find() {
|
||||
pr -> pr.promotionIdent == "manualPromo"
|
||||
}
|
||||
manualPromoResult.status == Status.STARTED
|
||||
models.PromotionResult basicPromoResult = deployment.promotionResultSet.find() {
|
||||
pr -> pr.promotionIdent == "basicPromo"
|
||||
}
|
||||
basicPromoResult.status == Status.SUCCESS
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class WorkFlowWithArgsSpec extends Specification {
|
|||
modelConfigHelper.createWebhookConfigFile()
|
||||
workFlow.loadConfigModels()
|
||||
String oldChecksum = app.configChecksum
|
||||
modelConfigHelper.createAnotherPromotionConfigFile()
|
||||
modelConfigHelper.createManualPromotionConfigFile()
|
||||
mdao.persist(_) >> _
|
||||
|
||||
when:
|
||||
|
|
Loading…
Reference in New Issue