Skip to content

Commit b1745fb

Browse files
committed
Add test asserting ProtoTaskHubSidecarServiceStub is compatible with proto
1 parent 83b514f commit b1745fb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
5+
import ast
6+
import inspect
7+
from typing import get_type_hints
8+
9+
from durabletask.internal.orchestrator_service_pb2_grpc import TaskHubSidecarServiceStub
10+
from durabletask.internal.proto_task_hub_sidecar_service_stub import ProtoTaskHubSidecarServiceStub
11+
12+
13+
def test_proto_task_hub_shim_is_compatible():
14+
"""Test that ProtoTaskHubSidecarServiceStub is compatible with TaskHubSidecarServiceStub."""
15+
protocol_attrs = set(get_type_hints(ProtoTaskHubSidecarServiceStub).keys())
16+
17+
# Instantiate TaskHubSidecarServiceStub with a dummy channel to get its attributes
18+
class TestChannel():
19+
def unary_unary(self, *args, **kwargs):
20+
pass
21+
22+
def unary_stream(self, *args, **kwargs):
23+
pass
24+
impl_attrs = TaskHubSidecarServiceStub(TestChannel()).__dict__.keys()
25+
26+
# Check missing
27+
assert protocol_attrs == impl_attrs

0 commit comments

Comments
 (0)