Add unit test for no k8s with version.

pull/12942/head
klaases 2021-11-18 15:19:11 -08:00
parent 227efdd03a
commit 9c6d971f34
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,7 @@ func TestNoKubernetes(t *testing.T) {
name string
validator validateFunc
}{
{"ErrorStartNoK8sWithVersion", errorStartNoK8sWithVersion},
{"Start", validateStartNoK8S},
{"VerifyK8sNotRunning", validateK8SNotRunning},
{"ProfileList", validateProfileListNoK8S},
@ -70,6 +71,17 @@ func TestNoKubernetes(t *testing.T) {
})
}
// ErrorStartNoK8sWithVersion expect an error when starting a minikube cluster without kubernetes and with a kubernetes version.
func errorStartNoK8sWithVersion(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)
args := append([]string{"start", "-p", profile, "--no-kubernetes", "--kubernetes-version=1.20"}, StartArgs()...)
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err == nil {
t.Fatalf("expected an error but none was thrown with args: %q", rr.Command())
}
}
// validateStartNoK8S starts a minikube cluster without kubernetes started/configured
func validateStartNoK8S(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)