Commit 4bbe48cb authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fix specs for GeoNode

parent 387877d4
...@@ -33,7 +33,7 @@ class GeoNode < ActiveRecord::Base ...@@ -33,7 +33,7 @@ class GeoNode < ActiveRecord::Base
def uri def uri
if relative_url_root if relative_url_root
relative_url = relative_url_root.starts_with?('/') ? relative_url_root : relative_url_root.prepend('/') relative_url = relative_url_root.starts_with?('/') ? relative_url_root : "/#{relative_url_root}"
end end
URI.parse(URI::Generic.build(scheme: schema, host: host, port: port, path: relative_url).normalize.to_s) URI.parse(URI::Generic.build(scheme: schema, host: host, port: port, path: relative_url).normalize.to_s)
...@@ -59,9 +59,9 @@ class GeoNode < ActiveRecord::Base ...@@ -59,9 +59,9 @@ class GeoNode < ActiveRecord::Base
def refresh_bulk_notify_worker_status def refresh_bulk_notify_worker_status
if Gitlab::Geo.primary? if Gitlab::Geo.primary?
Gitlab::Geo.bulk_notify_job.enable! Gitlab::Geo.bulk_notify_job.try(:enable!)
else else
Gitlab::Geo.bulk_notify_job.disable! Gitlab::Geo.bulk_notify_job.try(:disable!)
end end
end end
......
...@@ -116,6 +116,12 @@ FactoryGirl.define do ...@@ -116,6 +116,12 @@ FactoryGirl.define do
end end
factory :geo_node_key, class: 'GeoNodeKey' do factory :geo_node_key, class: 'GeoNodeKey' do
trait :another_key do
key do
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmTillFzNTrrGgwaCKaSj+QCz81E6jBc/s9av0+3b1Hwfxgkqjl4nAK/OD2NjgyrONDTDfR8cRN4eAAy6nY8GLkOyYBDyuc5nTMqs5z3yVuTwf3koGm/YQQCmo91psZ2BgDFTor8SVEE5Mm1D1k3JDMhDFxzzrOtRYFPci9lskTJaBjpqWZ4E9rDTD2q/QZntCqbC3wE9uSemRQB5f8kik7vD/AD8VQXuzKladrZKkzkONCPWsXDspUitjM8HkQdOf0PsYn1CMUC1xKYbCxkg5TkEosIwGv6CoEArUrdu/4+10LVslq494mAvEItywzrluCLCnwELfW+h/m8UHoVhZ"
end
end
end end
factory :personal_key do factory :personal_key do
...@@ -230,4 +236,16 @@ FactoryGirl.define do ...@@ -230,4 +236,16 @@ FactoryGirl.define do
noteable factory: :issue noteable factory: :issue
reply_key "0123456789abcdef" * 2 reply_key "0123456789abcdef" * 2
end end
factory :geo_node do
host { Gitlab.config.gitlab.host }
sequence(:port) {|n| n}
association :geo_node_key
trait :primary do
primary true
port { Gitlab.config.gitlab.port }
association :geo_node_key, :another_key
end
end
end end
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