Commit 4add03ac authored by Aakriti Gupta's avatar Aakriti Gupta

Don't return boolean for oauth on Geo primary

parent a4d3e18f
---
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,6 +143,7 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do ...@@ -143,6 +143,7 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end end
describe '.oauth_authentication' do describe '.oauth_authentication' do
context 'for Geo secondary' do
before do before do
stub_secondary_node stub_secondary_node
stub_current_geo_node(secondary_node) stub_current_geo_node(secondary_node)
...@@ -151,6 +152,17 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do ...@@ -151,6 +152,17 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
it_behaves_like 'a Geo cached value', :oauth_authentication, :oauth_application it_behaves_like 'a Geo cached value', :oauth_authentication, :oauth_application
end end
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
describe '.connected?' do describe '.connected?' do
context 'when there is a database issue' do context 'when there is a database issue' do
it 'returns false when database connection is down' do it 'returns false when database connection is down' 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