forked from googleapis/python-spanner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautocommit_test.py
More file actions
33 lines (26 loc) · 972 Bytes
/
Copy pathautocommit_test.py
File metadata and controls
33 lines (26 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
from google.api_core.exceptions import Aborted
import pytest
from test_utils.retry import RetryErrors
import autocommit
@pytest.fixture(scope="module")
def sample_name():
return "autocommit"
@RetryErrors(exception=Aborted, max_tries=2)
def test_enable_autocommit_mode(capsys, instance_id, sample_database):
# Delete table if it exists for retry attempts.
table = sample_database.table("Singers")
if table.exists():
op = sample_database.update_ddl(["DROP TABLE Singers"])
op.result()
autocommit.enable_autocommit_mode(
instance_id,
sample_database.database_id,
)
out, _ = capsys.readouterr()
assert "Autocommit mode is enabled." in out
assert "SingerId: 13, AlbumId: Russell, AlbumTitle: Morales" in out