def choose_suite_branch(self): suite_repo_name = self.suite_repo_name suite_repo_project_or_url = self.args.suite_repo or 'ceph-qa-suite' suite_branch = self.args.suite_branch ceph_branch = self.args.ceph_branch if suite_branch and suite_branch != 'master': if not util.git_branch_exists( suite_repo_project_or_url, suite_branch ): exc = BranchNotFoundError(suite_branch, suite_repo_name) util.schedule_fail(message=str(exc), name=self.name) elif not suite_branch: # Decide what branch of the suite repo to use if util.git_branch_exists(suite_repo_project_or_url, ceph_branch): suite_branch = ceph_branch else: log.info( "branch {0} not in {1}; will use master for" " ceph-qa-suite".format( ceph_branch, suite_repo_name )) suite_branch = 'master' return suite_branch
def choose_teuthology_branch(self): teuthology_branch = self.args.teuthology_branch if teuthology_branch and teuthology_branch != 'master': if not util.git_branch_exists('teuthology', teuthology_branch): exc = BranchNotFoundError(teuthology_branch, 'teuthology.git') util.schedule_fail(message=str(exc), name=self.name) elif not teuthology_branch: # Decide what branch of teuthology to use if util.git_branch_exists('teuthology', self.args.ceph_branch): teuthology_branch = self.args.ceph_branch else: log.info( "branch {0} not in teuthology.git; will use master for" " teuthology".format(self.args.ceph_branch)) teuthology_branch = 'master' log.info("teuthology branch: %s", teuthology_branch) return teuthology_branch
def test_git_branch_exists(m_check_output): m_check_output.return_value = '' assert False == util.git_branch_exists('ceph', 'nobranchnowaycanthappen') m_check_output.return_value = 'HHH branch' assert True == util.git_branch_exists('ceph', 'master')
def test_git_branch_exists(m_check_output, project_or_url): m_check_output.return_value = '' assert False == util.git_branch_exists(project_or_url, 'nobranchnowaycanthappen') m_check_output.return_value = 'HHH branch' assert True == util.git_branch_exists(project_or_url, 'master')
def test_git_branch_exists(m_check_output, project_or_url): m_check_output.return_value = '' assert False == util.git_branch_exists( project_or_url, 'nobranchnowaycanthappen') m_check_output.return_value = 'HHH branch' assert True == util.git_branch_exists(project_or_url, 'master')