Commit f5031f84 authored by Dan Davison's avatar Dan Davison

Merge branch 'ml-update-blank-repo-no-branch-tests' into 'master'

Fix e2e tests that fail when the default branch is 'main'

See merge request gitlab-org/gitlab!52041
parents 800c34e6 ebacad4e
...@@ -25,10 +25,6 @@ module QA ...@@ -25,10 +25,6 @@ module QA
attribute :template_name attribute :template_name
attribute :import attribute :import
attribute :default_branch do
api_response[:default_branch] || Runtime::Env.default_branch
end
attribute :group do attribute :group do
Group.fabricate! Group.fabricate!
end end
...@@ -224,6 +220,10 @@ module QA ...@@ -224,6 +220,10 @@ module QA
parse_body(get(Runtime::API::Request.new(api_client, api_commits_path).url)) parse_body(get(Runtime::API::Request.new(api_client, api_commits_path).url))
end end
def default_branch
reload!.api_response[:default_branch] || Runtime::Env.default_branch
end
def import_status def import_status
response = get Runtime::API::Request.new(api_client, "/projects/#{id}/import").url response = get Runtime::API::Request.new(api_client, "/projects/#{id}/import").url
......
...@@ -12,14 +12,11 @@ module QA ...@@ -12,14 +12,11 @@ module QA
end end
end end
def branch_name
@branch_name ||= wiki.project.default_branch
end
def initialize def initialize
@file_name = 'Home.md' @file_name = 'Home.md'
@file_content = 'This line was created using git push' @file_content = 'This line was created using git push'
@commit_message = 'Updating using git push' @commit_message = 'Updating using git push'
@branch_name = 'master'
@new_branch = false @new_branch = false
end end
......
...@@ -14,10 +14,12 @@ module QA ...@@ -14,10 +14,12 @@ module QA
Git::Repository.perform do |repository| Git::Repository.perform do |repository|
repository.uri = project.repository_http_location.uri repository.uri = project.repository_http_location.uri
repository.use_default_credentials repository.use_default_credentials
repository.default_branch = project.default_branch
repository.act do repository.act do
clone clone
configure_identity('GitLab QA', 'root@gitlab.com') configure_identity('GitLab QA', 'root@gitlab.com')
checkout(default_branch, new_branch: true)
commit_file('test.rb', 'class Test; end', 'Add Test class') commit_file('test.rb', 'class Test; end', 'Add Test class')
commit_file('README.md', '# Test', 'Add Readme') commit_file('README.md', '# Test', 'Add Readme')
push_changes push_changes
......
...@@ -26,6 +26,8 @@ module QA ...@@ -26,6 +26,8 @@ module QA
repository.use_default_credentials repository.use_default_credentials
repository.clone repository.clone
repository.configure_identity(username, email) repository.configure_identity(username, email)
repository.default_branch = project.default_branch
repository.checkout(project.default_branch, new_branch: true)
git_protocol_reported = repository.push_with_git_protocol( git_protocol_reported = repository.push_with_git_protocol(
git_protocol, git_protocol,
......
...@@ -49,6 +49,8 @@ module QA ...@@ -49,6 +49,8 @@ module QA
repository.use_ssh_key(ssh_key) repository.use_ssh_key(ssh_key)
repository.clone repository.clone
repository.configure_identity(username, email) repository.configure_identity(username, email)
repository.default_branch = project.default_branch
repository.checkout(project.default_branch, new_branch: true)
git_protocol_reported = repository.push_with_git_protocol( git_protocol_reported = repository.push_with_git_protocol(
git_protocol, git_protocol,
......
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