Commit 5859a258 authored by Sean McGivern's avatar Sean McGivern

Set project correctly in Sidekiq logs when creating a project

Our Sidekiq logs take context (user, project, etc.) from the place where
they were invoked - typically a controller or API endpoint. They weren't
set correctly when we created a project, because in that case the
project doesn't exist when we start processing the request.
parent 99afaa62
......@@ -55,7 +55,11 @@ module Projects
save_project_and_import_data
after_create_actions if @project.persisted?
if @project.persisted?
Gitlab::ApplicationContext.with_context(related_class: "Projects::CreateService", project: @project) do
after_create_actions
end
end
import_schedule
......
......@@ -48,6 +48,12 @@ RSpec.describe Projects::CreateService, '#execute' do
expect(project.project_setting).to be_new_record
end
it_behaves_like 'storing arguments in the application context' do
let(:expected_params) { { project: subject.full_path, related_class: described_class.to_s } }
subject { create_project(user, opts) }
end
end
context "admin creates project with other user's namespace_id" 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