Loading lib/api/geo.rb +0 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ class Geo < Grape::API # GET /geo/status get 'status' do authenticate_by_gitlab_geo_node_token! require_node_to_be_secondary! status = ::GeoNodeStatus.current_node_status present status, with: GeoNodeStatusEntity Loading @@ -57,10 +56,6 @@ def authenticate_by_gitlab_geo_node_token! def require_node_to_be_enabled! forbidden! 'Geo node is disabled.' unless Gitlab::Geo.current_node&.enabled? end def require_node_to_be_secondary! forbidden! 'Geo node is not secondary node.' unless Gitlab::Geo.current_node&.secondary? end end end end spec/fixtures/api/schemas/geo_node_status.json +8 −8 Original line number Diff line number Diff line Loading @@ -38,21 +38,21 @@ "health_status": { "type": "string" }, "missing_oauth_application": { "type": "boolean" }, "attachments_count": { "type": "integer" }, "attachments_failed_count": { "type": "integer" }, "attachments_synced_count": { "type": "integer" }, "attachments_failed_count": { "type": ["integer", "null"] }, "attachments_synced_count": { "type": ["integer", "null"] }, "attachments_synced_in_percentage": { "type": "string" }, "db_replication_lag_seconds": { "type": ["integer", "null"] }, "lfs_objects_count": { "type": "integer" }, "lfs_objects_failed_count": { "type": "integer" }, "lfs_objects_synced_count": { "type": "integer" }, "lfs_objects_failed_count": { "type": ["integer", "null"] }, "lfs_objects_synced_count": { "type": ["integer", "null"] }, "lfs_objects_synced_in_percentage": { "type": "string" }, "repositories_count": { "type": "integer" }, "repositories_failed_count": { "type": "integer" }, "repositories_synced_count": { "type": "integer" }, "repositories_failed_count": { "type": ["integer", "null"] }, "repositories_synced_count": { "type": ["integer", "null"] }, "repositories_synced_in_percentage": { "type": "string" }, "wikis_count": { "type": "integer" }, "wikis_failed_count": { "type": "integer" }, "wikis_synced_count": { "type": "integer" }, "wikis_failed_count": { "type": ["integer", "null"] }, "wikis_synced_count": { "type": ["integer", "null"] }, "wikis_synced_in_percentage": { "type": "string" }, "replication_slots_count": { "type": ["integer", "null"] }, "replication_slots_used_count": { "type": ["integer", "null"] }, Loading spec/requests/api/geo_spec.rb +3 −2 Original line number Diff line number Diff line Loading @@ -195,10 +195,11 @@ allow(request).to receive(:requesting_node) { secondary_node } end it 'responds with 403' do it 'responds with 200' do get api('/geo/status'), nil, request.headers expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(200) expect(response).to match_response_schema('geo_node_status') end end end Loading Loading
lib/api/geo.rb +0 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ class Geo < Grape::API # GET /geo/status get 'status' do authenticate_by_gitlab_geo_node_token! require_node_to_be_secondary! status = ::GeoNodeStatus.current_node_status present status, with: GeoNodeStatusEntity Loading @@ -57,10 +56,6 @@ def authenticate_by_gitlab_geo_node_token! def require_node_to_be_enabled! forbidden! 'Geo node is disabled.' unless Gitlab::Geo.current_node&.enabled? end def require_node_to_be_secondary! forbidden! 'Geo node is not secondary node.' unless Gitlab::Geo.current_node&.secondary? end end end end
spec/fixtures/api/schemas/geo_node_status.json +8 −8 Original line number Diff line number Diff line Loading @@ -38,21 +38,21 @@ "health_status": { "type": "string" }, "missing_oauth_application": { "type": "boolean" }, "attachments_count": { "type": "integer" }, "attachments_failed_count": { "type": "integer" }, "attachments_synced_count": { "type": "integer" }, "attachments_failed_count": { "type": ["integer", "null"] }, "attachments_synced_count": { "type": ["integer", "null"] }, "attachments_synced_in_percentage": { "type": "string" }, "db_replication_lag_seconds": { "type": ["integer", "null"] }, "lfs_objects_count": { "type": "integer" }, "lfs_objects_failed_count": { "type": "integer" }, "lfs_objects_synced_count": { "type": "integer" }, "lfs_objects_failed_count": { "type": ["integer", "null"] }, "lfs_objects_synced_count": { "type": ["integer", "null"] }, "lfs_objects_synced_in_percentage": { "type": "string" }, "repositories_count": { "type": "integer" }, "repositories_failed_count": { "type": "integer" }, "repositories_synced_count": { "type": "integer" }, "repositories_failed_count": { "type": ["integer", "null"] }, "repositories_synced_count": { "type": ["integer", "null"] }, "repositories_synced_in_percentage": { "type": "string" }, "wikis_count": { "type": "integer" }, "wikis_failed_count": { "type": "integer" }, "wikis_synced_count": { "type": "integer" }, "wikis_failed_count": { "type": ["integer", "null"] }, "wikis_synced_count": { "type": ["integer", "null"] }, "wikis_synced_in_percentage": { "type": "string" }, "replication_slots_count": { "type": ["integer", "null"] }, "replication_slots_used_count": { "type": ["integer", "null"] }, Loading
spec/requests/api/geo_spec.rb +3 −2 Original line number Diff line number Diff line Loading @@ -195,10 +195,11 @@ allow(request).to receive(:requesting_node) { secondary_node } end it 'responds with 403' do it 'responds with 200' do get api('/geo/status'), nil, request.headers expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(200) expect(response).to match_response_schema('geo_node_status') end end end Loading