Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions tests/worker/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Runtime,
TelemetryConfig,
)
from temporalio.service import RPCError
from temporalio.service import RPCError, RPCStatusCode
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import (
ActivitySlotInfo,
Expand Down Expand Up @@ -1298,14 +1298,38 @@ async def mk_call() -> DescribeWorkerDeploymentResponse:
async def set_current_deployment_version(
client: Client, conflict_token: bytes, version: WorkerDeploymentVersion
) -> SetWorkerDeploymentCurrentVersionResponse:
return await client.workflow_service.set_worker_deployment_current_version(
SetWorkerDeploymentCurrentVersionRequest(
namespace=client.namespace,
deployment_name=version.deployment_name,
version=version.to_canonical_string(),
conflict_token=conflict_token,
)
)
async def mk_call() -> SetWorkerDeploymentCurrentVersionResponse:
nonlocal conflict_token
try:
return await client.workflow_service.set_worker_deployment_current_version(
SetWorkerDeploymentCurrentVersionRequest(
namespace=client.namespace,
deployment_name=version.deployment_name,
version=version.to_canonical_string(),
conflict_token=conflict_token,
)
)
except RPCError as err:
if err.status != RPCStatusCode.CANCELLED:
raise
describe_resp = await client.workflow_service.describe_worker_deployment(
DescribeWorkerDeploymentRequest(
namespace=client.namespace,
deployment_name=version.deployment_name,
)
)
current_version = describe_resp.worker_deployment_info.routing_config.current_deployment_version
if (
current_version.deployment_name == version.deployment_name
and current_version.build_id == version.build_id
):
return SetWorkerDeploymentCurrentVersionResponse(
conflict_token=describe_resp.conflict_token
)
conflict_token = describe_resp.conflict_token
assert False

return await assert_eventually(mk_call, retry_on_rpc_cancelled=False)


async def set_ramping_version(
Expand Down