Ejemplo n.º 1
0
    def private_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHEL components and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhel-7', 'staging-rhel-7-candidate'),
            ('private-johnfoo-staging-rhel-7-BZ123456',
             'staging-rhel-7-candidate'),
            ('private-staging-rhel-6-BZ654321', 'staging-rhel-6-candidate'),
            ('private-jo-fo-staging-rhel-6-bar-baz',
             'staging-rhel-6-candidate'),
            ('private-johnfoo-staging-extras-rhel-7',
             'staging-extras-rhel-7-candidate'),
            ('private-johnfoo-staging-extras-rhel-7-BZ123456',
             'staging-extras-rhel-7-candidate'),
            ('private-staging-extras-rhel-6-BZ654321',
             'staging-extras-rhel-6-candidate'),
            ('private-jo-fo-staging-extras-rhel-6-bar-baz',
             'staging-extras-rhel-6-candidate'),
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"
Ejemplo n.º 2
0
 def setUp(self):
     self.staging_branch = DistGitBranch(
         DistGitBranchTest.STAGING["branch"])
     self.private_branch = DistGitBranch(
         DistGitBranchTest.PRIVATE["branch"])
     self.extras_staging_branch = DistGitBranch(
         DistGitBranchTest.EXTRAS_STAGING["branch"])
     self.standard_branch = DistGitBranch(
         DistGitBranchTest.STANDARD["branch"])
     self.extras_standard_branch = DistGitBranch(
         DistGitBranchTest.EXTRAS_STANDARD["branch"])
Ejemplo n.º 3
0
    def test_run_on_staging(self):
        self.commitci._run_on_targets = MagicMock()
        staging = DistGitBranch(CommitCITest.TEST_STAGING_BRANCH)

        self.commitci._run_on_staging(staging, CommitCITest.TEST_SLAVE, CommitCITest.TEST_PLATFORM_CODE_SOURCE)
        assert self.commitci._run_on_targets.called
        assert self.commitci._run_on_targets.call_args[0][0] == CommitCITest.TEST_STAGING_BRANCH
        assert self.commitci._run_on_targets.call_args[0][1] == [CommitCITest.TEST_STAGING_TARGET]
Ejemplo n.º 4
0
    def private_rhscl_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHSCL and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-6', 'staging-rhscl-2.1-rh-ruby22-rhel-6-candidate'),
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-7-BZ123456',
             'staging-rhscl-2.1-rh-ruby22-rhel-7-candidate'),
            ('private-staging-rhscl-2.1-rh-mariadb100-rhel-6-BZ654321',
             'staging-rhscl-2.1-rh-mariadb100-rhel-6-candidate'),
            ('private-jo-fo-staging-rhscl-2.1-rh-mariadb100-rhel-7-bar-baz',
             'staging-rhscl-2.1-rh-mariadb100-rhel-7-candidate')
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"
Ejemplo n.º 5
0
    def rhscl_staging_branch_test(self):
        """
        Tests for parsing staging branches for RHSCL and determining the correct build target
        """
        testing_bases = [
            'rhscl-2.1-rh-ruby22-rhel-6',
            'rhscl-2.1-rh-ruby22-rhel-7',
            'rhscl-2.1-rh-mariadb100-rhel-6',
            'rhscl-2.1-rh-mariadb100-rhel-7'
        ]

        testing_branches = ["staging-{0}".format(base) for base in testing_bases]
        testing_targets = ["staging-{0}-candidate".format(base) for base in testing_bases]

        for branch, target in zip(testing_branches, testing_targets):
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "staging"
Ejemplo n.º 6
0
    def test_run_by_config(self, mock_commitconfig):
        mock_commitconfig.return_value = MagicMock()
        mock_commitconfig.return_value.targets = CommitCITest.TEST_TARGETS
        self.commitci._run_on_targets = MagicMock()

        self.commitci._run_by_config(DistGitBranch(CommitCITest.TEST_BRANCH), CommitCITest.TEST_SLAVE,
                                     CommitCITest.TEST_PLATFORM_CODE_SOURCE, CommitCITest.TEST_CONFIG_FILE)
        assert self.commitci._run_on_targets.called
        assert self.commitci._run_on_targets.call_args[0][0] == CommitCITest.TEST_BRANCH
        assert self.commitci._run_on_targets.call_args[0][1] == CommitCITest.TEST_TARGETS
Ejemplo n.º 7
0
    def private_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHEL components and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhel-7', 'staging-rhel-7-candidate'),
            ('private-johnfoo-staging-rhel-7-BZ123456', 'staging-rhel-7-candidate'),
            ('private-staging-rhel-6-BZ654321', 'staging-rhel-6-candidate'),
            ('private-jo-fo-staging-rhel-6-bar-baz', 'staging-rhel-6-candidate'),
            ('private-johnfoo-staging-extras-rhel-7', 'staging-extras-rhel-7-candidate'),
            ('private-johnfoo-staging-extras-rhel-7-BZ123456', 'staging-extras-rhel-7-candidate'),
            ('private-staging-extras-rhel-6-BZ654321', 'staging-extras-rhel-6-candidate'),
            ('private-jo-fo-staging-extras-rhel-6-bar-baz', 'staging-extras-rhel-6-candidate'),
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"
Ejemplo n.º 8
0
    def private_rhscl_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHSCL and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-6',
             'staging-rhscl-2.1-rh-ruby22-rhel-6-candidate'),
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-7-BZ123456',
             'staging-rhscl-2.1-rh-ruby22-rhel-7-candidate'),
            ('private-staging-rhscl-2.1-rh-mariadb100-rhel-6-BZ654321',
             'staging-rhscl-2.1-rh-mariadb100-rhel-6-candidate'),
            ('private-jo-fo-staging-rhscl-2.1-rh-mariadb100-rhel-7-bar-baz',
             'staging-rhscl-2.1-rh-mariadb100-rhel-7-candidate')
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"
Ejemplo n.º 9
0
    def rhscl_staging_branch_test(self):
        """
        Tests for parsing staging branches for RHSCL and determining the correct build target
        """
        testing_bases = [
            'rhscl-2.1-rh-ruby22-rhel-6', 'rhscl-2.1-rh-ruby22-rhel-7',
            'rhscl-2.1-rh-mariadb100-rhel-6', 'rhscl-2.1-rh-mariadb100-rhel-7'
        ]

        testing_branches = [
            "staging-{0}".format(base) for base in testing_bases
        ]
        testing_targets = [
            "staging-{0}-candidate".format(base) for base in testing_bases
        ]

        for branch, target in zip(testing_branches, testing_targets):
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "staging"
Ejemplo n.º 10
0
    def test_run_on_staging_with_config(self, mock_commitconfig):
        mock_commitconfig.return_value = MagicMock()
        mock_commitconfig.return_value.targets = CommitCITest.TEST_TARGETS
        staging = DistGitBranch(CommitCITest.TEST_STAGING_BRANCH)
        self.commitci._run_on_targets = MagicMock()

        self.commitci._run_on_staging(staging, CommitCITest.TEST_SLAVE, CommitCITest.TEST_PLATFORM_CODE_SOURCE,
                                      CommitCITest.TEST_CONFIG_FILE)

        assert self.commitci._run_on_targets.called
        assert self.commitci._run_on_targets.call_args[0][0] == CommitCITest.TEST_STAGING_BRANCH
        expected_targets = CommitCITest.TEST_TARGETS + [CommitCITest.TEST_STAGING_TARGET]
        assert self.commitci._run_on_targets.call_args[0][1] == expected_targets
Ejemplo n.º 11
0
 def setUp(self):
     self.staging_branch = DistGitBranch(DistGitBranchTest.STAGING["branch"])
     self.private_branch = DistGitBranch(DistGitBranchTest.PRIVATE["branch"])
     self.extras_staging_branch = DistGitBranch(DistGitBranchTest.EXTRAS_STAGING["branch"])
     self.standard_branch = DistGitBranch(DistGitBranchTest.STANDARD["branch"])
     self.extras_standard_branch = DistGitBranch(DistGitBranchTest.EXTRAS_STANDARD["branch"])
Ejemplo n.º 12
0
class DistGitBranchTest(unittest.TestCase):
    STAGING = {"branch": "staging-rhel-7", "target": "staging-rhel-7-candidate"}
    PRIVATE = {"branch": "private-pmuller-branch", "target": None}
    STANDARD = {"branch": "rhel-7.2", "target": "rhel-7.2-candidate"}
    EXTRAS_STANDARD = {"branch": "extras-rhel-7.2", "target": "extras-rhel-7.2-candidate"}
    EXTRAS_STAGING = {"branch": "staging-extras-rhel-7", "target": "staging-extras-rhel-7-candidate"}

    def setUp(self):
        self.staging_branch = DistGitBranch(DistGitBranchTest.STAGING["branch"])
        self.private_branch = DistGitBranch(DistGitBranchTest.PRIVATE["branch"])
        self.extras_staging_branch = DistGitBranch(DistGitBranchTest.EXTRAS_STAGING["branch"])
        self.standard_branch = DistGitBranch(DistGitBranchTest.STANDARD["branch"])
        self.extras_standard_branch = DistGitBranch(DistGitBranchTest.EXTRAS_STANDARD["branch"])

    def extras_staging_branch_test(self):
        assert self.extras_staging_branch.name == DistGitBranchTest.EXTRAS_STAGING["branch"]
        assert self.extras_staging_branch.is_staging()
        assert self.extras_staging_branch.staging_target == DistGitBranchTest.EXTRAS_STAGING["target"]
        assert self.extras_staging_branch.type == "staging"

    def staging_branch_test(self):
        assert self.staging_branch.name == DistGitBranchTest.STAGING["branch"]
        assert self.staging_branch.is_staging()
        assert self.staging_branch.staging_target == DistGitBranchTest.STAGING["target"]
        assert self.staging_branch.type == "staging"

    def private_branch_test(self):
        assert self.private_branch.name == DistGitBranchTest.PRIVATE["branch"]
        assert not self.private_branch.is_staging()
        assert_raises(DistGitBranchException, lambda: self.private_branch.staging_target)
        assert self.private_branch.type == "private"

    def standard_branch_test(self):
        assert self.standard_branch.name == DistGitBranchTest.STANDARD["branch"]
        assert not self.standard_branch.is_staging()
        assert self.standard_branch.staging_target == DistGitBranchTest.STANDARD["target"]
        assert self.standard_branch.type == "standard"

    def extras_standard_branch_test(self):
        assert self.extras_standard_branch.name == DistGitBranchTest.EXTRAS_STANDARD["branch"]
        assert not self.extras_standard_branch.is_staging()
        assert self.extras_standard_branch.staging_target == DistGitBranchTest.EXTRAS_STANDARD["target"]
        assert self.extras_standard_branch.type == "standard"

    # pylint: disable=no-self-use
    def rhscl_staging_branch_test(self):
        """
        Tests for parsing staging branches for RHSCL and determining the correct build target
        """
        testing_bases = [
            'rhscl-2.1-rh-ruby22-rhel-6',
            'rhscl-2.1-rh-ruby22-rhel-7',
            'rhscl-2.1-rh-mariadb100-rhel-6',
            'rhscl-2.1-rh-mariadb100-rhel-7'
        ]

        testing_branches = ["staging-{0}".format(base) for base in testing_bases]
        testing_targets = ["staging-{0}-candidate".format(base) for base in testing_bases]

        for branch, target in zip(testing_branches, testing_targets):
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "staging"

    # pylint: disable=no-self-use
    def private_rhscl_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHSCL and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-6', 'staging-rhscl-2.1-rh-ruby22-rhel-6-candidate'),
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-7-BZ123456',
             'staging-rhscl-2.1-rh-ruby22-rhel-7-candidate'),
            ('private-staging-rhscl-2.1-rh-mariadb100-rhel-6-BZ654321',
             'staging-rhscl-2.1-rh-mariadb100-rhel-6-candidate'),
            ('private-jo-fo-staging-rhscl-2.1-rh-mariadb100-rhel-7-bar-baz',
             'staging-rhscl-2.1-rh-mariadb100-rhel-7-candidate')
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"

    # pylint: disable=no-self-use
    def private_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHEL components and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhel-7', 'staging-rhel-7-candidate'),
            ('private-johnfoo-staging-rhel-7-BZ123456', 'staging-rhel-7-candidate'),
            ('private-staging-rhel-6-BZ654321', 'staging-rhel-6-candidate'),
            ('private-jo-fo-staging-rhel-6-bar-baz', 'staging-rhel-6-candidate'),
            ('private-johnfoo-staging-extras-rhel-7', 'staging-extras-rhel-7-candidate'),
            ('private-johnfoo-staging-extras-rhel-7-BZ123456', 'staging-extras-rhel-7-candidate'),
            ('private-staging-extras-rhel-6-BZ654321', 'staging-extras-rhel-6-candidate'),
            ('private-jo-fo-staging-extras-rhel-6-bar-baz', 'staging-extras-rhel-6-candidate'),
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"
Ejemplo n.º 13
0
 def test_run_on_staging_invalid(self):
     staging = DistGitBranch(CommitCITest.TEST_BRANCH)
     assert_raises(DistGitBranchException, self.commitci._run_on_staging, staging, CommitCITest.TEST_SLAVE,
                   CommitCITest.TEST_PLATFORM_CODE_SOURCE)
Ejemplo n.º 14
0
class DistGitBranchTest(unittest.TestCase):
    STAGING = {
        "branch": "staging-rhel-7",
        "target": "staging-rhel-7-candidate"
    }
    PRIVATE = {"branch": "private-pmuller-branch", "target": None}
    STANDARD = {"branch": "rhel-7.2", "target": "rhel-7.2-candidate"}
    EXTRAS_STANDARD = {
        "branch": "extras-rhel-7.2",
        "target": "extras-rhel-7.2-candidate"
    }
    EXTRAS_STAGING = {
        "branch": "staging-extras-rhel-7",
        "target": "staging-extras-rhel-7-candidate"
    }

    def setUp(self):
        self.staging_branch = DistGitBranch(
            DistGitBranchTest.STAGING["branch"])
        self.private_branch = DistGitBranch(
            DistGitBranchTest.PRIVATE["branch"])
        self.extras_staging_branch = DistGitBranch(
            DistGitBranchTest.EXTRAS_STAGING["branch"])
        self.standard_branch = DistGitBranch(
            DistGitBranchTest.STANDARD["branch"])
        self.extras_standard_branch = DistGitBranch(
            DistGitBranchTest.EXTRAS_STANDARD["branch"])

    def extras_staging_branch_test(self):
        assert self.extras_staging_branch.name == DistGitBranchTest.EXTRAS_STAGING[
            "branch"]
        assert self.extras_staging_branch.is_staging()
        assert self.extras_staging_branch.staging_target == DistGitBranchTest.EXTRAS_STAGING[
            "target"]
        assert self.extras_staging_branch.type == "staging"

    def staging_branch_test(self):
        assert self.staging_branch.name == DistGitBranchTest.STAGING["branch"]
        assert self.staging_branch.is_staging()
        assert self.staging_branch.staging_target == DistGitBranchTest.STAGING[
            "target"]
        assert self.staging_branch.type == "staging"

    def private_branch_test(self):
        assert self.private_branch.name == DistGitBranchTest.PRIVATE["branch"]
        assert not self.private_branch.is_staging()
        assert_raises(DistGitBranchException,
                      lambda: self.private_branch.staging_target)
        assert self.private_branch.type == "private"

    def standard_branch_test(self):
        assert self.standard_branch.name == DistGitBranchTest.STANDARD[
            "branch"]
        assert not self.standard_branch.is_staging()
        assert self.standard_branch.staging_target == DistGitBranchTest.STANDARD[
            "target"]
        assert self.standard_branch.type == "standard"

    def extras_standard_branch_test(self):
        assert self.extras_standard_branch.name == DistGitBranchTest.EXTRAS_STANDARD[
            "branch"]
        assert not self.extras_standard_branch.is_staging()
        assert self.extras_standard_branch.staging_target == DistGitBranchTest.EXTRAS_STANDARD[
            "target"]
        assert self.extras_standard_branch.type == "standard"

    # pylint: disable=no-self-use
    def rhscl_staging_branch_test(self):
        """
        Tests for parsing staging branches for RHSCL and determining the correct build target
        """
        testing_bases = [
            'rhscl-2.1-rh-ruby22-rhel-6', 'rhscl-2.1-rh-ruby22-rhel-7',
            'rhscl-2.1-rh-mariadb100-rhel-6', 'rhscl-2.1-rh-mariadb100-rhel-7'
        ]

        testing_branches = [
            "staging-{0}".format(base) for base in testing_bases
        ]
        testing_targets = [
            "staging-{0}-candidate".format(base) for base in testing_bases
        ]

        for branch, target in zip(testing_branches, testing_targets):
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "staging"

    # pylint: disable=no-self-use
    def private_rhscl_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHSCL and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-6',
             'staging-rhscl-2.1-rh-ruby22-rhel-6-candidate'),
            ('private-johnfoo-staging-rhscl-2.1-rh-ruby22-rhel-7-BZ123456',
             'staging-rhscl-2.1-rh-ruby22-rhel-7-candidate'),
            ('private-staging-rhscl-2.1-rh-mariadb100-rhel-6-BZ654321',
             'staging-rhscl-2.1-rh-mariadb100-rhel-6-candidate'),
            ('private-jo-fo-staging-rhscl-2.1-rh-mariadb100-rhel-7-bar-baz',
             'staging-rhscl-2.1-rh-mariadb100-rhel-7-candidate')
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"

    # pylint: disable=no-self-use
    def private_staging_branch_test(self):
        """
        Tests for parsing private staging branches for RHEL components and determining the correct build target
        """
        testing_data = [
            ('private-johnfoo-staging-rhel-7', 'staging-rhel-7-candidate'),
            ('private-johnfoo-staging-rhel-7-BZ123456',
             'staging-rhel-7-candidate'),
            ('private-staging-rhel-6-BZ654321', 'staging-rhel-6-candidate'),
            ('private-jo-fo-staging-rhel-6-bar-baz',
             'staging-rhel-6-candidate'),
            ('private-johnfoo-staging-extras-rhel-7',
             'staging-extras-rhel-7-candidate'),
            ('private-johnfoo-staging-extras-rhel-7-BZ123456',
             'staging-extras-rhel-7-candidate'),
            ('private-staging-extras-rhel-6-BZ654321',
             'staging-extras-rhel-6-candidate'),
            ('private-jo-fo-staging-extras-rhel-6-bar-baz',
             'staging-extras-rhel-6-candidate'),
        ]

        for branch, target in testing_data:
            obj = DistGitBranch(branch)
            assert obj.is_staging()
            assert obj.staging_target == target
            assert obj.type == "private staging"