We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents eb8b341 + d60ebab commit b868893Copy full SHA for b868893
pkg/cli/cli_test.go
@@ -464,6 +464,25 @@ plugins:
464
)
465
Expect(err).NotTo(HaveOccurred())
466
Expect(hasSubCommand(c.cmd, "version")).To(BeTrue())
467
+
468
+ // Test the version command
469
+ c.cmd.SetArgs([]string{"version"})
470
+ // Overwrite stdout to read the output and reset it afterwards
471
+ r, w, _ := os.Pipe()
472
+ temp := os.Stdout
473
+ defer func() {
474
+ os.Stdout = temp
475
+ }()
476
+ os.Stdout = w
477
+ Expect(c.cmd.Execute()).Should(Succeed())
478
479
+ _ = w.Close()
480
481
+ Expect(err).NotTo(HaveOccurred())
482
+ printed, _ := io.ReadAll(r)
483
+ Expect(string(printed)).To(Equal(
484
+ fmt.Sprintf("%s\n", version)))
485
486
})
487
488
0 commit comments