Commit 1defb950 authored by Dylan Griffith's avatar Dylan Griffith

Update Factory::Repository::Push to allow pushing directory to simplfy auto devops spec

parent 282c09ed
......@@ -15,15 +15,23 @@ module QA
def initialize
@file_name = 'file.txt'
@file_content = '# This is test project'
@commit_message = "Add #{@file_name}"
@commit_message = "This is a test commit"
@branch_name = 'master'
@new_branch = true
@pushing_directory = false
end
def remote_branch
@remote_branch ||= branch_name
end
def directory=(dir)
raise "Must set directory as a Pathname" unless dir.is_a?(Pathname)
@directory = dir
@pushing_directory = true
end
def fabricate!
project.visit!
......@@ -43,7 +51,14 @@ module QA
repository.checkout(branch_name)
end
if @pushing_directory
@directory.each_child do |f|
repository.add_file(f.basename, f.read) if f.file?
end
else
repository.add_file(file_name, file_content)
end
repository.commit(commit_message)
repository.push_changes("#{branch_name}:#{remote_branch}")
end
......
......@@ -16,25 +16,15 @@ module QA
end
# Create Auto Devops compatible repo
project.visit!
Git::Repository.perform do |repository|
repository.uri = Page::Project::Show.act do
choose_repository_clone_http
repository_location.uri
Factory::Repository::Push.fabricate! do |push|
push.project = project
push.directory = Pathname
.new(__dir__)
.join('../../../fixtures/auto_devops_rack')
push.commit_message = 'Create Auto DevOps compatible rack application'
end
repository.use_default_credentials
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
repository.checkout_new_branch('master')
repository.add_file('config.ru', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/config.ru")))
repository.add_file('Gemfile', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Gemfile")))
repository.add_file('Gemfile.lock', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Gemfile.lock")))
repository.add_file('Rakefile', File.read(File.join(__dir__, "../../../fixtures/auto_devops_rack/Rakefile")))
repository.commit('Create auto devops repo')
repository.push_changes("master:master")
end
Page::Project::Show.act { wait_for_push }
# Create and connect K8s cluster
@cluster = Service::KubernetesCluster.new.create!
......
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