Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/Temporalio/Worker/WorkflowInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public WorkflowInstance(WorkflowInstanceDetails details)
TaskQueue: details.TaskQueue,
TaskTimeout: start.WorkflowTaskTimeout.ToTimeSpan(),
WorkflowId: start.WorkflowId,
WorkflowStartTime: start.StartTime.ToDateTime(),
WorkflowType: start.WorkflowType);
workflowStackTrace = details.WorkflowStackTrace;
pendingTaskStackTraces = workflowStackTrace == WorkflowStackTrace.None ? null : new();
Expand Down
4 changes: 3 additions & 1 deletion src/Temporalio/Workflows/WorkflowInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ namespace Temporalio.Workflows
/// versions or if there is no root (i.e. the root is itself).</param>
/// <param name="RunId">Run ID for the workflow.</param>
/// <param name="RunTimeout">Run timeout for the workflow.</param>
/// <param name="StartTime">Time when the workflow started.</param>
/// <param name="StartTime">Time when the first workflow task started.</param>
/// <param name="TaskQueue">Task queue for the workflow.</param>
/// <param name="TaskTimeout">Task timeout for the workflow.</param>
/// <param name="WorkflowId">ID for the workflow.</param>
/// <param name="WorkflowStartTime">Time when the workflow started on the server.</param>
/// <param name="WorkflowType">Workflow type name.</param>
/// <remarks>
/// WARNING: This constructor may have required properties added. Do not rely on the exact
Expand All @@ -51,6 +52,7 @@ public record WorkflowInfo(
string TaskQueue,
TimeSpan TaskTimeout,
string WorkflowId,
DateTime WorkflowStartTime,
string WorkflowType)
{
/// <summary>
Expand Down
13 changes: 9 additions & 4 deletions tests/Temporalio.Tests/Worker/WorkflowWorkerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ await ExecuteWorkerAsync<InfoWorkflow>(async worker =>
(InfoWorkflow wf) => wf.RunAsync(),
new(id: $"workflow-{Guid.NewGuid()}", taskQueue: worker.Options.TaskQueue!));
var result = await handle.GetResultAsync();
var history = await handle.FetchHistoryAsync();
Assert.Equal(1, result.Attempt);
Assert.Null(result.ContinuedRunId);
Assert.Null(result.CronSchedule);
Expand All @@ -400,15 +401,19 @@ await ExecuteWorkerAsync<InfoWorkflow>(async worker =>
Assert.Null(result.Root);
Assert.Equal(handle.ResultRunId, result.RunId);
Assert.Null(result.RunTimeout);
Assert.InRange(
result.StartTime,
DateTime.UtcNow - TimeSpan.FromMinutes(5),
DateTime.UtcNow + TimeSpan.FromMinutes(5));
Assert.Equal(worker.Options.TaskQueue, result.TaskQueue);
// TODO(cretz): Can assume default 10 in all test servers?
Assert.Equal(TimeSpan.FromSeconds(10), result.TaskTimeout);
Assert.Equal(handle.Id, result.WorkflowId);
Assert.Equal("InfoWorkflow", result.WorkflowType);
// Start time is the first task start time, but workflow start time is the actual start
// time
var workflowStartTime = history.Events.
Single(e => e.WorkflowExecutionStartedEventAttributes != null).EventTime.ToDateTime();
Assert.Equal(workflowStartTime, result.WorkflowStartTime);
var firstTaskStartTime = history.Events.
First(e => e.WorkflowTaskStartedEventAttributes != null).EventTime.ToDateTime();
Assert.Equal(firstTaskStartTime, result.StartTime);
});
// Child info
await ExecuteWorkerAsync<InfoFromChildWorkflow>(
Expand Down
Loading