Commit e874cc36 authored by Toon Claes's avatar Toon Claes

Test project page load with unrecognized LICENSE

We've had an incident [1] where the project page gave 500 in case Gitaly
returned a license the Licensee gem did not recognize. This issue was
fixed with [2].

To prevent this error to happen again, add another test to verify if the
project page still loads when license detected by Gitaly is not
recognized by Licensee.

1. https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5478
2. https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69878

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/340288
parent f810b383
......@@ -312,6 +312,17 @@ RSpec.describe ProjectsController do
expect { get_show }.not_to change { Gitlab::GitalyClient.get_request_count }
end
it "renders files even with invalid license" do
controller.instance_variable_set(:@project, public_project)
expect(public_project.repository).to receive(:license_key).and_return('woozle wuzzle').at_least(:once)
get_show
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('_files')
expect(response.body).to have_content('LICENSE') # would be 'MIT license' if stub not works
end
end
context "when the url contains .atom" do
......
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