2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe API::CircuitBreakers do
|
2018-12-13 13:39:08 +05:30
|
|
|
set(:user) { create(:user) }
|
|
|
|
set(:admin) { create(:admin) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
describe 'GET circuit_breakers/repository_storage' do
|
|
|
|
it 'returns a 401 for anonymous users' do
|
|
|
|
get api('/circuit_breakers/repository_storage')
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(401)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns a 403 for users' do
|
|
|
|
get api('/circuit_breakers/repository_storage', user)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(403)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns an Array of storages' do
|
|
|
|
get api('/circuit_breakers/repository_storage', admin)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(200)
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(json_response).to be_kind_of(Array)
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(json_response).to be_empty
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET circuit_breakers/repository_storage/failing' do
|
|
|
|
it 'returns an array of failing storages' do
|
|
|
|
get api('/circuit_breakers/repository_storage/failing', admin)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(200)
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(json_response).to be_kind_of(Array)
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(json_response).to be_empty
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'DELETE circuit_breakers/repository_storage' do
|
|
|
|
it 'clears all circuit_breakers' do
|
|
|
|
delete api('/circuit_breakers/repository_storage', admin)
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(204)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|