Commit 1968f5d3 authored by Nick Thomas's avatar Nick Thomas Committed by Robert Speicher
Browse files

Merge branch '4518-geo-secondary-can-t-query-geo-node-status-from-primary' into 'master'

Resolve "Geo secondary can't query geo node status from primary"

Closes #4518

See merge request gitlab-org/gitlab-ee!3997
parent b624f491
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -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
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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"] },
+3 −2
Original line number Diff line number Diff line
@@ -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