Commit 38ec49a2 authored by James Lopez's avatar James Lopez

rename geo nodes failures endpoint to current/failures

parent a87e90e3
...@@ -144,7 +144,7 @@ Example response: ...@@ -144,7 +144,7 @@ Example response:
``` ```
GET /geo_nodes/failures GET /geo_nodes/current/failures
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
...@@ -154,7 +154,7 @@ GET /geo_nodes/failures ...@@ -154,7 +154,7 @@ GET /geo_nodes/failures
This endpoint uses [Pagination](README.md#pagination). This endpoint uses [Pagination](README.md#pagination).
```bash ```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/failures curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/current/failures
``` ```
Example response: Example response:
......
...@@ -36,7 +36,7 @@ module API ...@@ -36,7 +36,7 @@ module API
# Get project registry failures for the current Geo node # Get project registry failures for the current Geo node
# #
# Example request: # Example request:
# GET /geo_nodes/failures # GET /geo_nodes/current/failures
desc 'Get project registry failures for the current Geo node' do desc 'Get project registry failures for the current Geo node' do
success ::GeoProjectRegistryEntity success ::GeoProjectRegistryEntity
end end
...@@ -44,7 +44,7 @@ module API ...@@ -44,7 +44,7 @@ module API
optional :type, type: String, values: %w[wiki repository], desc: 'Type of failure (repository/wiki)' optional :type, type: String, values: %w[wiki repository], desc: 'Type of failure (repository/wiki)'
use :pagination use :pagination
end end
get '/failures' do get '/current/failures' do
geo_node = Gitlab::Geo.current_node geo_node = Gitlab::Geo.current_node
not_found('Geo node not found') unless geo_node not_found('Geo node not found') unless geo_node
......
...@@ -87,7 +87,7 @@ describe API::GeoNodes, :geo, api: true do ...@@ -87,7 +87,7 @@ describe API::GeoNodes, :geo, api: true do
end end
end end
describe 'GET /geo_nodes/failures/:type' do describe 'GET /geo_nodes/current/failures/:type' do
it 'fetches the current node failures' do it 'fetches the current node failures' do
create(:geo_project_registry, :sync_failed) create(:geo_project_registry, :sync_failed)
create(:geo_project_registry, :sync_failed) create(:geo_project_registry, :sync_failed)
...@@ -95,7 +95,7 @@ describe API::GeoNodes, :geo, api: true do ...@@ -95,7 +95,7 @@ describe API::GeoNodes, :geo, api: true do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
expect(Gitlab::Geo).to receive(:current_node).and_return(secondary) expect(Gitlab::Geo).to receive(:current_node).and_return(secondary)
get api("/geo_nodes/failures", admin) get api("/geo_nodes/current/failures", admin)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('geo_project_registry') expect(response).to match_response_schema('geo_project_registry')
...@@ -107,7 +107,7 @@ describe API::GeoNodes, :geo, api: true do ...@@ -107,7 +107,7 @@ describe API::GeoNodes, :geo, api: true do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
expect(Gitlab::Geo).to receive(:current_node).and_return(secondary) expect(Gitlab::Geo).to receive(:current_node).and_return(secondary)
get api("/geo_nodes/failures", admin) get api("/geo_nodes/current/failures", admin)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response.count).to be_zero expect(json_response.count).to be_zero
...@@ -121,7 +121,7 @@ describe API::GeoNodes, :geo, api: true do ...@@ -121,7 +121,7 @@ describe API::GeoNodes, :geo, api: true do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
expect(Gitlab::Geo).to receive(:current_node).and_return(secondary) expect(Gitlab::Geo).to receive(:current_node).and_return(secondary)
get api("/geo_nodes/failures?type=wiki", admin) get api("/geo_nodes/current/failures?type=wiki", admin)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response.count).to eq(1) expect(json_response.count).to eq(1)
...@@ -137,7 +137,7 @@ describe API::GeoNodes, :geo, api: true do ...@@ -137,7 +137,7 @@ describe API::GeoNodes, :geo, api: true do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
expect(Gitlab::Geo).to receive(:current_node).and_return(secondary) expect(Gitlab::Geo).to receive(:current_node).and_return(secondary)
get api("/geo_nodes/failures?type=repository", admin) get api("/geo_nodes/current/failures?type=repository", admin)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response.count).to eq(1) expect(json_response.count).to eq(1)
...@@ -149,14 +149,14 @@ describe API::GeoNodes, :geo, api: true do ...@@ -149,14 +149,14 @@ describe API::GeoNodes, :geo, api: true do
it 'returns a bad request' do it 'returns a bad request' do
create(:geo_project_registry, :repository_sync_failed) create(:geo_project_registry, :repository_sync_failed)
get api("/geo_nodes/failures?type=nonexistent", admin) get api("/geo_nodes/current/failures?type=nonexistent", admin)
expect(response).to have_gitlab_http_status(400) expect(response).to have_gitlab_http_status(400)
end end
end end
it 'denies access if not admin' do it 'denies access if not admin' do
get api("/geo_nodes/failures", user) get api("/geo_nodes/current/failures", user)
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(403)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment