Add end-to-end test for the replication lag message when pushing over HTTP to a Geo secondary node
Proposal
After https://gitlab.com/gitlab-org/gitlab-ee/issues/9195, we should probably add an end-to-end test for the replication lag message when pushing over HTTP to a Geo secondary node.
Because the request lifecycle is somewhat long and complex: https://gitlab.com/gitlab-org/gitlab-ee/issues/9195#note_205669545
And e.g. request specs only exercise Rails.
sequenceDiagram
participant C as Git client
participant N as NGINX
participant W as Workhorse
participant R as Rails
participant G as Gitaly
note over C: After redirect from secondary<br/>Request against primary node
C->>N: GET /geo-node-referrer/2/foo/bar.git/info/refs/?service=git-receive-pack
N->>W:
W->>R:
R-->>W: 401 Unauthorized
W-->>N:
N-->>C:
C->>N: GET /geo-node-referrer/2/foo/bar.git/info/refs/?service=git-receive-pack
N->>W:
W->>R:
R-->>W: Render Workhorse OK
W-->>N:
N-->>C:
C->>N: POST /geo-node-referrer/2/foo/bar.git/git-receive-pack
N->>W:
W->>R: GitHttpController#git_receive_pack
note over R: Cache<br/>params[:geo_node_referrer_id]
R-->>W: Render Workhorse OK
W->>G: Workhorse gets the connection details from Rails, connects to Gitaly: SmartHTTP Service, ReceivePack RPC (check the proto for details)
G->>R: POST /api/v4/internal/allowed
R->>G: 200 OK
G->>R: POST /api/v4/internal/post_receive
note over R: Fetch Geo node referrer.<br/>And add lag message<br/>to this response.
R->>G: 200 OK
G-->>W: Return a stream of Proto messages
W-->>N: Pipe these messages through, no transformation
N-->>C: Pipe messages to the Git client
cc @jennielouie Feel free to close or modify as you wish.