Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-02-18 08:29:22 +0300
committerStan Hu <stanhu@gmail.com>2018-02-18 08:30:29 +0300
commit46e6a9f8a0f2dc0ae4e3152646f319a7cb5abcb2 (patch)
tree9b5a2f638c67c3c46975827a794d019986508a7e /spec/models
parent557db7e635c70bf68a15f7029014301013b30070 (diff)
Don't attempt to update user tracked fields if database is in read-only
With Geo, attempting to view an endpoint with a user could result in an Error 500 since Devise attempts to update the last sign-in IP and other details. Closes gitlab-org/gitlab-ee#4972
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/user_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 1815696a8a0..3531de244bd 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -496,6 +496,14 @@ describe User do
user2.update_tracked_fields!(request)
end.to change { user2.reload.current_sign_in_at }
end
+
+ it 'does not write if the DB is in read-only mode' do
+ expect(Gitlab::Database).to receive(:read_only?).and_return(true)
+
+ expect do
+ user.update_tracked_fields!(request)
+ end.not_to change { user.reload.current_sign_in_at }
+ end
end
shared_context 'user keys' do