Skip to content

Commit 5486f46

Browse files
committed
Clean up test a little bit
1 parent f9785e4 commit 5486f46

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tests/contrib/test_opentelemetry.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from opentelemetry.trace import StatusCode, get_tracer
1515

1616
from temporalio import activity, workflow
17-
from temporalio.client import Client, WithStartWorkflowOperation
17+
from temporalio.client import Client, WithStartWorkflowOperation, WorkflowUpdateStage
1818
from temporalio.common import RetryPolicy, WorkflowIDConflictPolicy
1919
from temporalio.contrib.opentelemetry import TracingInterceptor
2020
from temporalio.contrib.opentelemetry import workflow as otel_workflow
@@ -184,8 +184,6 @@ async def test_opentelemetry_tracing(client: Client, env: WorkflowEnvironment):
184184
)
185185
global ready_for_update
186186
ready_for_update = asyncio.Semaphore(0)
187-
global ready_for_update_with_start
188-
ready_for_update_with_start = asyncio.Semaphore(0)
189187
# Create a tracer that has an in-memory exporter
190188
exporter = InMemorySpanExporter()
191189
provider = TracerProvider()
@@ -320,8 +318,6 @@ async def test_opentelemetry_tracing_update_with_start(
320318
pytest.skip(
321319
"Java test server: https://github.com/temporalio/sdk-java/issues/1424"
322320
)
323-
global ready_for_update
324-
ready_for_update = asyncio.Semaphore(0)
325321
global ready_for_update_with_start
326322
ready_for_update_with_start = asyncio.Semaphore(0)
327323
# Create a tracer that has an in-memory exporter
@@ -365,25 +361,27 @@ async def test_opentelemetry_tracing_update_with_start(
365361
task_queue=task_queue,
366362
id_conflict_policy=WorkflowIDConflictPolicy.USE_EXISTING,
367363
)
368-
await client.execute_update_with_start_workflow(
369-
update=TracingWorkflow.update_with_start,
364+
await client.start_update_with_start_workflow(
365+
TracingWorkflow.update_with_start,
370366
start_workflow_operation=start_op,
371367
id=handle.id,
368+
wait_for_stage=WorkflowUpdateStage.ACCEPTED,
372369
)
373370
await handle.result()
374371

375-
# issue update with start again now that the former has completed
372+
# issue update with start again to trigger a new workflow
373+
workflow_id = f"workflow_{uuid.uuid4()}"
376374
start_op = WithStartWorkflowOperation(
377375
TracingWorkflow.run,
378376
TracingWorkflowParam(actions=[]),
379-
id="second-workflow",
377+
id=workflow_id,
380378
task_queue=task_queue,
381379
id_conflict_policy=WorkflowIDConflictPolicy.USE_EXISTING,
382380
)
383381
await client.execute_update_with_start_workflow(
384382
update=TracingWorkflow.update_with_start,
385383
start_workflow_operation=start_op,
386-
id="second-workflow",
384+
id=workflow_id,
387385
)
388386

389387
# Dump debug with attributes, but do string assertion test without

0 commit comments

Comments
 (0)