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

Jonathan Riddell jriddell-guest at moszumanska.debian.org
Tue Jan 12 16:14:48 UTC 2016


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

The following commit has been merged in the master branch:
commit bc03144ae2884f572179a2e68768dbcd9748afc8
Author: Jonathan Riddell <jr at jriddell.org>
Date:   Tue Jan 12 16:14:35 2016 +0000

    add tests for custom_ci mode
---
 lib/projects.rb                                    |  4 ++++
 .../data/test_projects/test_custom_ci/invalid.json | 11 +++++++++
 .../test_projects/test_custom_ci/projects.json     | 18 +++++++++++++++
 test/test_projects.rb                              | 27 ++++++++++++++++++++++
 4 files changed, 60 insertions(+)

diff --git a/lib/projects.rb b/lib/projects.rb
index 70dd4b3..e9397cf 100644
--- a/lib/projects.rb
+++ b/lib/projects.rb
@@ -230,6 +230,10 @@ class ProjectFactory
       end
     when 'custom_ci'
       value.each do |custom_ci|
+        unless custom_ci['type'] == 'github' ||
+               custom_ci['type'] == 'neon'
+          fail "Unknown type #{custom_ci['type']}"
+        end
         repos = []
         if custom_ci['type'] == 'github'
           require 'octokit'
diff --git a/test/data/test_projects/test_custom_ci/invalid.json b/test/data/test_projects/test_custom_ci/invalid.json
new file mode 100644
index 0000000..e868a38
--- /dev/null
+++ b/test/data/test_projects/test_custom_ci/invalid.json
@@ -0,0 +1,11 @@
+{
+  "custom_ci": [
+    {
+      "type": "FOO",
+      "org": "",
+      "repos": [
+            "foo"
+      ]
+    }
+  ]
+}
diff --git a/test/data/test_projects/test_custom_ci/projects.json b/test/data/test_projects/test_custom_ci/projects.json
new file mode 100644
index 0000000..887fe59
--- /dev/null
+++ b/test/data/test_projects/test_custom_ci/projects.json
@@ -0,0 +1,18 @@
+{
+    "custom_ci" : [
+        {
+          "type" : "github",
+          "org"  : "plasma-phone-packaging",
+          "repos" : [
+            "simplelogin-packaging"
+            ]
+        },
+        {
+          "type" : "neon",
+          "org"  : "",
+          "repos" : [
+            "neon-seeds"
+          ]
+        }
+    ]        
+}
diff --git a/test/test_projects.rb b/test/test_projects.rb
index fae1d47..c36eee5 100644
--- a/test/test_projects.rb
+++ b/test/test_projects.rb
@@ -193,6 +193,33 @@ class ProjectTest < TestCase
     assert_not_include(output, 'file1')
   end
 
+  def test_custom_ci
+    assert_raise RuntimeError do
+      Projects.new(type: 'unstable', allow_custom_ci: true, projects_file: data('invalid.json'))
+    end
+
+    projects = Projects.new(type: 'unstable', allow_custom_ci: true,
+                            projects_file: data('projects.json'))
+    assert_equal(2, projects.size)
+    pro = projects[0]
+    assert_equal('simplelogin-packaging', pro.name)
+    assert_equal('plasma-phone-packaging', pro.component)
+    assert_equal('git', pro.packaging_scm.type)
+    assert_equal("https://github.com/plasma-phone-packaging/simplelogin-packaging", pro.packaging_scm.url)
+    assert_equal('kubuntu_unstable', pro.packaging_scm.branch)
+    assert_equal('git', pro.upstream_scm.type)
+    assert_equal('git://anongit.kde.org/scratch/davidedmundson/simplelogin.git', pro.upstream_scm.url)
+
+    pro = projects[1]
+    assert_equal('neon-seeds', pro.name)
+    assert_equal('', pro.component)
+    assert_equal('git', pro.packaging_scm.type)
+    assert_equal("git://packaging.neon.kde.org.uk/neon-seeds", pro.packaging_scm.url)
+    assert_equal('kubuntu_unstable', pro.packaging_scm.branch)
+  ensure
+    Project.default_url = Project::DEFAULT_URL
+  end
+
   def test_static_ci
     repo_base = "#{Dir.pwd}/repo"
     git_init_commit(git_init_repo("#{repo_base}/pkg-kde/qt/qtx11extras"),

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list