OpenSourcePolitics / decidim-cd44

Decidim instance for Loire-Atlantique
https://participer.loire-atlantique.fr/
0 stars 1 forks source link

Rack Attack investigate failing spec #128

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

it "successful for 100 requests, then blocks the user" do

100.times do

get decidim.root_path, params: {}, headers: headers

expect(response).to have_http_status(:ok)

end

get decidim.root_path, params: {}, headers: headers

expect(response).to have_http_status(:too_many_requests)

expect(response.body).to include("Your connection has been slowed because server received too many requests.")#

travel_to(1.minute.from_now) do

get decidim.root_path, params: {}, headers: headers

expect(response).to have_http_status(:ok)

end

end

https://api.github.com/OpenSourcePolitics/decidim-cd44/blob/4c9294be52073499ffa9d25e535a13e413145501/spec/lib/decidim_app/rack_attack_spec.rb#L78


        expect(DecidimApp::RackAttack::Throttling.max_requests).to eq(100)
        expect(DecidimApp::RackAttack::Throttling.period).to eq(60)
      end
# TODO: Rack Attack investigate failing spec
#      it "successful for 100 requests, then blocks the user" do
#        100.times do
#          get decidim.root_path, params: {}, headers: headers
#          expect(response).to have_http_status(:ok)
#        end
#
#        get decidim.root_path, params: {}, headers: headers
#        expect(response).to have_http_status(:too_many_requests)
#        expect(response.body).to include("Your connection has been slowed because server received too many requests.")#
#
#        travel_to(1.minute.from_now) do
#          get decidim.root_path, params: {}, headers: headers
#          expect(response).to have_http_status(:ok)
#        end
#      end

      it "successful for 99 requests" do
        99.times do
github-actions[bot] commented 1 year ago

Closed in d0903c50199d3cbfbac93dd10a6ce049144f34d1