Skip to content

Commit

Permalink
fix: tune printing 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 Oct 24, 2024
1 parent 9d4f463 commit 11f7fe9
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions pkg/tcl/testworkflowstcl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,42 @@ func PrintRunningContext(ui *ui.UI, execution testkube.TestWorkflowExecution) {
ctx := execution.RunningContext
if ctx.Interface_ != nil {
ui.Warn("Interface: ")
ui.Warn(" Name: ", ctx.Interface_.Name)
if ctx.Interface_.Name != "" {
ui.Warn(" Name: ", ctx.Interface_.Name)
}
if ctx.Interface_.Type_ != nil {
ui.Warn(" Type: ", string(*ctx.Interface_.Type_))
}
}
if ctx.Actor != nil {
ui.Warn("Actor: ")
ui.Warn(" Name: ", ctx.Actor.Name)
ui.Warn(" Email: ", ctx.Actor.Email)
ui.Warn(" Execution id: ", ctx.Actor.ExecutionId)
ui.Warn(" Execution path: ", ctx.Actor.ExecutionPath)
fields := []struct {
name string
value string
}{
{
" Name: ",
ctx.Actor.Name,
},
{
" Email: ",
ctx.Actor.Email,
},
{
" Execution id: ",
ctx.Actor.ExecutionId,
},
{
" Execution path: ",
ctx.Actor.ExecutionPath,
},
}

for _, field := range fields {
if field.value != "" {
ui.Warn(field.name, field.value)
}
}
if ctx.Actor.Type_ != nil {
ui.Warn(" Type: ", string(*ctx.Actor.Type_))
}
Expand Down

0 comments on commit 11f7fe9

Please sign in to comment.