Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 9df088d

Browse files
committed
feat: Multiplexed sessions - Fix failing test_batch_insert_then_read.
Signed-off-by: Taylor Curran <taylor.curran@improving.com>
1 parent 65042ab commit 9df088d

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

tests/system/test_session_api.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,32 @@ def test_batch_insert_then_read(sessions_database, ot_exporter):
458458
os.getenv("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS", "").lower() == "true"
459459
)
460460

461-
assert_span_attributes(
462-
ot_exporter,
463-
"CloudSpanner.GetSession",
464-
attributes=_make_attributes(
465-
db_name,
466-
session_found=True,
467-
x_goog_spanner_request_id=f"1.{REQ_RAND_PROCESS_ID}.{db._nth_client_id}.{db._channel_id}.{nth_req0 + 0}.1",
468-
),
469-
span=span_list[0],
470-
)
461+
# [A] Verify batch checkout spans
462+
# -------------------------------
463+
464+
request_id_1 = f"1.{REQ_RAND_PROCESS_ID}.{db._nth_client_id}.{db._channel_id}.{nth_req0 + 0}.1"
465+
466+
if multiplexed_enabled:
467+
assert_span_attributes(
468+
ot_exporter,
469+
"CloudSpanner.CreateMultiplexedSession",
470+
attributes=_make_attributes(
471+
db_name, x_goog_spanner_request_id=request_id_1
472+
),
473+
span=span_list[0],
474+
)
475+
else:
476+
assert_span_attributes(
477+
ot_exporter,
478+
"CloudSpanner.GetSession",
479+
attributes=_make_attributes(
480+
db_name,
481+
session_found=True,
482+
x_goog_spanner_request_id=request_id_1,
483+
),
484+
span=span_list[0],
485+
)
486+
471487
assert_span_attributes(
472488
ot_exporter,
473489
"CloudSpanner.Batch.commit",
@@ -479,6 +495,9 @@ def test_batch_insert_then_read(sessions_database, ot_exporter):
479495
span=span_list[1],
480496
)
481497

498+
# [B] Verify snapshot checkout spans
499+
# ----------------------------------
500+
482501
if len(span_list) == 4:
483502
if multiplexed_enabled:
484503
expected_snapshot_span_name = "CloudSpanner.CreateMultiplexedSession"

0 commit comments

Comments
 (0)