From 5242dcb0b8353004c28c556b803c42285a79b85a Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 21 Oct 2019 11:10:49 -0700 Subject: [PATCH] hook up mkcmp command to code to time 'minikube start' --- cmd/performance/cmd/mkcmp.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmd/performance/cmd/mkcmp.go b/cmd/performance/cmd/mkcmp.go index f1a26fe953..91e887907c 100644 --- a/cmd/performance/cmd/mkcmp.go +++ b/cmd/performance/cmd/mkcmp.go @@ -17,20 +17,30 @@ limitations under the License. package cmd import ( + "context" "errors" "fmt" "os" "github.com/spf13/cobra" + "k8s.io/minikube/pkg/minikube/performance" ) var rootCmd = &cobra.Command{ - Use: "mkcmp [path to first binary] [path to second binary]", - Short: "mkcmp is used to compare performance of two minikube binaries", + Use: "mkcmp [path to first binary] [path to second binary]", + Short: "mkcmp is used to compare performance of two minikube binaries", + SilenceUsage: true, + SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { return validateArgs(args) }, - Run: func(cmd *cobra.Command, args []string) {}, + RunE: func(cmd *cobra.Command, args []string) error { + binaries, err := performance.Binaries(args) + if err != nil { + return err + } + return performance.CompareMinikubeStart(context.Background(), binaries) + }, } func validateArgs(args []string) error { @@ -43,7 +53,7 @@ func validateArgs(args []string) error { // Execute runs the mkcmp command func Execute() { if err := rootCmd.Execute(); err != nil { - fmt.Println(err) + fmt.Println("Error:", err) os.Exit(1) } }