Skip to content

Commit

Permalink
feat: map test workflow running context
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Jul 5, 2024
1 parent c3b438e commit ee741fb
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pkg/mapper/testworkflows/openapi_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,13 @@ func MapTestWorkflowSignatureAPIToKube(v testkube.TestWorkflowSignature) testwor
}
}

func MapRunningContextAPIToKube(v testkube.RunningContext) testworkflowsv1.RunningContext {
return testworkflowsv1.RunningContext{
Type_: testworkflowsv1.RunningContextType(v.Type_),
Context: v.Context,
}
}

func MapTestWorkflowExecutionAPIToKube(v *testkube.TestWorkflowExecution) *testworkflowsv1.TestWorkflowExecutionDetails {
return &testworkflowsv1.TestWorkflowExecutionDetails{
Id: v.Id,
Expand All @@ -1378,6 +1385,7 @@ func MapTestWorkflowExecutionAPIToKube(v *testkube.TestWorkflowExecution) *testw
Workflow: common.MapPtr(v.Workflow, MapTestWorkflowAPIToKube),
ResolvedWorkflow: common.MapPtr(v.ResolvedWorkflow, MapTestWorkflowAPIToKube),
TestWorkflowExecutionName: v.TestWorkflowExecutionName,
RunningContext: common.MapPtr(v.RunningContext, MapRunningContextAPIToKube),
}
}

Expand All @@ -1391,13 +1399,14 @@ func MapTestWorkflowExecutionStatusAPIToKube(v *testkube.TestWorkflowExecution,
func MapTestWorkflowExecutionAPIToKubeTestWorkflowStatusSummary(v *testkube.TestWorkflowExecution) testworkflowsv1.TestWorkflowStatusSummary {
return testworkflowsv1.TestWorkflowStatusSummary{
LatestExecution: &testworkflowsv1.TestWorkflowExecutionSummary{
Id: v.Id,
Name: v.Name,
Number: v.Number,
ScheduledAt: metav1.NewTime(v.ScheduledAt),
StatusAt: metav1.NewTime(v.StatusAt),
Result: common.MapPtr(v.Result, MapTestWorkflowResultAPIToKubeTestWorkflowResultSummary),
Workflow: common.MapPtr(v.Workflow, MapTestWorkflowAPIToKubeTestWorkflowSummary),
Id: v.Id,
Name: v.Name,
Number: v.Number,
ScheduledAt: metav1.NewTime(v.ScheduledAt),
StatusAt: metav1.NewTime(v.StatusAt),
Result: common.MapPtr(v.Result, MapTestWorkflowResultAPIToKubeTestWorkflowResultSummary),
Workflow: common.MapPtr(v.Workflow, MapTestWorkflowAPIToKubeTestWorkflowSummary),
RunningContext: common.MapPtr(v.RunningContext, MapRunningContextAPIToKube),
},
}
}
Expand Down

0 comments on commit ee741fb

Please sign in to comment.