Commit bbef37bd authored by Michael Kozono's avatar Michael Kozono

Merge branch 'ag-fix-oauth-app-for-secondary' into 'master'

Fix oauth failure on primary

See merge request gitlab-org/gitlab!47178
parents 6f5d3f90 4add03ac
---
title: 'Geo: Fix OAuth failure on primary'
merge_request: 47178
author:
type: fixed
...@@ -88,7 +88,7 @@ module Gitlab ...@@ -88,7 +88,7 @@ module Gitlab
end end
def self.oauth_authentication def self.oauth_authentication
return false unless Gitlab::Geo.secondary? return unless Gitlab::Geo.secondary?
self.cache_value(:oauth_application) do self.cache_value(:oauth_application) do
Gitlab::Geo.current_node.oauth_application || raise(OauthApplicationUndefinedError) Gitlab::Geo.current_node.oauth_application || raise(OauthApplicationUndefinedError)
......
...@@ -143,12 +143,24 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do ...@@ -143,12 +143,24 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end end
describe '.oauth_authentication' do describe '.oauth_authentication' do
before do context 'for Geo secondary' do
stub_secondary_node before do
stub_current_geo_node(secondary_node) stub_secondary_node
stub_current_geo_node(secondary_node)
end
it_behaves_like 'a Geo cached value', :oauth_authentication, :oauth_application
end end
it_behaves_like 'a Geo cached value', :oauth_authentication, :oauth_application context 'for Geo primary' do
before do
stub_current_geo_node(primary_node)
end
it 'returns nil' do
expect(described_class.oauth_authentication).to be_nil
end
end
end end
describe '.connected?' do describe '.connected?' do
......
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