Skip to content
代码片段 群组 项目
未验证 提交 bcf41f27 编辑于 作者: Max Woolf's avatar Max Woolf 提交者: GitLab
浏览文件

Merge branch '376352-expose-auto-stop-information' into 'master'

Expose auto_stop_at in Environments api

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147210



Merged-by: default avatarMax Woolf <mwoolf@gitlab.com>
Approved-by: default avatarTimo Furrer <tfurrer@gitlab.com>
Approved-by: default avatarBishwa Hang Rai <bhrai@gitlab.com>
Approved-by: default avatarMax Woolf <mwoolf@gitlab.com>
Reviewed-by: default avatarTimo Furrer <tfurrer@gitlab.com>
Co-authored-by: default avatarDavid Boxall <davidboxallnz@gmail.com>
No related branches found
No related tags found
无相关合并请求
......@@ -45,7 +45,8 @@ Example response:
"created_at": "2019-05-25T18:55:13.252Z",
"updated_at": "2019-05-27T18:55:13.252Z",
"enable_advanced_logs_querying": false,
"logs_api_path": "/project/-/logs/k8s.json?environment_name=review%2Ffix-foo"
"logs_api_path": "/project/-/logs/k8s.json?environment_name=review%2Ffix-foo",
"auto_stop_at": "2019-06-03T18:55:13.252Z"
}
]
```
......@@ -79,6 +80,7 @@ Example of response
"updated_at": "2019-05-27T18:55:13.252Z",
"enable_advanced_logs_querying": false,
"logs_api_path": "/project/-/logs/k8s.json?environment_name=review%2Ffix-foo",
"auto_stop_at": "2019-06-03T18:55:13.252Z",
"last_deployment": {
"id": 100,
"iid": 34,
......
......@@ -9,6 +9,7 @@ class Environment < Entities::EnvironmentBasic
expose :project, using: Entities::BasicProjectDetails
expose :last_deployment, using: Entities::Deployment, if: { last_deployment: true }
expose :state, documentation: { type: 'string', example: 'available' }
expose :auto_stop_at, documentation: { type: 'dateTime', example: '2019-05-25T18:55:13.252Z' }
end
end
end
......@@ -11,21 +11,56 @@
"updated_at"
],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"slug": { "type": "string" },
"tier": { "type": "string" },
"external_url": { "$ref": "../../types/nullable_string.json" },
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
},
"tier": {
"type": "string"
},
"external_url": {
"$ref": "../../types/nullable_string.json"
},
"last_deployment": {
"oneOf": [
{ "type": "null" },
{ "$ref": "deployment.json" }
{
"type": "null"
},
{
"$ref": "deployment.json"
}
]
},
"state": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"project": { "$ref": "project.json" }
"state": {
"type": "string"
},
"auto_stop_at": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"format": "date-time"
}
]
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"project": {
"$ref": "project.json"
}
},
"additionalProperties": false
}
......@@ -418,6 +418,34 @@
expect(response).to have_gitlab_http_status(:ok)
end
end
context "when auto_stop_at is present" do
before do
environment.update!(auto_stop_at: Time.current)
end
it "returns the expected response" do
get api("/projects/#{project.id}/environments/#{environment.id}", user)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environment')
expect(json_response['auto_stop_at']).to be_present
end
end
context "when auto_stop_at is not present" do
before do
environment.update!(auto_stop_at: nil)
end
it "returns the expected response" do
get api("/projects/#{project.id}/environments/#{environment.id}", user)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/environment')
expect(json_response['auto_stop_at']).to be_nil
end
end
end
context 'as non member' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册