Skip to content

Commit bc38664

Browse files
authored
test(dbapi): add retry to autocommit sample to reduce flakiness (googleapis#214)
Co-authored-by: larkee <larkee@users.noreply.github.com>
1 parent 283ea3d commit bc38664

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

samples/samples/autocommit_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
import uuid
88

9+
from google.api_core.exceptions import Aborted
910
from google.cloud import spanner
1011
from google.cloud.spanner_dbapi import connect
1112
import mock
1213
import pytest
14+
from test_utils.retry import RetryErrors
1315

1416
import autocommit
1517

@@ -49,6 +51,7 @@ def database(spanner_instance):
4951
db.drop()
5052

5153

54+
@RetryErrors(exception=Aborted, max_tries=2)
5255
def test_enable_autocommit_mode(capsys, database):
5356
connection = connect(INSTANCE_ID, DATABASE_ID)
5457
cursor = connection.cursor()

0 commit comments

Comments
 (0)