From da0ce6cc903fb0f21681ed3e51acad652d1f48bb Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Wed, 10 Apr 2019 15:16:23 -0700 Subject: [PATCH] Avoid surfacing spurious errors --- pkg/minikube/logs/logs.go | 5 ++++- pkg/minikube/logs/logs_test.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/logs/logs.go b/pkg/minikube/logs/logs.go index 3364a23f1c6b..3d4391551aab 100644 --- a/pkg/minikube/logs/logs.go +++ b/pkg/minikube/logs/logs.go @@ -35,6 +35,9 @@ import ( // rootCauseRe is a regular expression that matches known failure root causes var rootCauseRe = regexp.MustCompile(`^error: |eviction manager: pods.* evicted|unknown flag: --|forbidden.*no providers available|eviction manager:.*evicted`) +// ignoreRe is a regular expression that matches spurious errors to not surface +var ignoreCauseRe = regexp.MustCompile("error: no objects passed to apply") + // importantPods are a list of pods to retrieve logs for, in addition to the bootstrapper logs. var importantPods = []string{ "kube-apiserver", @@ -62,7 +65,7 @@ func Follow(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner bootstrappe // IsProblem returns whether this line matches a known problem func IsProblem(line string) bool { - return rootCauseRe.MatchString(line) + return rootCauseRe.MatchString(line) && !ignoreCauseRe.MatchString(line) } // FindProblems finds possible root causes among the logs diff --git a/pkg/minikube/logs/logs_test.go b/pkg/minikube/logs/logs_test.go index 487fba654fc2..85576a9a16ca 100644 --- a/pkg/minikube/logs/logs_test.go +++ b/pkg/minikube/logs/logs_test.go @@ -33,6 +33,7 @@ func TestIsProblem(t *testing.T) { {"apiserver-auth-mode #2852", true, `{"log":"Error: unknown flag: --Authorization.Mode\n","stream":"stderr","time":"2018-06-17T22:16:35.134161966Z"}`}, {"apiserver-admission #3524", true, "error: unknown flag: --GenericServerRunOptions.AdmissionControl"}, {"no-providers-available #3818", true, ` kubelet.go:1662] Failed creating a mirror pod for "kube-apiserver-minikube_kube-system(c7d572aebd3d33b17fa78ae6395b6d0a)": pods "kube-apiserver-minikube" is forbidden: no providers available to validate pod request`}, + {"no-objects-passed-to-apply #4010", false, "error: no objects passed to apply"}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) {