summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-06-04 17:19:42 +0200
committerDylan Griffith <dyl.griffith@gmail.com>2018-06-05 18:39:05 +0200
commit1defb950aca710a23e99bfc913ff93755e5fa861 (patch)
tree13d61f41dd26b91b70316da60f40035950c9c754 /qa
parent282c09ed91fac544e1f7e9b9430ef9e2e82e9d29 (diff)
downloadgitlab-ce-1defb950aca710a23e99bfc913ff93755e5fa861.tar.gz
Update Factory::Repository::Push to allow pushing directory to simplfy auto devops spec
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/factory/repository/push.rb19
-rw-r--r--qa/qa/specs/features/project/auto_devops_spec.rb26
2 files changed, 25 insertions, 20 deletions
diff --git a/qa/qa/factory/repository/push.rb b/qa/qa/factory/repository/push.rb
index 795f1f9cb1a..e302f5398df 100644
--- a/qa/qa/factory/repository/push.rb
+++ b/qa/qa/factory/repository/push.rb
@@ -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
- repository.add_file(file_name, file_content)
+ 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
diff --git a/qa/qa/specs/features/project/auto_devops_spec.rb b/qa/qa/specs/features/project/auto_devops_spec.rb
index 4ab4135a11c..2d4647451ec 100644
--- a/qa/qa/specs/features/project/auto_devops_spec.rb
+++ b/qa/qa/specs/features/project/auto_devops_spec.rb
@@ -16,26 +16,16 @@ 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
- 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")
+ 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
+ Page::Project::Show.act { wait_for_push }
+
# Create and connect K8s cluster
@cluster = Service::KubernetesCluster.new.create!
kubernetes_cluster = Factory::Resource::KubernetesCluster.fabricate! do |c|