mirror of
git://git.yoctoproject.org/yocto-autobuilder-helper.git
synced 2025-07-19 12:49:02 +02:00

Update getcomparisonbranch unit tests by removing BUILD_HISTORY_DIRECTPUSH entry in fake configuration Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
100 lines
4.5 KiB
Python
Executable File
100 lines
4.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import unittest
|
|
import utils
|
|
|
|
|
|
class TestGetComparisonBranch(unittest.TestCase):
|
|
TEST_CONFIG = {
|
|
"BUILD_HISTORY_FORKPUSH": {
|
|
"poky-contrib:ross/mut": "poky:master",
|
|
"poky:master-next": "poky:master",
|
|
"poky-contrib:abelloni/master-next": "poky:master"
|
|
}
|
|
}
|
|
|
|
def test_release_master(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky"
|
|
branch = "master"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(
|
|
basebranch, "master", msg="Release branch in poky must return corresponding base branch")
|
|
self.assertEqual(
|
|
comparebranch, None, msg="Release branch in poky must return corresponding compare branch")
|
|
|
|
def test_release_kirkstone(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky"
|
|
branch = "kirkstone"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(basebranch, "kirkstone",
|
|
msg="Release branch in poky must return corresponding base branch")
|
|
self.assertEqual(
|
|
comparebranch, None, msg="Release branch in poky must return corresponding compare branch")
|
|
|
|
def test_release_langdale(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky"
|
|
branch = "langdale"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(basebranch, "langdale",
|
|
msg="Release branch in poky must return corresponding base branch")
|
|
self.assertEqual(
|
|
comparebranch, None, msg="Release branch in poky must return corresponding compare branch")
|
|
|
|
def test_master_next(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky"
|
|
branch = "master-next"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(basebranch, "master-next",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch")
|
|
self.assertEqual(comparebranch, "master",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch")
|
|
|
|
def test_abelloni_master_next(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky-contrib"
|
|
branch = "abelloni/master-next"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(basebranch, "abelloni/master-next",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch")
|
|
self.assertEqual(comparebranch, "master",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch")
|
|
|
|
def test_ross_master_next(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky-contrib"
|
|
branch = "ross/mut"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(basebranch, "ross/mut",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding base branch")
|
|
self.assertEqual(comparebranch, "master",
|
|
msg="Repo/branch pair present in BUILD_HISTORY_FORKPUSH must return corresponding compare branch")
|
|
|
|
def test_arbitrary_branch(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky-contrib"
|
|
branch = "akanavin/package-version-updates"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(
|
|
basebranch, None, msg="Arbitrary repo/branch should not return any specific basebranch")
|
|
self.assertEqual(
|
|
comparebranch, None, msg="Arbitrary repo/branch should not return any specific comparebranch")
|
|
|
|
def test_master_nightly(self):
|
|
repo = "ssh://git@push.yoctoproject.org/poky"
|
|
branch = "master"
|
|
basebranch, comparebranch = utils.getcomparisonbranch(
|
|
self.TEST_CONFIG, repo, branch)
|
|
self.assertEqual(
|
|
basebranch, "master", msg="Master branch should be returned")
|
|
self.assertEqual(
|
|
comparebranch, None, msg="No specific comparebranch should be returned")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|