Update TestFunctional/parallel/DryRun and TestJSONOutputError to match new behavior
parent
8ef7410066
commit
09cdf602b8
|
@ -44,9 +44,16 @@ func Message(r reason.Kind, format string, args ...out.V) {
|
|||
if len(args) == 0 {
|
||||
args = append(args, out.V{})
|
||||
}
|
||||
args[0]["fatal_msg"] = out.Fmt(format, args...)
|
||||
args[0]["fatal_code"] = r.ID
|
||||
out.Error(r, "Exiting due to {{.fatal_code}}: {{.fatal_msg}}", args...)
|
||||
|
||||
// No need to manipulate the message for JSON output
|
||||
if out.JSON {
|
||||
out.Error(r, format, args...)
|
||||
} else {
|
||||
args[0]["fatal_msg"] = out.Fmt(format, args...)
|
||||
args[0]["fatal_code"] = r.ID
|
||||
out.Error(r, "Exiting due to {{.fatal_code}}: {{.fatal_msg}}", args...)
|
||||
}
|
||||
|
||||
os.Exit(r.ExitCode)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import (
|
|||
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
"k8s.io/minikube/pkg/minikube/reason"
|
||||
"k8s.io/minikube/pkg/util/retry"
|
||||
|
||||
"github.com/elazarl/goproxy"
|
||||
|
@ -450,7 +451,7 @@ func validateDryRun(ctx context.Context, t *testing.T, profile string) {
|
|||
c := exec.CommandContext(mctx, Target(), startArgs...)
|
||||
rr, err := Run(t, c)
|
||||
|
||||
wantCode := 78 // exit.Config
|
||||
wantCode := reason.ExInsufficientMemory
|
||||
if rr.ExitCode != wantCode {
|
||||
t.Errorf("dry-run(250MB) exit code = %d, wanted = %d: %v", rr.ExitCode, wantCode, err)
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ func TestJSONOutputError(t *testing.T) {
|
|||
t.Fatalf("last cloud event is not of type error: %v", last)
|
||||
}
|
||||
last.validateData(t, "exitcode", fmt.Sprintf("%v", reason.ExDriverUnsupported))
|
||||
last.validateData(t, "message", fmt.Sprintf("The driver 'fail' is not supported on %s\n", runtime.GOOS))
|
||||
last.validateData(t, "message", fmt.Sprintf("The driver 'fail' is not supported on %s", runtime.GOOS))
|
||||
}
|
||||
|
||||
type cloudEvent struct {
|
||||
|
@ -149,7 +149,7 @@ func (c *cloudEvent) validateData(t *testing.T, key, value string) {
|
|||
t.Fatalf("expected key %s does not exist in cloud event", key)
|
||||
}
|
||||
if v != value {
|
||||
t.Fatalf("values in cloud events do not match:\nActual:\n%v\nExpected:\n%v\n", v, value)
|
||||
t.Fatalf("values in cloud events do not match:\nActual:\n'%v'\nExpected:\n'%v'\n", v, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue