parent
90584ef1a4
commit
58ad5ba062
|
@ -39,7 +39,7 @@ dependencies {
|
||||||
'dropwizard-views-mustache',
|
'dropwizard-views-mustache',
|
||||||
'dropwizard-testing',
|
'dropwizard-testing',
|
||||||
].each {
|
].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
|
/* Used instead of the default HTTP connector for the Jersey client to
|
||||||
|
|
|
@ -2,6 +2,10 @@ package dropwizardintegtest
|
||||||
|
|
||||||
import javax.ws.rs.core.Response
|
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 {
|
class IntegrationModelHelper {
|
||||||
|
|
||||||
private IntegrationRestApiClient integrationRestApiClient = null
|
private IntegrationRestApiClient integrationRestApiClient = null
|
||||||
|
|
|
@ -12,6 +12,11 @@ import org.glassfish.jersey.client.JerseyInvocation
|
||||||
import javax.ws.rs.core.Response
|
import javax.ws.rs.core.Response
|
||||||
import javax.ws.rs.client.Entity
|
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 {
|
class IntegrationRestApiClient {
|
||||||
private Client jerseyClient = null
|
private Client jerseyClient = null
|
||||||
String host = "http://localhost"
|
String host = "http://localhost"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Feature: DeployDB cleanup APIs
|
Feature: DeployDB cleanup APIs
|
||||||
|
|
||||||
As a DeployDB administrator
|
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
|
Scenario: The model cleanup shall be successful
|
||||||
Given there is a deployment
|
Given there is a deployment
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
bintrayUser=
|
bintrayUser=
|
||||||
bintrayKey=
|
bintrayKey=
|
||||||
|
dropwizardVersion = 0.8.1
|
|
@ -11,6 +11,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
||||||
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
||||||
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
||||||
|
private long deploymentId = 1L
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
mcfgHelper.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" () {
|
def "no webhook should be called when you receive deployment completed trigger if there is no webhook config" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -40,7 +41,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -51,7 +52,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
def "webhook should be called when you receive deployment completed trigger" () {
|
def "webhook should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
|
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -79,7 +80,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
def "environment webhook should be called when you receive deployment completed trigger" () {
|
def "environment webhook should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -95,7 +96,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both global and environment webhooks should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
|
mcfgHelper.createDeploymentCompletedWebhookConfigFile()
|
||||||
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createDeploymentCompletedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -134,7 +135,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
def "multiple webhooks should be called when you receive deployment completed trigger" () {
|
def "multiple webhooks should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -162,7 +163,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
def "multiple environments webhook should be called when you receive deployment completed trigger" () {
|
def "multiple environments webhook should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -178,7 +179,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both multiple global and environment webhooks should be called when you receive deployment completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentCompletedWebhooksConfigFile()
|
||||||
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentCompletedEnvironmentWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@ class DeploymentCompletedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
|
|
@ -30,7 +30,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -50,7 +50,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createWebhookConfigFile()
|
mcfgHelper.createWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// create the required config
|
// create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentConfigFile()
|
mcfgHelper.createEnvironmentConfigFile()
|
||||||
|
|
||||||
// load up the config
|
// load up the config
|
||||||
|
@ -102,7 +102,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// create the required config
|
// create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createWebhookConfigFile()
|
mcfgHelper.createWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentConfigFile()
|
mcfgHelper.createEnvironmentConfigFile()
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleWebhooksConfigFile()
|
mcfgHelper.createMultipleWebhooksConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// create the required config
|
// create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()
|
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()
|
||||||
|
|
||||||
// load up the config
|
// load up the config
|
||||||
|
@ -179,7 +179,7 @@ class DeploymentCreatedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// create the required config
|
// create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleWebhooksConfigFile()
|
mcfgHelper.createMultipleWebhooksConfigFile()
|
||||||
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()
|
mcfgHelper.createMultipleWebhooksEnvironmentConfigFile()
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
||||||
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
||||||
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
||||||
|
private long deploymentId = 1L
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
mcfgHelper.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" () {
|
def "no webhook should be called when you receive deployment started trigger if there is no webhook config" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -38,7 +39,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -49,7 +50,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
def "webhook should be called when you receive deployment started trigger" () {
|
def "webhook should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentStartedWebhookConfigFile()
|
mcfgHelper.createDeploymentStartedWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -77,7 +78,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
def "environment webhook should be called when you receive deployment started trigger" () {
|
def "environment webhook should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
|
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -93,7 +94,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both global and environment webhooks should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createDeploymentStartedWebhookConfigFile()
|
mcfgHelper.createDeploymentStartedWebhookConfigFile()
|
||||||
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
|
mcfgHelper.createDeploymentStartedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -132,7 +133,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
def "multiple webhooks should be called when you receive deployment started trigger" () {
|
def "multiple webhooks should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -159,7 +160,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
def "multiple environments webhook should be called when you receive deployment started trigger" () {
|
def "multiple environments webhook should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -176,7 +177,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both multiple global and environment webhooks should be called when you receive deployment started trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentStartedWebhooksConfigFile()
|
||||||
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
|
mcfgHelper.createMultipleDeploymentStartedEnvironmentWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ class DeploymentStartedNotificationsSpec extends Specification {
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendDeploymentStartedTrigger(1L)
|
boolean success = integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
|
|
@ -204,13 +204,13 @@ promotions:
|
||||||
serviceFile.write(fileContents)
|
serviceFile.write(fileContents)
|
||||||
}
|
}
|
||||||
|
|
||||||
def createServicePromoitionPipelineModelsConfigFiles() {
|
def createServicePromotionPipelineModelsConfigFiles() {
|
||||||
createPromotionConfigFile()
|
createPromotionConfigFile()
|
||||||
createPipelineConfigFile()
|
createPipelineConfigFile()
|
||||||
createServiceConfigFile()
|
createServiceConfigFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
def createBasicProdServicePromoitionPipelineModelsConfigFiles() {
|
def createBasicProdServicePromotionPipelineModelsConfigFiles() {
|
||||||
createEnvironmentConfigFile()
|
createEnvironmentConfigFile()
|
||||||
createProdEnvironmentConfigFile()
|
createProdEnvironmentConfigFile()
|
||||||
createPromotionConfigFile()
|
createPromotionConfigFile()
|
||||||
|
|
|
@ -11,6 +11,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
|
||||||
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
||||||
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
||||||
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
||||||
|
private long deploymentId = 1L
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
mcfgHelper.setup()
|
mcfgHelper.setup()
|
||||||
|
@ -38,7 +39,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createBasicProdServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createBasicProdServicePromotionPipelineModelsConfigFiles()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
integAppHelper.runner.getApplication().loadModelConfiguration()
|
integAppHelper.runner.getApplication().loadModelConfiguration()
|
||||||
|
@ -65,7 +66,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
|
||||||
integAppHelper.webhookRunner.requestWebhookObject.configuredUriPaths =
|
integAppHelper.webhookRunner.requestWebhookObject.configuredUriPaths =
|
||||||
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build"]
|
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build"]
|
||||||
|
|
||||||
success = integModelHelper.sendDeploymentCompletedTrigger(1L)
|
success = integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -80,7 +81,7 @@ class MultipleEnvironmentsNotificationsSpec extends Specification {
|
||||||
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build",
|
["/job/basicEnv-deploy-created/build", "/job/basicEnv-deploy-completed/build",
|
||||||
"/job/prodEnv-deploy-created/build"]
|
"/job/prodEnv-deploy-created/build"]
|
||||||
|
|
||||||
success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
|
|
@ -11,6 +11,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
||||||
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
IntegrationModelHelper integModelHelper = new IntegrationModelHelper(integrationRestApiClient)
|
||||||
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
private WebhooksModelConfigHelper mcfgHelper = new WebhooksModelConfigHelper()
|
||||||
|
private long deploymentId = 1L
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
mcfgHelper.setup()
|
mcfgHelper.setup()
|
||||||
|
@ -34,14 +35,14 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
|
|
||||||
|
|
||||||
integModelHelper.sendCreateArtifact()
|
integModelHelper.sendCreateArtifact()
|
||||||
integModelHelper.sendDeploymentStartedTrigger(1L)
|
integModelHelper.sendDeploymentStartedTrigger(deploymentId)
|
||||||
integModelHelper.sendDeploymentCompletedTrigger(1L)
|
integModelHelper.sendDeploymentCompletedTrigger(deploymentId)
|
||||||
}
|
}
|
||||||
|
|
||||||
def "no webhook should be called when you receive promotion completed trigger if there is no webhook config" () {
|
def "no webhook should be called when you receive promotion completed trigger if there is no webhook config" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -51,7 +52,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -62,7 +63,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
def "webhook should be called when you receive promotion completed trigger" () {
|
def "webhook should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createPromotionCompletedWebhookConfigFile()
|
mcfgHelper.createPromotionCompletedWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -89,7 +90,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
def "environment webhook should be called when you receive promotion completed trigger" () {
|
def "environment webhook should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -104,7 +105,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both global and environment webhooks should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createPromotionCompletedWebhookConfigFile()
|
mcfgHelper.createPromotionCompletedWebhookConfigFile()
|
||||||
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createPromotionCompletedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -142,7 +143,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
def "multiple webhooks should be called when you receive promotion completed trigger" () {
|
def "multiple webhooks should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
|
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -169,7 +170,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
def "multiple environment webhooks should be called when you receive promotion completed trigger" () {
|
def "multiple environment webhooks should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
@ -184,7 +185,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
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" () {
|
def "both multiple global and environment webhooks should be called when you receive promotion completed trigger" () {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
|
mcfgHelper.createMultiplePromotionCompletedEnvironmentWebhookConfigFile()
|
||||||
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
|
mcfgHelper.createMultiplePromotionCompletedWebhookConfigFile()
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
success == true
|
success == true
|
||||||
|
@ -236,9 +237,8 @@ class PromotionCompletedNotificationsSpec extends Specification {
|
||||||
setupDeploymentForPromotionTrigger()
|
setupDeploymentForPromotionTrigger()
|
||||||
|
|
||||||
when:
|
when:
|
||||||
boolean success = integModelHelper.sendPromotionCompletedTrigger(1L)
|
boolean success = integModelHelper.sendPromotionCompletedTrigger(deploymentId)
|
||||||
models.Deployment deployment
|
models.Deployment deployment
|
||||||
Long deploymentId = 1
|
|
||||||
integAppHelper.withSession {
|
integAppHelper.withSession {
|
||||||
deployment = integAppHelper.runner.getApplication().workFlow.deploymentDAO
|
deployment = integAppHelper.runner.getApplication().workFlow.deploymentDAO
|
||||||
.get(deploymentId)
|
.get(deploymentId)
|
||||||
|
|
|
@ -62,7 +62,7 @@ class DeploymentDAOSpec extends Specification {
|
||||||
def "getByEnvironmentIdent() should returns deployments for the environment ident"() {
|
def "getByEnvironmentIdent() should returns deployments for the environment ident"() {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
|
|
@ -320,7 +320,7 @@ class FlowCleanupSpec extends Specification {
|
||||||
def "delete of existing flow cleans up deployments and artifact"() {
|
def "delete of existing flow cleans up deployments and artifact"() {
|
||||||
given:
|
given:
|
||||||
// Create the required config
|
// Create the required config
|
||||||
mcfgHelper.createServicePromoitionPipelineModelsConfigFiles()
|
mcfgHelper.createServicePromotionPipelineModelsConfigFiles()
|
||||||
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
mcfgHelper.createEnvironmentNoWebhooksConfigFile()
|
||||||
|
|
||||||
// load up the configuration
|
// load up the configuration
|
||||||
|
|
|
@ -5,13 +5,11 @@ apply plugin: 'application'
|
||||||
apply plugin: 'com.github.johnrengelman.shadow'
|
apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
apply plugin: 'com.jfrog.bintray'
|
apply plugin: 'com.jfrog.bintray'
|
||||||
|
|
||||||
version = '0.1'
|
version = rootProject.version
|
||||||
group = 'com.github.lookout.deploydb.uat'
|
group = 'com.github.lookout.uat'
|
||||||
description = 'User Acceptance Testing artifact for deploydb'
|
description = 'User Acceptance Testing artifact for deploydb'
|
||||||
|
|
||||||
mainClassName = 'deploydb.UatMainApp'
|
mainClassName = 'uat.UatMainApp'
|
||||||
|
|
||||||
project.targetCompatibility = 1.7
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile ('org.codehaus.groovy:groovy-all:2.4.0+')
|
compile ('org.codehaus.groovy:groovy-all:2.4.0+')
|
||||||
|
@ -23,7 +21,7 @@ dependencies {
|
||||||
'dropwizard-views-mustache',
|
'dropwizard-views-mustache',
|
||||||
'dropwizard-testing',
|
'dropwizard-testing',
|
||||||
].each {
|
].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
|
/* Used instead of the default HTTP connector for the Jersey client to
|
||||||
|
@ -37,14 +35,6 @@ dependencies {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
maven { url 'http://dl.bintray.com/lookout/systems' }
|
|
||||||
}
|
|
||||||
|
|
||||||
task generateScript(type: CreateStartScripts) {
|
|
||||||
applicationName = "uatDeploydb"
|
|
||||||
outputDir = new File("build/dist/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import spock.lang.*
|
import spock.lang.*
|
||||||
import dropwizardintegtest.IntegrationModelHelper
|
import dropwizardintegtest.IntegrationModelHelper
|
||||||
|
@ -28,7 +28,12 @@ class ArtifactTriggerSpec extends Specification {
|
||||||
"""
|
"""
|
||||||
Response response = integrationRestApiClient.postJsonToPath(path, messageBody, false)
|
Response response = integrationRestApiClient.postJsonToPath(path, messageBody, false)
|
||||||
UatArtifact uatArtifact = response.readEntity(UatArtifact)
|
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()
|
response.close()
|
||||||
|
|
||||||
return response.status == 201
|
return response.status == 201
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import dropwizardintegtest.IntegrationRestApiClient
|
import dropwizardintegtest.IntegrationRestApiClient
|
||||||
|
import uat.consul.ServiceHealth
|
||||||
|
|
||||||
import javax.ws.rs.core.Response
|
import javax.ws.rs.core.Response
|
||||||
import javax.ws.rs.core.GenericType
|
import javax.ws.rs.core.GenericType
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import spock.lang.*
|
import spock.lang.*
|
||||||
import dropwizardintegtest.IntegrationModelHelper
|
import dropwizardintegtest.IntegrationModelHelper
|
||||||
|
@ -19,6 +19,12 @@ class DeploymentTriggerSpec extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean sendGetDeployments() {
|
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")
|
String path = "/api/deployments/by-artifact/" + System.getProperty("artifactId")
|
||||||
|
|
||||||
Response response = integrationRestApiClient.getFromPath(path, false)
|
Response response = integrationRestApiClient.getFromPath(path, false)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import spock.util.EmbeddedSpecRunner
|
import spock.util.EmbeddedSpecRunner
|
||||||
import dropwizardintegtest.IntegrationRestApiClient
|
import dropwizardintegtest.IntegrationRestApiClient
|
||||||
|
@ -24,14 +24,15 @@ class TestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean cleanupModels() {
|
boolean cleanupModels(String artifactGroup, String artifactName, String artifactVersion) {
|
||||||
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
IntegrationRestApiClient integrationRestApiClient = new IntegrationRestApiClient()
|
||||||
integrationRestApiClient.host = "http://" + System.getProperty("DeploydbHost")
|
integrationRestApiClient.host = "http://" + System.getProperty("DeploydbHost")
|
||||||
|
|
||||||
// admin port in one more than the application by convention
|
// admin port in one more than the application by convention
|
||||||
integrationRestApiClient.port = Integer.valueOf(System.getProperty("DeploydbPort")) + 1
|
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 response = integrationRestApiClient.postJsonToPath(path, "", false)
|
||||||
response.close()
|
response.close()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
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)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
/*
|
||||||
|
* We only need id property to run UAT tests, so ignore the rest
|
||||||
|
*/
|
||||||
public class UatArtifact {
|
public class UatArtifact {
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
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)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
/*
|
||||||
|
* We only need id property to run UAT tests, so ignore the rest
|
||||||
|
*/
|
||||||
public class UatDeployment {
|
public class UatDeployment {
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package deploydb
|
package uat
|
||||||
|
|
||||||
import org.codehaus.groovy.testng.TestNgRunner
|
import org.codehaus.groovy.testng.TestNgRunner
|
||||||
|
|
||||||
|
@ -6,14 +6,19 @@ import org.codehaus.groovy.testng.TestNgRunner
|
||||||
class UatMainApp {
|
class UatMainApp {
|
||||||
|
|
||||||
static void main(String[] args) {
|
static void main(String[] args) {
|
||||||
deploydb.TestRunner testRunner = new deploydb.TestRunner()
|
uat.TestRunner testRunner = new uat.TestRunner()
|
||||||
ConsulClient consulClient = new ConsulClient()
|
ConsulClient consulClient = new ConsulClient()
|
||||||
|
|
||||||
boolean success = true
|
boolean success = true
|
||||||
consulClient.getDeploydbHosts().each { key, value ->
|
consulClient.getDeploydbHosts().each { key, value ->
|
||||||
System.setProperty("DeploydbHost", key)
|
System.setProperty("DeploydbHost", key)
|
||||||
System.setProperty("DeploydbPort", String.valueOf(value))
|
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)
|
System.exit(1)
|
||||||
}
|
}
|
||||||
success &= testRunner.runTests()
|
success &= testRunner.runTests()
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package deploydb
|
package uat.consul
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consul health check model. Used in UAT's service discovery of deploydb
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class HealthCheck {
|
class HealthCheck {
|
||||||
|
|
||||||
@JsonProperty("Node")
|
@JsonProperty("Node")
|
||||||
private String node
|
private String node
|
|
@ -1,10 +1,13 @@
|
||||||
package deploydb
|
package uat.consul
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consul Node model. Used in UAT's service discovery of deploydb
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class Node {
|
class Node {
|
||||||
|
|
||||||
@JsonProperty("Node")
|
@JsonProperty("Node")
|
||||||
private String node
|
private String node
|
|
@ -1,10 +1,13 @@
|
||||||
package deploydb
|
package uat.consul
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consul Service check model. Used in UAT's service discovery of deploydb
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class Service {
|
class Service {
|
||||||
|
|
||||||
@JsonProperty("ID")
|
@JsonProperty("ID")
|
||||||
private String id
|
private String id
|
|
@ -1,4 +1,4 @@
|
||||||
package deploydb
|
package uat.consul
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
@ -7,8 +7,11 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.List
|
import java.util.List
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consul ServiceHealth check model. Used in UAT's service discovery of deploydb
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class ServiceHealth {
|
class ServiceHealth {
|
||||||
|
|
||||||
@JsonProperty("Node")
|
@JsonProperty("Node")
|
||||||
private Node node
|
private Node node
|
Loading…
Reference in New Issue