summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-02-10 10:49:29 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:47:20 +0200
commit0342b355586da7f21f9858cc3eb59f7aee0de3dd (patch)
tree39938f5ea81a7a284ca98a051e68618e49615657 /tests
parent803bd97c40cbf973bf9cd454b4227f897ebb1f6b (diff)
downloadgit-buildpackage-0342b355586da7f21f9858cc3eb59f7aee0de3dd.tar.gz
git-buildpackage-0342b355586da7f21f9858cc3eb59f7aee0de3dd.tar.bz2
git-buildpackage-0342b355586da7f21f9858cc3eb59f7aee0de3dd.zip
pq-rpm: implement 'convert' subcommand
The new subcommand is intended to be a one-time-callable command for converting a package to use the "orphan-packaging" development model and git layout (where packaging files are maintained in a separate branch and code development in another branch). Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/component/rpm/test_pq_rpm.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/component/rpm/test_pq_rpm.py b/tests/component/rpm/test_pq_rpm.py
index 19b04d98..69b760f4 100644
--- a/tests/component/rpm/test_pq_rpm.py
+++ b/tests/component/rpm/test_pq_rpm.py
@@ -252,6 +252,45 @@ class TestPqRpm(RpmRepoTestBase):
self._check_repo_state(repo, 'development/master', branches,
upstr_files + ['mydir/myfile.txt'])
+ def test_convert(self):
+ """Basic test for convert action"""
+ repo = self.init_test_repo('gbp-test2')
+ branches = repo.get_local_branches() + ['master-orphan']
+ files = ['bar.tar.gz', 'foo.txt', 'gbp-test2.spec',
+ 'gbp-test2-alt.spec', 'my.patch', '0001-My-addition.patch']
+
+ # First should fail because 'master-orphan' branch already exists
+ eq_(mock_pq(['convert']), 1)
+ self._check_log(-1, "gbp:error: Branch 'master-orphan' already exists")
+
+ # Re-try with force
+ eq_(mock_pq(['convert', '--import-files=', '--force']), 0)
+ self._check_repo_state(repo, 'master-orphan', branches, files)
+
+ def test_convert_fail(self):
+ """Tests for convert action error cases"""
+ repo = self.init_test_repo('gbp-test')
+ branches = repo.get_local_branches()
+
+ # Already on orphan packaging branch
+ eq_(mock_pq(['convert']), 1)
+ self._check_repo_state(repo, 'master', branches)
+ self._check_log(-1, ".*is not based on upstream version")
+
+ # Create a pq branch and try from there
+ eq_(mock_pq(['import']), 0)
+ eq_(mock_pq(['convert']), 1)
+ self._check_repo_state(repo, 'development/master',
+ branches + ['development/master'])
+ self._check_log(-1, ".*you're on patch-queue branch")
+
+ # Switch back to orphan packaging branch and try again
+ eq_(mock_pq(['switch']), 0)
+ eq_(mock_pq(['convert']), 1)
+ self._check_repo_state(repo, 'master',
+ branches + ['development/master'])
+ self._check_log(-1, r".*pq branch \S+ already exists")
+
def test_option_patch_numbers(self):
"""Test the --patch-numbers cmdline option"""
repo = self.init_test_repo('gbp-test')