Skip to content

Commit d4372e0

Browse files
craig[bot]nameisbhaskar
andcommitted
Merge #150412
150412: Add a roachtest command to list operations r=shailendra-patel a=nameisbhaskar A new command is added to roachtest to list all available operations. The command is ``` roachtest list-operations ``` Release note: None Epic: None Co-authored-by: Bhaskarjyoti Bora <[email protected]>
2 parents 261b80b + e60a371 commit d4372e0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pkg/cmd/roachtest/main.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,31 @@ Check --parallelism, --run-forever and --wait-before-next-execution flags`,
231231
rootCmd.AddCommand(benchCmd)
232232
rootCmd.AddCommand(runOperationCmd)
233233

234+
var listOperationCmd = &cobra.Command{
235+
Use: "list-operations",
236+
Short: "list all operation names",
237+
Long: `List all available operations that can be run with the run-operation command.
238+
239+
This command lists the names of all registered operations.
240+
241+
Example:
242+
243+
roachtest list-operations
244+
`,
245+
RunE: func(cmd *cobra.Command, args []string) error {
246+
r := makeTestRegistry()
247+
operations.RegisterOperations(&r)
248+
249+
ops := r.AllOperations()
250+
for _, op := range ops {
251+
fmt.Printf("%s\n", op.Name)
252+
}
253+
254+
return nil
255+
},
256+
}
257+
rootCmd.AddCommand(listOperationCmd)
258+
234259
var err error
235260
config.OSUser, err = user.Current()
236261
if err != nil {

0 commit comments

Comments
 (0)