示例#1
0
    def test_get_expr_affected_by_etcd_removal_with_excluded(self):
        '''
        Same test, but with some excluded node
        '''
        affected_expr = get_expr_affected_by(self.only_etcd_1,
                                             excluded=[self.master_2],
                                             masters=self.masters,
                                             minions=self.minions,
                                             etcd_members=self.etcd_members)

        affected_items = affected_expr.split(' and ')
        expected_matches = self.common_expected_affected_matches + [
            'P@roles:(etcd|kube-master)', 'not L@master_2,only_etcd_1'
        ]

        for expr in expected_matches:
            self.assertIn(
                expr, affected_items,
                '{} is not in affected in expr: {}'.format(
                    expr, affected_expr))
示例#2
0
    def test_get_expr_affected_by_etcd_removal(self):
        '''
        Calculate the expression for matching nodes affected by
        a etcd-only node removal
        '''
        affected_expr = get_expr_affected_by(self.only_etcd_1,
                                             masters=self.masters,
                                             minions=self.minions,
                                             etcd_members=self.etcd_members)

        affected_items = affected_expr.split(' and ')
        expected_matches = self.common_expected_affected_matches + [
            'P@roles:(etcd|kube-master)', 'not L@only_etcd_1'
        ]

        for expr in expected_matches:
            self.assertIn(
                expr, affected_items,
                '{} is not in affected in expr: {}'.format(
                    expr, affected_expr))