Updated after review comments.

- Fixes #163
This commit is contained in:
Giri Dandu 2015-05-07 19:10:48 -04:00
parent 90584ef1a4
commit 58ad5ba062
25 changed files with 149 additions and 96 deletions

View File

@ -39,7 +39,7 @@ dependencies {
'dropwizard-views-mustache',
'dropwizard-testing',
].each {
compile withSources("io.dropwizard:${it}:0.8.1")
compile withSources("io.dropwizard:${it}:${dropwizardVersion}")
}
/* Used instead of the default HTTP connector for the Jersey client to

View File

@ -2,6 +2,10 @@ package dropwizardintegtest
import javax.ws.rs.core.Response
/**
* This class is used by the spock integration test suites and UAT tests. This will be used by
* clients of deploydb to verify the contract of deploydb interface
*/
class IntegrationModelHelper {
private IntegrationRestApiClient integrationRestApiClient = null

View File

@ -12,6 +12,11 @@ import org.glassfish.jersey.client.JerseyInvocation
import javax.ws.rs.core.Response
import javax.ws.rs.client.Entity
/**
* This class is used by the spock integration test suites and UAT tests. This will be used by
* clients to send REST calls to servers and return responses from the server for further
* processing in the client code
*/
class IntegrationRestApiClient {
private Client jerseyClient = null
String host = "http://localhost"

View File

@ -1,7 +1,7 @@
Feature: DeployDB cleanup APIs
As a DeployDB administrator
I should be able to cleanup the artifact, deployment promotion results models
I should be able to delete the artifact, deployment promotion results models from deploydb
Scenario: The model cleanup shall be successful
Given there is a deployment

View File

@ -1,3 +1,4 @@
org.gradle.daemon=false
bintrayUser=
bintrayKey=
dropwizardVersion = 0.8.1

View File

@ -11,6 +11,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
private long deploymentId = 1L
def setup() {
mcfgHelper.setup()
@ -30,7 +31,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "no webhook should be called when you receive deployment completed trigger if there is no webhook config" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration
@ -40,7 +41,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -51,7 +52,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "webhook should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -68,7 +69,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -79,7 +80,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "environment webhook should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
// load up the configuration
@ -95,7 +96,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -106,7 +107,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "both global and environment webhooks should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
@ -123,7 +124,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -134,7 +135,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "multiple webhooks should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -151,7 +152,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -162,7 +163,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "multiple environments webhook should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
// load up the configuration
@ -178,7 +179,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -189,7 +190,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
def "both multiple global and environment webhooks should be called when you receive deployment completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
@ -207,7 +208,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true

View File

@ -30,7 +30,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration
@ -50,7 +50,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createWebhookConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -77,7 +77,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentConfigFile()
// load up the config
@ -102,7 +102,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createWebhookConfigFile()
mcfgHelper.createEnvironmentConfigFile()
@ -128,7 +128,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleWebhooksConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -154,7 +154,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()
// load up the config
@ -179,7 +179,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
given:
// create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleWebhooksConfigFile()
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()

View File

@ -11,6 +11,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
private long deploymentId = 1L
def setup() {
mcfgHelper.setup()
@ -30,7 +31,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "no webhook should be called when you receive deployment started trigger if there is no webhook config" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration
@ -38,7 +39,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -49,7 +50,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "webhook should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentStartedWebhookConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -66,7 +67,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -77,7 +78,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "environment webhook should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
// load up the configuration
@ -93,7 +94,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -104,7 +105,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "both global and environment webhooks should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createDeploymentStartedWebhookConfigFile()
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
@ -121,7 +122,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -132,7 +133,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "multiple webhooks should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -148,7 +149,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -159,7 +160,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "multiple environments webhook should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
// load up the configuration
@ -176,7 +177,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true
@ -187,7 +188,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
def "both multiple global and environment webhooks should be called when you receive deployment started trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
@ -205,7 +206,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
when:
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
then:
success == true

View File

@ -204,13 +204,13 @@ promotions:
serviceFile.write(fileContents)
}
def createServicePromoitionPipelineModelsConfigFiles() {
def createServicePromotionPipelineModelsConfigFiles() {
createPromotionConfigFile()
createPipelineConfigFile()
createServiceConfigFile()
}
def createBasicProdServicePromoitionPipelineModelsConfigFiles() {
def createBasicProdServicePromotionPipelineModelsConfigFiles() {
createEnvironmentConfigFile()
createProdEnvironmentConfigFile()
createPromotionConfigFile()

View File

@ -11,6 +11,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
private long deploymentId = 1L
def setup() {
mcfgHelper.setup()
@ -38,7 +39,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
given:
// Create the required config
mcfgHelper.createBasicProdServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createBasicProdServicePromotionPipelineModelsConfigFiles()
// load up the configuration
integAppHelper.runner.getApplication().loadModelConfiguration()
@ -65,7 +66,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
integAppHelper.webhookRunner.requestWebhookObject.configuredUriPaths =
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build"]
success = integModelHelper.sendDeploymentCompletedTrigger(1L)
success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
then:
success == true
@ -80,7 +81,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build",
"/job/prodEnv-deploy-created/build"]
success = integModelHelper.sendPromotionCompletedTrigger(1L)
success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true

View File

@ -11,6 +11,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
private long deploymentId = 1L
def setup() {
mcfgHelper.setup()
@ -34,14 +35,14 @@ class PromotionCompletedNotificationsSpec extends Specification {
integModelHelper.sendCreateArtifact()
integModelHelper.sendDeploymentStartedTrigger(1L)
integModelHelper.sendDeploymentCompletedTrigger(1L)
integModelHelper.sendDeploymentStartedTrigger(deploymentId)
integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
}
def "no webhook should be called when you receive promotion completed trigger if there is no webhook config" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration
@ -51,7 +52,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -62,7 +63,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "webhook should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createPromotionCompletedWebhookConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -78,7 +79,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -89,7 +90,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "environment webhook should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
// load up the configuration
@ -104,7 +105,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -115,7 +116,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "both global and environment webhooks should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createPromotionCompletedWebhookConfigFile()
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
@ -131,7 +132,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -142,7 +143,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "multiple webhooks should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
@ -158,7 +159,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -169,7 +170,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "multiple environment webhooks should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
// load up the configuration
@ -184,7 +185,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -195,7 +196,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
def "both multiple global and environment webhooks should be called when you receive promotion completed trigger" () {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
@ -212,7 +213,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
then:
success == true
@ -236,9 +237,8 @@ class PromotionCompletedNotificationsSpec extends Specification {
setupDeploymentForPromotionTrigger()
when:
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
models.Deployment deployment
Long deploymentId = 1
integAppHelper.withSession {
deployment = integAppHelper.runner.getApplication().workFlow.deploymentDAO
.get(deploymentId)

View File

@ -62,7 +62,7 @@ class DeploymentDAOSpec extends Specification {
def "getByEnvironmentIdent() should returns deployments for the environment ident"() {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration

View File

@ -320,7 +320,7 @@ class FlowCleanupSpec extends Specification {
def "delete of existing flow cleans up deployments and artifact"() {
given:
// Create the required config
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
// load up the configuration

View File

@ -5,13 +5,11 @@ apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.jfrog.bintray'
version = '0.1'
group = 'com.github.lookout.deploydb.uat'
version = rootProject.version
group = 'com.github.lookout.uat'
description = 'User Acceptance Testing artifact for deploydb'
mainClassName = 'deploydb.UatMainApp'
project.targetCompatibility = 1.7
mainClassName = 'uat.UatMainApp'
dependencies {
compile ('org.codehaus.groovy:groovy-all:2.4.0+')
@ -23,7 +21,7 @@ dependencies {
'dropwizard-views-mustache',
'dropwizard-testing',
].each {
compile ("io.dropwizard:${it}:0.8.1")
compile ("io.dropwizard:${it}:${dropwizardVersion}")
}
/* Used instead of the default HTTP connector for the Jersey client to
@ -37,14 +35,6 @@ dependencies {
repositories {
jcenter()
mavenCentral()
maven { url 'http://dl.bintray.com/lookout/systems' }
}
task generateScript(type: CreateStartScripts) {
applicationName = "uatDeploydb"
outputDir = new File("build/dist/")
}
shadowJar {

View File

@ -1,4 +1,4 @@
package deploydb
package uat
import spock.lang.*
import dropwizardintegtest.IntegrationModelHelper
@ -28,7 +28,12 @@ class ArtifactTriggerSpec extends Specification {
"""
Response response = integrationRestApiClient.postJsonToPath(path, messageBody, false)
UatArtifact uatArtifact = response.readEntity(UatArtifact)
System.setProperty("artifactId", String.valueOf(uatArtifact.id))
/**
* We can't hard code the id to fetch the deployment because in some environments there
* will be more artifacts than test artifacts created by UAT
* Let's save the created artifact id and use them to read artifact and deployments
*/
System.setProperty("artifactId", String.valueOf(uatArtifact.id))
response.close()
return response.status == 201

View File

@ -1,6 +1,7 @@
package deploydb
package uat
import dropwizardintegtest.IntegrationRestApiClient
import uat.consul.ServiceHealth
import javax.ws.rs.core.Response
import javax.ws.rs.core.GenericType

View File

@ -1,4 +1,4 @@
package deploydb
package uat
import spock.lang.*
import dropwizardintegtest.IntegrationModelHelper
@ -19,6 +19,12 @@ class DeploymentTriggerSpec extends Specification {
}
boolean sendGetDeployments() {
/**
* We can't hard code the id to fetch the deployment because in some environments there
* will be more artifacts than test artifacts created by UAT
* Let's use the artifact id of that was created as part of ArtifactTriggerSpec and use
* that to fectch the deployment.
*/
String path = "/api/deployments/by-artifact/" + System.getProperty("artifactId")
Response response = integrationRestApiClient.getFromPath(path, false)

View File

@ -1,4 +1,4 @@
package deploydb
package uat
import spock.util.EmbeddedSpecRunner
import dropwizardintegtest.IntegrationRestApiClient
@ -24,14 +24,15 @@ class TestRunner {
}
}
boolean cleanupModels() {
boolean cleanupModels(String artifactGroup, String artifactName, String artifactVersion) {
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
integrationRestApiClient.host = "http://" + System.getProperty("DeploydbHost")
// admin port in one more than the application by convention
integrationRestApiClient.port = Integer.valueOf(System.getProperty("DeploydbPort")) + 1
String path = "/tasks/modelCleanup?group=basic.group.1&name=bg1&version=1.2.345"
String path = "/tasks/modelCleanup?group="+artifactGroup+"&name="+artifactName+"&version="+artifactVersion
// String path = "/tasks/modelCleanup?group=basic.group.1&name=bg1&version=1.2.345"
Response response = integrationRestApiClient.postJsonToPath(path, "", false)
response.close()

View File

@ -1,9 +1,19 @@
package deploydb
package uat
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
/**
* For UAT tests we need to deserialize the Artifact model.
* We can't use the deploydb models because of gradle sub projects dependencies issue.
* Ideally we should have a top level "api" directory for deploydb that has models in them.
*
* Class to access the Artifact returned by deploydb REST API
*/
@JsonIgnoreProperties(ignoreUnknown = true)
/*
* We only need id property to run UAT tests, so ignore the rest
*/
public class UatArtifact {
@JsonProperty

View File

@ -1,9 +1,19 @@
package deploydb
package uat
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
/**
* For UAT tests we need to deserialize the Deployment model.
* We can't use the deploydb models because of gradle sub projects dependencies issue.
* Ideally we should have a top level "api" directory for deploydb that has models in them.
*
* Class to access the Deployment returned by deploydb REST API
*/
@JsonIgnoreProperties(ignoreUnknown = true)
/*
* We only need id property to run UAT tests, so ignore the rest
*/
public class UatDeployment {
@JsonProperty

View File

@ -1,4 +1,4 @@
package deploydb
package uat
import org.codehaus.groovy.testng.TestNgRunner
@ -6,14 +6,19 @@ import org.codehaus.groovy.testng.TestNgRunner
class UatMainApp {
static void main(String[] args) {
deploydb.TestRunner testRunner = new deploydb.TestRunner()
uat.TestRunner testRunner = new uat.TestRunner()
ConsulClient consulClient = new ConsulClient()
boolean success = true
consulClient.getDeploydbHosts().each { key, value ->
System.setProperty("DeploydbHost", key)
System.setProperty("DeploydbPort", String.valueOf(value))
if(false == testRunner.cleanupModels()) {
/*
* Delete the test artifact, deployments and promotion results if they already present.
* This will allow the UAT tests to rerun for long lived environment
*/
if(false == testRunner.cleanupModels("basic.group.1", "bg1","1.2.345")) {
System.exit(1)
}
success &= testRunner.runTests()

View File

@ -1,10 +1,13 @@
package deploydb
package uat.consul
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
/**
* Consul health check model. Used in UAT's service discovery of deploydb
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class HealthCheck {
class HealthCheck {
@JsonProperty("Node")
private String node

View File

@ -1,10 +1,13 @@
package deploydb
package uat.consul
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
/**
* Consul Node model. Used in UAT's service discovery of deploydb
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Node {
class Node {
@JsonProperty("Node")
private String node

View File

@ -1,10 +1,13 @@
package deploydb
package uat.consul
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
/**
* Consul Service check model. Used in UAT's service discovery of deploydb
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Service {
class Service {
@JsonProperty("ID")
private String id

View File

@ -1,4 +1,4 @@
package deploydb
package uat.consul
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
@ -7,8 +7,11 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import java.util.ArrayList
import java.util.List
/**
* Consul ServiceHealth check model. Used in UAT's service discovery of deploydb
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class ServiceHealth {
class ServiceHealth {
@JsonProperty("Node")
private Node node