Skip to content
Snippets Groups Projects
Unverified Commit 3e14312b authored by Rémy Coutable's avatar Rémy Coutable
Browse files

api: Expose created_at and updated_at in Environments API


Changelog: added

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent cdec6546
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -64,6 +64,8 @@ Example of response
"slug": "review-fix-foo-dfjre3",
"external_url": "https://review-fix-foo-dfjre3.gitlab.example.com",
"state": "available",
"created_at": "2019-05-25T18:55:13.252Z",
"updated_at": "2019-05-27T18:55:13.252Z",
"last_deployment": {
"id": 100,
"iid": 34,
Loading
Loading
@@ -176,7 +178,9 @@ Example response:
"name": "deploy",
"slug": "deploy",
"external_url": "https://deploy.gitlab.example.com",
"state": "available"
"state": "available",
"created_at": "2019-05-25T18:55:13.252Z",
"updated_at": "2019-05-27T18:55:13.252Z"
}
```
 
Loading
Loading
@@ -210,7 +214,9 @@ Example response:
"name": "staging",
"slug": "staging",
"external_url": "https://staging.gitlab.example.com",
"state": "available"
"state": "available",
"created_at": "2019-05-25T18:55:13.252Z",
"updated_at": "2019-05-27T18:55:13.252Z"
}
```
 
Loading
Loading
@@ -302,6 +308,8 @@ Example response:
"name": "deploy",
"slug": "deploy",
"external_url": "https://deploy.gitlab.example.com",
"state": "stopped"
"state": "stopped",
"created_at": "2019-05-25T18:55:13.252Z",
"updated_at": "2019-05-27T18:55:13.252Z"
}
```
Loading
Loading
@@ -25,6 +25,7 @@
]
},
"logs_path": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" }
},
"additionalProperties": false
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
module API
module Entities
class EnvironmentBasic < Grape::Entity
expose :id, :name, :slug, :external_url
expose :id, :name, :slug, :external_url, :created_at, :updated_at
end
end
end
Loading
Loading
@@ -5,7 +5,9 @@
"name",
"slug",
"external_url",
"last_deployment"
"state",
"created_at",
"updated_at"
],
"properties": {
"id": { "type": "integer" },
Loading
Loading
@@ -19,6 +21,9 @@
]
},
"state": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"project": { "$ref": "project.json" },
"enable_advanced_logs_querying": { "type": "boolean" },
"logs_api_path": { "type": "string" },
"gitlab_managed_apps_logs_path": { "type": "string" }
Loading
Loading
Loading
Loading
@@ -18,6 +18,7 @@
get api("/projects/#{project.id}/environments", user)
 
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environments')
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.size).to eq(1)
Loading
Loading
@@ -167,6 +168,7 @@
post api("/projects/#{project.id}/environments", user), params: { name: "mepmep" }
 
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/environment')
expect(json_response['name']).to eq('mepmep')
expect(json_response['slug']).to eq('mepmep')
expect(json_response['external']).to be nil
Loading
Loading
@@ -212,6 +214,7 @@
params: { name: 'Mepmep', external_url: url }
 
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environment')
expect(json_response['name']).to eq('Mepmep')
expect(json_response['external_url']).to eq(url)
end
Loading
Loading
@@ -250,7 +253,7 @@
expect(response).to have_gitlab_http_status(:forbidden)
end
 
it 'returns a 200 for stopped environment' do
it 'returns a 204 for stopped environment' do
environment.stop
 
delete api("/projects/#{project.id}/environments/#{environment.id}", user)
Loading
Loading
@@ -294,6 +297,7 @@
 
it 'returns a 200' do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environment')
end
 
it 'actually stops the environment' do
Loading
Loading
@@ -327,6 +331,7 @@
 
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environment')
expect(json_response['last_deployment']).to be_present
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment