Skip to content

Add test utility to create Nexus endpoint#1279

Open
Quinn-With-Two-Ns wants to merge 2 commits intotemporalio:mainfrom
Quinn-With-Two-Ns:SDK-3837
Open

Add test utility to create Nexus endpoint#1279
Quinn-With-Two-Ns wants to merge 2 commits intotemporalio:mainfrom
Quinn-With-Two-Ns:SDK-3837

Conversation

@Quinn-With-Two-Ns
Copy link

@Quinn-With-Two-Ns Quinn-With-Two-Ns commented Jan 16, 2026

Add test utility to create Nexus endpoint. This matches what we have in Java and Dotnet


Note

Medium Risk
Introduces new public testing APIs that invoke operator-service RPCs; failures/mismatched server support could break test setups or external users relying on WorkflowEnvironment.

Overview
Adds WorkflowEnvironment.create_nexus_endpoint() and WorkflowEnvironment.delete_nexus_endpoint() to create/delete Nexus endpoints via the operator service, returning the created Endpoint.

Refactors Nexus workflow-caller tests to stop using the ad-hoc tests.helpers.nexus.create_nexus_endpoint helper and instead create endpoints through the test environment (threading env into _start_wf_and_nexus_op).

Written by Cursor Bugbot for commit 4d747a8. This will update automatically on new commits. Configure here.

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review January 16, 2026 03:22
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner January 16, 2026 03:22
Comment on lines +406 to +431
async def create_nexus_endpoint(
self, endpoint_name: str, task_queue: str
) -> temporalio.api.nexus.v1.Endpoint:
"""Create a Nexus endpoint with the given name and task queue.

Args:
endpoint_name: The name of the Nexus endpoint to create.
task_queue: The task queue to associate with the endpoint.

Returns:
The created Nexus endpoint.
"""
response = await self._client.operator_service.create_nexus_endpoint(
temporalio.api.operatorservice.v1.CreateNexusEndpointRequest(
spec=temporalio.api.nexus.v1.EndpointSpec(
name=endpoint_name,
target=temporalio.api.nexus.v1.EndpointTarget(
worker=temporalio.api.nexus.v1.EndpointTarget.Worker(
namespace=self._client.namespace,
task_queue=task_queue,
)
),
)
)
)
return response.endpoint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but we should make sure that tests/helpers/nexus.py::create_nexus_endpoint is removed and this is used throughout.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

from tests.helpers import find_free_port, new_worker
from tests.helpers.metrics import PromMetricMatcher
from tests.helpers.nexus import create_nexus_endpoint, make_nexus_endpoint_name
from tests.helpers.nexus import make_nexus_endpoint_name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed import but usages remain causing NameError

High Severity

The import of create_nexus_endpoint from tests.helpers.nexus was removed, but there are still 4 usages of this function in the file at lines 802, 847, 881, and 2145. These tests (test_start_operation_headers, test_workflow_run_operation_headers, test_cancel_operation_headers, and another test) would fail with NameError: name 'create_nexus_endpoint' is not defined when run. These usages need to be updated to use env.create_nexus_endpoint(endpoint_name, task_queue) like the other tests.

Additional Locations (2)

Fix in Cursor Fix in Web

@tconley1428
Copy link
Contributor

It does have typechecking issues however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants