Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky test in DBAPI test_multiple_aborts_in_transaction #1087

Open
harshachinta opened this issue Jan 30, 2024 · 1 comment
Open

Flaky test in DBAPI test_multiple_aborts_in_transaction #1087

harshachinta opened this issue Jan 30, 2024 · 1 comment
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release.

Comments

@harshachinta
Copy link
Contributor

The below test in DBAPI appears to be flaky. The test is failing in presubmit builds randomly and a rebuild fixes the issue.

=================================== FAILURES ===================================
________________ TestDbApi.test_multiple_aborts_in_transaction _________________

self = <tests.system.test_dbapi.TestDbApi object at 0x7f9a357654f0>
dbapi_database = <google.cloud.spanner_v1.testing.database_test.TestDatabase object at 0x7f9a352176a0>

    def test_multiple_aborts_in_transaction(self, dbapi_database):
        """Test that when there are multiple Abort exceptions in a transaction
        on different statements, then the retry succeeds."""
    
        method_count_interceptor = dbapi_database._method_count_interceptor
        method_count_interceptor.reset()
        # called 3 times
        self._insert_row(1)
        dbapi_database._method_abort_interceptor.set_method_to_abort(
            EXECUTE_STREAMING_SQL_METHOD, self._conn
        )
        # called 3 times
        self._cursor.execute("SELECT * FROM contacts")
        dbapi_database._method_abort_interceptor.reset()
        self._cursor.fetchall()
        # called 2 times
        self._insert_row(2)
        # called 2 times
        self._cursor.execute("SELECT * FROM contacts")
        self._cursor.fetchone()
        dbapi_database._method_abort_interceptor.set_method_to_abort(
            COMMIT_METHOD, self._conn
        )
        # called 2 times
        self._conn.commit()
        dbapi_database._method_abort_interceptor.reset()
        assert method_count_interceptor._counts[COMMIT_METHOD] == 2
>       assert method_count_interceptor._counts[EXECUTE_STREAMING_SQL_METHOD] == 10
E       assert 13 == 10

[tests/system/test_dbapi.py:854](https://cs.corp.google.com/piper///depot/google3/tests/system/test_dbapi.py?l=854): AssertionError
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Jan 30, 2024
@harshachinta harshachinta assigned ankiaga and unassigned harshachinta Jan 30, 2024
@harshachinta harshachinta added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Jan 30, 2024
@harshachinta
Copy link
Contributor Author

@ankiaga Feel free to pick this up based on your priorities. I had to rebuild the presubmits couple of times to get this passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release.
Projects
None yet
Development

No branches or pull requests

2 participants