Skip to content

[Bug] Test env does not return result of workflow with child workflow #276

Closed as not planned
@dimroc

Description

@dimroc

What are you really trying to do?

I am trying to test a workflow that spins up one child workflow inside a future.

Describe the bug

  1. Without a child workflow, the following code returns a result one can assert against.
  2. With a child workflow, the following code has result nil, even if you try to wait for workflow handle. This happens often, but not all the time, implying a race condition?

However, in both scenarios, it's very evident that all workflows, child workflows, and activities are running.

      Temporalio::Testing::WorkflowEnvironment.start_time_skipping do |env|
        worker = Temporalio::Worker.new(
          client: env.client,
          task_queue: "tq-#{SecureRandom.uuid}",
          workflows: [
            AnalyzerUploadWorkflow,
            AnalyzerDocumentCreationWorkflow # Child workflow
          ],
          activities: [
            AnalyzerUploadActivities::BestPdfSplit,
            PdfImageActivities::Ingestion,
            AnalyzerDocument::CreationActivity
          ]
        )

        result = worker.run do
          env.client.execute_workflow(
            AnalyzerUploadWorkflow,
            analyzer_upload.id,
            id: workflow_id,
            task_queue: worker.task_queue
          )
        end

        expect(result).to be_present # <--- fails if AnalyzerUploadWorkflow is refactored to have child workflow
      end

Minimal Reproduction

TBD

Environment/Versions

  • OS and processor: M3 MacBook
  • Temporal Version: Ruby SDK 0.4
  • Are you using Docker or Kubernetes or building Temporal from source? Temporal test suite

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions