Commit 70f220dc authored by Ramya Authappan's avatar Ramya Authappan

Merge branch '217002-resolve-variable-shadowing' into 'master'

Resolve user variable name conflict

Closes #217002

See merge request gitlab-org/gitlab!40565
parents ba7a0f2f e323eb14
...@@ -18,7 +18,7 @@ module QA ...@@ -18,7 +18,7 @@ module QA
attr_reader :api_resource, :api_response attr_reader :api_resource, :api_response
attr_writer :api_client attr_writer :api_client
attr_accessor :user attr_accessor :api_user
def api_support? def api_support?
respond_to?(:api_get_path) && respond_to?(:api_get_path) &&
...@@ -120,7 +120,7 @@ module QA ...@@ -120,7 +120,7 @@ module QA
def api_client def api_client
@api_client ||= begin @api_client ||= begin
Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: user) Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: api_user)
end end
end end
......
...@@ -73,7 +73,7 @@ module QA ...@@ -73,7 +73,7 @@ module QA
def api_post_body def api_post_body
{ {
namespace: user.username, namespace_path: user.username,
name: name, name: name,
path: name path: name
} }
......
...@@ -9,7 +9,6 @@ module QA ...@@ -9,7 +9,6 @@ module QA
attribute :sandbox do attribute :sandbox do
Sandbox.fabricate_via_api! do |sandbox| Sandbox.fabricate_via_api! do |sandbox|
sandbox.user = user
sandbox.api_client = api_client sandbox.api_client = api_client
end end
end end
......
...@@ -148,7 +148,7 @@ module QA ...@@ -148,7 +148,7 @@ module QA
end end
def fetching_own_data? def fetching_own_data?
user&.username == username || Runtime::User.username == username api_user&.username == username || Runtime::User.username == username
end end
end end
end end
......
...@@ -51,7 +51,6 @@ module QA ...@@ -51,7 +51,6 @@ module QA
project.add_name_uuid = false project.add_name_uuid = false
project.name = project_name project.name = project_name
project.path_with_namespace = "#{user.username}/#{project_name}" project.path_with_namespace = "#{user.username}/#{project_name}"
project.user = user
project.api_client = api_client project.api_client = api_client
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
RSpec.describe 'Create', :orchestrated, :repository_storage, :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217002', type: :investigating } do RSpec.describe 'Create', :orchestrated, :repository_storage, :requires_admin do
describe 'Gitaly repository storage' do describe 'Gitaly repository storage' do
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:parent_project) do let(:parent_project) do
...@@ -30,7 +30,7 @@ module QA ...@@ -30,7 +30,7 @@ module QA
parent_project.change_repository_storage(QA::Runtime::Env.additional_repository_storage) parent_project.change_repository_storage(QA::Runtime::Env.additional_repository_storage)
second_fork_project = Resource::Fork.fabricate_via_api! do |fork| second_fork_project = Resource::Fork.fabricate_via_api! do |fork|
fork.name = "second-fork" fork.name = "second-fork-of-#{parent_project.name}"
fork.user = user fork.user = user
fork.upstream = parent_project fork.upstream = parent_project
end.project end.project
......
...@@ -50,7 +50,6 @@ module QA ...@@ -50,7 +50,6 @@ module QA
@group = Resource::Group.fabricate_via_api! do |group| @group = Resource::Group.fabricate_via_api! do |group|
group.path = 'template-group' group.path = 'template-group'
group.user = admin
group.api_client = @api_client group.api_client = @api_client
end end
...@@ -61,7 +60,6 @@ module QA ...@@ -61,7 +60,6 @@ module QA
project.description = 'Add group file templates' project.description = 'Add group file templates'
project.auto_devops_enabled = false project.auto_devops_enabled = false
project.initialize_with_readme = true project.initialize_with_readme = true
project.user = admin
project.api_client = @api_client project.api_client = @api_client
end end
...@@ -72,7 +70,6 @@ module QA ...@@ -72,7 +70,6 @@ module QA
commit.project = @file_template_project commit.project = @file_template_project
commit.commit_message = 'Add group file templates' commit.commit_message = 'Add group file templates'
commit.add_files(templates) commit.add_files(templates)
commit.user = admin
commit.api_client = @api_client commit.api_client = @api_client
end end
...@@ -82,7 +79,6 @@ module QA ...@@ -82,7 +79,6 @@ module QA
project.description = 'Add files for group file templates' project.description = 'Add files for group file templates'
project.auto_devops_enabled = false project.auto_devops_enabled = false
project.initialize_with_readme = true project.initialize_with_readme = true
project.user = admin
project.api_client = @api_client project.api_client = @api_client
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