[SCM] ci-tooling packaging branch, master, updated. 406fe619eec7efd5f55d059e5f6764e17a621cf3

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Nov 30 11:24:44 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=a2e0580

The following commit has been merged in the master branch:
commit a2e05806cb9b88dada3012666a8273185fbf3996
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Nov 30 11:58:45 2015 +0100

    detach test_array_init_unstable from git.debian.org by faking it
---
 .../{test_init_branch => test_array_init_unstable} |  0
 test/test_projects.rb                              | 46 +++++++++++++++-------
 2 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/test/data/test_projects/test_init_branch b/test/data/test_projects/test_array_init_unstable
similarity index 100%
copy from test/data/test_projects/test_init_branch
copy to test/data/test_projects/test_array_init_unstable
diff --git a/test/test_projects.rb b/test/test_projects.rb
index 35c3d09..cff79d0 100644
--- a/test/test_projects.rb
+++ b/test/test_projects.rb
@@ -16,25 +16,33 @@ class ProjectFactory
 end
 
 class ProjectTest < TestCase
-  def create_fake_git(name:, component:, branches:)
-    path = "#{component}/#{name}"
-
-    remotetmpdir = Dir.mktmpdir(self.class.to_s)
-    Dir.chdir(remotetmpdir) do
-      FileUtils.mkpath(path)
-      Dir.chdir(path) do
-        `git init --bare`
-      end
-
-      `git clone #{remotetmpdir}/tc/tn clone`
-      Dir.chdir('clone') do
+  def git_init_commit(repo, branches = %w(master))
+    repo = File.absolute_path(repo)
+    Dir.mktmpdir do |dir|
+      `git clone #{repo} #{dir}`
+      Dir.chdir(dir) do
         FileUtils.cp_r("#{data}/debian", '.')
         `git add *`
         `git commit -m 'commitmsg'`
         branches.each { |branch| `git branch #{branch}` }
         `git push --all origin`
       end
-      FileUtils.rm_rf('clone')
+    end
+  end
+
+  def git_init_repo(path)
+    FileUtils.mkpath(path)
+    Dir.chdir(path) { `git init --bare` }
+    File.absolute_path(path)
+  end
+
+  def create_fake_git(name:, component:, branches:)
+    path = "#{component}/#{name}"
+
+    remotetmpdir = Dir.mktmpdir(self.class.to_s)
+    Dir.chdir(remotetmpdir) do
+      git_init_repo(path)
+      git_init_commit(path, branches)
     end
     remotetmpdir
   end
@@ -143,7 +151,15 @@ class ProjectTest < TestCase
   end
 
   def test_array_init_unstable
-    # FIXME: this still goes through git.debian
+    repos = "#{Dir.pwd}/repo"
+    %w(plasma/kinfocenter kde-applications/gwenview).each do |path|
+      r = "#{repos}/#{path}"
+      git_init_commit(git_init_repo(r), %w(master kubuntu_unstable))
+    end
+
+    url = Project.default_url
+    Project.default_url = repos
+
     reference_projects = %w(kinfocenter gwenview)
     projects = Projects.new(type: 'unstable',
                             projects_file: "#{@datadir}/projects.json")
@@ -154,6 +170,8 @@ class ProjectTest < TestCase
       tmpref.delete_if { |name| name == project.name }
     end
     assert_equal(tmpref.size, 0)
+  ensure
+    Project.default_url = url
   end
 
   def test_cleanup_uri

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list