From 7750b3c445a4035c18196309b46a192b1b3175d1 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 31 Aug 2020 18:17:15 -0400 Subject: [PATCH] mkcmp: download artifacts before timing starT --- pkg/minikube/perf/start.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/perf/start.go b/pkg/minikube/perf/start.go index e41547f31c..1442cbcbae 100644 --- a/pkg/minikube/perf/start.go +++ b/pkg/minikube/perf/start.go @@ -36,9 +36,13 @@ const ( func CompareMinikubeStart(ctx context.Context, out io.Writer, binaries []*Binary) error { drivers := []string{"kvm2", "docker"} for _, d := range drivers { + fmt.Printf("**%s Driver**\n", d) + if err := downloadArtifacts(ctx, binaries, d); err != nil { + fmt.Printf("error downloading artifacts: %v", err) + continue + } rm, err := collectResults(ctx, binaries, d) if err != nil { - fmt.Printf("**%s Driver**\n", d) fmt.Printf("error collecting results for %s driver: %v\n", d, err) continue } @@ -71,6 +75,16 @@ func average(nums []float64) float64 { return total / float64(len(nums)) } +func downloadArtifacts(ctx context.Context, binaries []*Binary, driver string) error { + for _, b := range binaries { + c := exec.CommandContext(ctx, b.path, "start", fmt.Sprintf("--driver=%s", driver), "--download-only") + if err := c.Run(); err != nil { + return errors.Wrap(err, "downloading artifacts") + } + } + return nil +} + // timeMinikubeStart returns the time it takes to execute `minikube start` // It deletes the VM after `minikube start`. func timeMinikubeStart(ctx context.Context, binary *Binary, driver string) (*result, error) {