googleapis / googleapis/google-cloud-python

System test `test_iam_policy` fails with `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python`

Đang mở
#15,916 1 bình luận 0 reaction 1 người được giao Được @thiagotnunes nhận Xem trên GitHub
api: spanner type: cleanup
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

See the presubmit failure `Kokoro Prerelease Dependencies` in PR https://github.com/googleapis/python-spanner/pull/1156 where the system test `test_iam_policy` fails when using `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python`.

To reproduce the issue, install this library using `pip install .` and run `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests/system/test_writer.py::test_append_rows_with_proto3`

```

=================================== FAILURES ===================================
_______________________________ test_iam_policy ________________________________

not_emulator = None
shared_instance =
databases_to_delete = []

def test_iam_policy(
not_emulator,
shared_instance,
databases_to_delete,
):
pool = spanner_v1.BurstyPool(labels={"testcase": "iam_policy"})
temp_db_id = _helpers.unique_id("iam_db", separator="_")
create_table = (
"CREATE TABLE policy (\n"
+ " Id STRING(36) NOT NULL,\n"
+ " Field1 STRING(36) NOT NULL\n"
+ ") PRIMARY KEY (Id)"
)
create_role = "CREATE ROLE parent"

temp_db = shared_instance.database(
temp_db_id,
ddl_statements=[create_table, create_role],
pool=pool,
)
create_op = temp_db.create()
databases_to_delete.append(temp_db)
create_op.result(DBAPI_OPERATION_TIMEOUT)
policy = temp_db.get_iam_policy(3)

assert policy.version == 0
assert policy.etag == b"\x00 \x01"

new_binding = policy_pb2.Binding(
role="",
members=[""],
condition=expr_pb2.Expr(
title="condition title",
expression='resource.name.endsWith("/databaseRoles/parent")',
),
)

policy.version = 3
policy.bindings.append(new_binding)
temp_db.set_iam_policy(policy)

new_policy = temp_db.get_iam_policy(3)
assert new_policy.version == 3
> assert new_policy.bindings == [new_binding]

tests/system/test_database_api.py:297:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = [role:
members:
condition {
expression: "resource.name.endsWith(\"/databaseRoles/parent\")"
title: "condition title"
}
]
other = [role:
members:
condition {
expression: "resource.name.endsWith(\"/databaseRoles/parent\")"
title: "condition title"
}
]

def __eq__(self, other: Any) -> bool:
"""Compares the current instance with another one."""
if self is other:
return True
if not isinstance(other, self.__class__):
> raise TypeError('Can only compare repeated composite fields against '
'other repeated composite fields.')
E TypeError: Can only compare repeated composite fields against other repeated composite fields.

.nox/8f8a4a6e/lib/python3.12/site-packages/google/protobuf/internal/containers.py:328: TypeError
=============================== warnings summary ===============================
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.