コード例 #1
0
    def test_commit_w_broken_jar_tpc_begin(self):
        # ok this test reveals a bug in the TM.py
        # as the nosub tpc_abort there is ignored.

        # nosub calling method tpc_begin
        # nosub calling method commit
        # sub calling method tpc_begin
        # sub calling method abort
        # sub calling method tpc_abort
        # nosub calling method tpc_abort
        from transaction import _transaction
        from transaction.tests.common import DummyLogger
        from transaction.tests.common import Monkey
        logger = DummyLogger()
        with Monkey(_transaction, _LOGGER=logger):
            mgr, sub1, sub2, sub3, nosub1 = self._makePopulated()
            sub1._p_jar = BasicJar(errors='tpc_begin')
            nosub1.modify()
            sub1.modify(nojar=1)
            try:
                mgr.commit()
            except TestTxnException:
                pass

        assert nosub1._p_jar.ctpc_abort == 1
        assert sub1._p_jar.ctpc_abort == 1
コード例 #2
0
    def test_commit_w_broken_jar_tpc_abort_tpc_vote(self):
        from transaction import _transaction
        from transaction.tests.common import DummyLogger
        from transaction.tests.common import Monkey
        logger = DummyLogger()
        with Monkey(_transaction, _LOGGER=logger):
            mgr, sub1, sub2, sub3, nosub1 = self._makePopulated()
            sub1._p_jar = BasicJar(errors=('tpc_abort', 'tpc_vote'))
            nosub1.modify()
            sub1.modify(nojar=1)
            try:
                mgr.commit()
            except TestTxnException:
                pass

        assert nosub1._p_jar.ctpc_abort == 1