Skip to content
Merged
Changes from 1 commit
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
Next Next commit
feat: test parallel execution of commands
`go test -run 'TestCommand_ParallelRun' -count 100000 -failfast -race`
  • Loading branch information
oprudkyi committed Oct 25, 2025
commit bc9dc5bfce5478d25f5349aa40f842e2e71ccd1f
28 changes: 28 additions & 0 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5284,3 +5284,31 @@ func TestCommand_ExclusiveFlagsWithAfter(t *testing.T) {
}))
require.True(t, called)
}

func TestCommand_ParallelRun(t *testing.T) {
t.Parallel()

for i := 0; i < 10; i++ {
t.Run(fmt.Sprintf("run_%d", i), func(t *testing.T) {
t.Parallel()

defer func() {
if r := recover(); r != nil {
t.Errorf("unexpected panic - '%s'", r)
}
}()

cmd := &Command{
Name: "debug",
Usage: "make an explosive entrance",
Action: func(_ context.Context, cmd *Command) error {
return nil
},
}

if err := cmd.Run(context.Background(), nil); err != nil {
fmt.Printf("%s\n", err)
}
})
}
}