Skip to content

Commit 99ace6d

Browse files
authored
Regenerate the remote file upload proto to include TestSteps. (#468)
1 parent d5ffdba commit 99ace6d

9 files changed

Lines changed: 1069 additions & 858 deletions

File tree

go/gen/sift/remote_files/v1/remote_files.pb.go

Lines changed: 136 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/gen/sift/remote_files/v1/remote_files_vtproto.pb.go

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/sift/remote_files/v1/remote_files.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ enum EntityType {
134134
ENTITY_TYPE_ASSET = 3;
135135
ENTITY_TYPE_ANNOTATION_LOG = 4;
136136
ENTITY_TYPE_TEST_REPORT = 5;
137+
ENTITY_TYPE_TEST_STEP = 6;
137138
}
138139

139140
// The request for a call to `RemoteFileService_GetRemoteFile` to retrieve a remote file;
@@ -167,6 +168,13 @@ message ListRemoteFilesRequest {
167168

168169
// This field is only required if your user belongs to multiple organizations.
169170
string organization_id = 4 [(google.api.field_behavior) = OPTIONAL];
171+
172+
// How to order the retrieved reports. Formatted as a comma-separated string i.e. "FIELD_NAME[ desc],...".
173+
// Available fields to order_by are `name`, `created_date` and `modified_date`.
174+
// If left empty, items are ordered by `created_date` in descending order (newest-first).
175+
// For more information about the format of this field, read [this](https://google.aip.dev/132#ordering)
176+
// Example: "created_date desc,modified_date"
177+
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
170178
}
171179

172180
// The response of a call to `RemoteFileService_ListRemoteFilesResponse`.
@@ -198,6 +206,9 @@ message CreateRemoteFileRequest {
198206

199207
// The metadata values associated with this remote file.
200208
repeated sift.metadata.v1.MetadataValue metadata_values = 13 [(google.api.field_behavior) = OPTIONAL];
209+
210+
// Optional custom storage key for uploaded object that is not managed by the RemoteFileService.
211+
// When provided, caller is responsible for ensuring uniqueness to avoid collisions or API will return an error.
201212
}
202213

203214
// The response for a call to `RemoteFileService_CreateRemoteFile`.

python/lib/sift/remote_files/v1/remote_files_pb2.py

Lines changed: 30 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/lib/sift/remote_files/v1/remote_files_pb2.pyi

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class _EntityTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._Enu
3434
ENTITY_TYPE_ASSET: _EntityType.ValueType # 3
3535
ENTITY_TYPE_ANNOTATION_LOG: _EntityType.ValueType # 4
3636
ENTITY_TYPE_TEST_REPORT: _EntityType.ValueType # 5
37+
ENTITY_TYPE_TEST_STEP: _EntityType.ValueType # 6
3738

3839
class EntityType(_EntityType, metaclass=_EntityTypeEnumTypeWrapper): ...
3940

@@ -43,6 +44,7 @@ ENTITY_TYPE_ANNOTATION: EntityType.ValueType # 2
4344
ENTITY_TYPE_ASSET: EntityType.ValueType # 3
4445
ENTITY_TYPE_ANNOTATION_LOG: EntityType.ValueType # 4
4546
ENTITY_TYPE_TEST_REPORT: EntityType.ValueType # 5
47+
ENTITY_TYPE_TEST_STEP: EntityType.ValueType # 6
4648
global___EntityType = EntityType
4749

4850
@typing.final
@@ -232,6 +234,7 @@ class ListRemoteFilesRequest(google.protobuf.message.Message):
232234
PAGE_TOKEN_FIELD_NUMBER: builtins.int
233235
FILTER_FIELD_NUMBER: builtins.int
234236
ORGANIZATION_ID_FIELD_NUMBER: builtins.int
237+
ORDER_BY_FIELD_NUMBER: builtins.int
235238
page_size: builtins.int
236239
"""The maximum number of remote files to return. The service may return fewer than this value.
237240
If unspecified, at most 50 remote files will be returned. The maximum value is 1000; values above
@@ -251,15 +254,23 @@ class ListRemoteFilesRequest(google.protobuf.message.Message):
251254
"""
252255
organization_id: builtins.str
253256
"""This field is only required if your user belongs to multiple organizations."""
257+
order_by: builtins.str
258+
"""How to order the retrieved reports. Formatted as a comma-separated string i.e. "FIELD_NAME[ desc],...".
259+
Available fields to order_by are `name`, `created_date` and `modified_date`.
260+
If left empty, items are ordered by `created_date` in descending order (newest-first).
261+
For more information about the format of this field, read [this](https://google.aip.dev/132#ordering)
262+
Example: "created_date desc,modified_date"
263+
"""
254264
def __init__(
255265
self,
256266
*,
257267
page_size: builtins.int = ...,
258268
page_token: builtins.str = ...,
259269
filter: builtins.str = ...,
260270
organization_id: builtins.str = ...,
271+
order_by: builtins.str = ...,
261272
) -> None: ...
262-
def ClearField(self, field_name: typing.Literal["filter", b"filter", "organization_id", b"organization_id", "page_size", b"page_size", "page_token", b"page_token"]) -> None: ...
273+
def ClearField(self, field_name: typing.Literal["filter", b"filter", "order_by", b"order_by", "organization_id", b"organization_id", "page_size", b"page_size", "page_token", b"page_token"]) -> None: ...
263274

264275
global___ListRemoteFilesRequest = ListRemoteFilesRequest
265276

python/lib/sift_client/_tests/resources/test_file_attachments.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ async def test_list_by_entity_type(
292292
for fa in file_attachments:
293293
assert fa.entity_type == RemoteFileEntityType.TEST_REPORTS
294294

295+
# Test filtering by TEST_STEPS entity type
296+
file_attachments = await file_attachments_api_async.list_(
297+
entity_type=RemoteFileEntityType.TEST_STEPS,
298+
limit=100,
299+
)
300+
assert isinstance(file_attachments, list)
301+
# All returned attachments should be for TEST_STEPS
302+
for fa in file_attachments:
303+
assert fa.entity_type == RemoteFileEntityType.TEST_STEPS
304+
295305
@pytest.mark.asyncio
296306
async def test_list_by_file_name(
297307
self, file_attachments_api_async, uploaded_file_attachment

python/lib/sift_client/sift_types/file_attachment.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sift_client.client import SiftClient
1616
from sift_client.sift_types.asset import Asset
1717
from sift_client.sift_types.run import Run
18-
from sift_client.sift_types.test_report import TestReport
18+
from sift_client.sift_types.test_report import TestReport, TestStep
1919

2020

2121
class RemoteFileEntityType(Enum):
@@ -27,6 +27,7 @@ class RemoteFileEntityType(Enum):
2727
ASSETS = EntityType.ENTITY_TYPE_ASSET # 3
2828
ANNOTATION_LOGS = EntityType.ENTITY_TYPE_ANNOTATION_LOG # 4
2929
TEST_REPORTS = EntityType.ENTITY_TYPE_TEST_REPORT # 5
30+
TEST_STEPS = EntityType.ENTITY_TYPE_TEST_STEP # 6
3031

3132
@classmethod
3233
def from_str(cls, val: str) -> RemoteFileEntityType | None:
@@ -97,14 +98,16 @@ def _from_proto(
9798
)
9899

99100
@property
100-
def entity(self) -> Run | Asset | TestReport:
101+
def entity(self) -> Run | Asset | TestReport | TestStep:
101102
"""Get the entity that this file attachment is attached to."""
102103
if self.entity_type == RemoteFileEntityType.RUNS:
103104
return self.client.runs.get(run_id=self.entity_id)
104105
elif self.entity_type == RemoteFileEntityType.ASSETS:
105106
return self.client.assets.get(asset_id=self.entity_id)
106107
elif self.entity_type == RemoteFileEntityType.TEST_REPORTS:
107108
return self.client.test_results.get(test_report_id=self.entity_id)
109+
elif self.entity_type == RemoteFileEntityType.TEST_STEPS:
110+
return self.client.test_results.get_step(test_step=self.entity_id)
108111
elif self.entity_type in (
109112
RemoteFileEntityType.ANNOTATIONS,
110113
RemoteFileEntityType.ANNOTATION_LOGS,

0 commit comments

Comments
 (0)