Merge pull request #96 from maheshkelkar/issues/95-promo-results-get-api

Define REST API to GET results of a promotion assoc with the deployment
This commit is contained in:
GiriDandu 2015-03-11 09:54:12 -04:00
commit 21918a6e1c
3 changed files with 101 additions and 5 deletions

View File

@ -4,7 +4,8 @@ Feature: Deployment UPDATE APIs
I should be able to update existing deployments in the system
Scenario: Updating a deployment with a status STARTED
@freezetime @wip
Scenario: Updating a deployment with a status COMPLETED
Given there is a deployment
When I PATCH "/api/deployments/1" with:
@ -13,10 +14,36 @@ Feature: Deployment UPDATE APIs
"status" : "COMPLETED"
}
"""
Then the response should be 204
Then the response should be 200
And the body should be JSON:
"""
{
"id" : 1,
"artifact" : {
"id" : 1,
"group" : "com.example.cucumber",
"name" : "cucumber-artifact",
"version" : "1.0.1",
"sourceUrl" : "http://example.com/maven/com.example.cucumber/cucumber-artifact/1.0.1/cucumber-artifact-1.0.1.jar",
"createdAt" : "{{created_timestamp}}"
},
"environment" : "pre-prod",
"service" : "faas",
"status" : "COMPLETED",
"promotions" : [{
"id" : 1,
"promotion" : "jenkins-smoke",
"status" : "STARTED",
"infoUrl" : null,
"createdAt" : "{{created_timestamp}}"
}],
"createdAt" : "{{created_timestamp}}"
}
"""
Scenario: Updating a deployment with a status COMPLETED
@freezetime @wip
Scenario: Updating a deployment with a status FAILED
Given there is a deployment
When I PATCH "/api/deployments/1" with:
@ -25,7 +52,32 @@ Feature: Deployment UPDATE APIs
"status" : "FAILED"
}
"""
Then the response should be 204
Then the response should be 200
And the body should be JSON:
"""
{
"id" : 1,
"artifact" : {
"id" : 1,
"group" : "com.example.cucumber",
"name" : "cucumber-artifact",
"version" : "1.0.1",
"sourceUrl" : "http://example.com/maven/com.example.cucumber/cucumber-artifact/1.0.1/cucumber-artifact-1.0.1.jar",
"createdAt" : "{{created_timestamp}}"
},
"environment" : "pre-prod",
"service" : "faas",
"status" : "FAILED",
"promotions" : [{
"id" : 1,
"promotion" : "jenkins-smoke",
"status" : "STARTED",
"infoUrl" : null,
"createdAt" : "{{created_timestamp}}"
}],
"createdAt" : "{{created_timestamp}}"
}
"""
Scenario: Updating a deployment with invalid status transition

View File

@ -4,6 +4,7 @@ Feature: Promotion Result APIs
I should be able to add Promotion result for a Deployment in the system
@freezetime @wip
Scenario: Adding a result for a Promotion associated with a Deployment
Given there is a deployment
@ -15,7 +16,17 @@ Feature: Promotion Result APIs
"infoUrl" : "http://local.lookout.com/jenkins/job-id/2/results"
}
"""
Then the response should be 204
Then the response should be 201
And the body should be JSON:
"""
{
"id" : 1,
"promotion" : "jenkins-smoke",
"status" : "SUCCESS",
"infoUrl" : "http://local.lookout.com/jenkins/job-id/2/results",
"createdAt" : "{{created_timestamp}}"
}
"""
Scenario: Adding a result with invalid status for a Promotion associated with a Deployment

View File

@ -46,3 +46,36 @@ Feature: Promotion READ APIs
When I GET "/api/promotions/faas"
Then the response should be 404
@freezetime @wip
Scenario: Fetching a result for a Promotion associated with a Deployment
Given there is a deployment
When I GET "/api/deployments/1/promotions/1"
Then the response should be 200
And the body should be JSON:
"""
{
"id" : 1,
"promotion" : "jenkins-smoke",
"status" : "STARTED",
"infoUrl" : null,
"createdAt" : "{{created_timestamp}}"
}
"""
@wip
Scenario: Fetching Promotion result for a Deployment that doesn't exist
When I GET "/api/deployments/1/promotions/1"
Then the response should be 404
@error @wip
Scenario: Fetching a result for a Promotion which is not associated with the Deployment
Given there is a deployment
When I GET "/api/deployments/1/promotions/5"
Then the response should be 404