Commit e6757060 authored by Gabriel Mazetto's avatar Gabriel Mazetto

remove refresh_key endpoint and fix specs

parent b331b7bc
...@@ -23,15 +23,6 @@ module API ...@@ -23,15 +23,6 @@ module API
::Geo::ScheduleWikiRepoUpdateService.new(params[:projects]).execute ::Geo::ScheduleWikiRepoUpdateService.new(params[:projects]).execute
end end
# Enqueue a change operation for specific key ID
#
# Example request:
# POST /geo/refresh_key
post 'refresh_key' do
required_attributes! %w(event_name key id)
::Geo::ScheduleKeyChangeService.new(params).execute
end
# Receive event streams from primary and enqueue changes # Receive event streams from primary and enqueue changes
# #
# Example request: # Example request:
......
...@@ -79,15 +79,4 @@ describe Gitlab::Geo, lib: true do ...@@ -79,15 +79,4 @@ describe Gitlab::Geo, lib: true do
described_class.notify_project_update(project) described_class.notify_project_update(project)
end end
end end
describe 'notify_ssh_key_change' do
let(:key) { FactoryGirl.build(:key) }
it 'schedule async notification' do
expect(GeoKeyChangeNotifyWorker).to receive(:perform_async).and_call_original
expect_any_instance_of(GeoKeyChangeNotifyWorker).to receive(:perform)
described_class.notify_key_change(key.id, key, 'create')
end
end
end end
...@@ -19,7 +19,7 @@ describe API::API, api: true do ...@@ -19,7 +19,7 @@ describe API::API, api: true do
end end
end end
describe 'POST /geo/refresh_key' do describe 'POST /geo/receive_events' do
before(:each) { allow_any_instance_of(::Geo::ScheduleKeyChangeService).to receive(:execute) } before(:each) { allow_any_instance_of(::Geo::ScheduleKeyChangeService).to receive(:execute) }
let(:key_create_payload) do let(:key_create_payload) do
{ {
...@@ -44,17 +44,17 @@ describe API::API, api: true do ...@@ -44,17 +44,17 @@ describe API::API, api: true do
end end
it 'enqueues on disk key creation if admin and correct params' do it 'enqueues on disk key creation if admin and correct params' do
post api('/geo/refresh_key', admin), key_create_payload post api('/geo/receive_events', admin), key_create_payload
expect(response.status).to eq 201 expect(response.status).to eq 201
end end
it 'enqueues on disk key removal if admin and correct params' do it 'enqueues on disk key removal if admin and correct params' do
post api('/geo/refresh_key', admin), key_destroy_payload post api('/geo/receive_events', admin), key_destroy_payload
expect(response.status).to eq 201 expect(response.status).to eq 201
end end
it 'denies access if not admin' do it 'denies access if not admin' do
post api('/geo/refresh_key', user) post api('/geo/receive_events', user)
expect(response.status).to eq 403 expect(response.status).to eq 403
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