Skip to content

Commit 354855d

Browse files
committed
Less Retry on minikube, new auto fail helpers MustStart,MustRun
1 parent 39d7e12 commit 354855d

17 files changed

+67
-92
lines changed

test/integration/a_download_only_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestDownloadOnly(t *testing.T) {
5252

5353
minHome := constants.GetMinipath()
5454
for _, v := range []string{constants.OldestKubernetesVersion, constants.NewestKubernetesVersion} {
55-
mk.StartWithFail("--download-only", fmt.Sprintf("--kubernetes-version=%s", v))
55+
mk.MustStart("--download-only", fmt.Sprintf("--kubernetes-version=%s", v))
5656
// checking if cached images are downloaded for example (kube-apiserver_v1.15.2, kube-scheduler_v1.15.2, ...)
5757
_, imgs := constants.GetKubeadmCachedImages("", v)
5858
for _, img := range imgs {

test/integration/containerd_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ func testGvisorRestart(t *testing.T) {
4848
mk := NewMinikubeRunner(t, p, "--wait=false")
4949
defer mk.TearDown(t)
5050

51-
mk.StartWithFail("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
52-
mk.RunCommand("cache add gcr.io/k8s-minikube/gvisor-addon:latest", true)
53-
mk.RunCommand("addons enable gvisor", true)
51+
mk.MustStart("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
52+
mk.MustRun("cache add gcr.io/k8s-minikube/gvisor-addon:latest")
53+
mk.MustRun("addons enable gvisor")
5454

5555
t.Log("waiting for gvisor controller to come up")
5656
if err := waitForGvisorControllerRunning(p); err != nil {
@@ -64,8 +64,8 @@ func testGvisorRestart(t *testing.T) {
6464
}
6565
deleteUntrustedWorkload(t, p)
6666

67-
mk.RunCommand("delete", true)
68-
mk.StartWithFail("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
67+
mk.MustRun("delete")
68+
mk.MustStart("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
6969
mk.CheckStatus(state.Running.String())
7070

7171
t.Log("waiting for gvisor controller to come up")

test/integration/docker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestDocker(t *testing.T) {
4646
t.Logf("pre-delete failed (probably ok): %v", err)
4747
}
4848

49-
mk.StartWithFail("--docker-env=FOO=BAR", "--docker-env=BAZ=BAT", "--docker-opt=debug", " --docker-opt=icc=true")
49+
mk.MustStart("--docker-env=FOO=BAR", "--docker-env=BAZ=BAT", "--docker-opt=debug", " --docker-opt=icc=true")
5050

5151
mk.CheckStatus(state.Running.String())
5252

test/integration/fn_addons.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func testIngressController(t *testing.T) {
128128
mk := NewMinikubeRunner(t, p, "--wait=false")
129129
kr := util.NewKubectlRunner(t, p)
130130

131-
mk.RunCommand("addons enable ingress", true)
131+
mk.MustRun("addons enable ingress")
132132
if err := waitForIngressControllerRunning(p); err != nil {
133133
t.Fatalf("Failed waiting for ingress-controller to be up: %v", err)
134134
}
@@ -168,7 +168,7 @@ func testIngressController(t *testing.T) {
168168
}
169169
}
170170
}()
171-
mk.RunCommand("addons disable ingress", true)
171+
mk.MustRun("addons disable ingress")
172172
}
173173

174174
func testServicesList(t *testing.T) {
@@ -177,7 +177,10 @@ func testServicesList(t *testing.T) {
177177
mk := NewMinikubeRunner(t, p)
178178

179179
checkServices := func() error {
180-
output, stderr := mk.RunCommand("service list", false)
180+
output, stderr, err := mk.RunCommand("service list", false)
181+
if err != nil {
182+
return err
183+
}
181184
if !strings.Contains(output, "kubernetes") {
182185
return fmt.Errorf("error, kubernetes service missing from output: %s, \n stderr: %s", output, stderr)
183186
}
@@ -191,7 +194,7 @@ func testRegistry(t *testing.T) {
191194
t.Parallel()
192195
p := profileName(t)
193196
mk := NewMinikubeRunner(t, p)
194-
mk.RunCommand("addons enable registry", true)
197+
mk.MustRun("addons enable registry")
195198
client, err := kapi.Client(p)
196199
if err != nil {
197200
t.Fatalf("getting kubernetes client: %v", err)
@@ -210,7 +213,7 @@ func testRegistry(t *testing.T) {
210213
if err := kapi.WaitForPodsWithLabelRunning(client, "kube-system", ps); err != nil {
211214
t.Fatalf("waiting for registry-proxy pods: %v", err)
212215
}
213-
ip, stderr := mk.RunCommand("ip", true)
216+
ip, stderr := mk.MustRun("ip")
214217
ip = strings.TrimSpace(ip)
215218
endpoint := fmt.Sprintf("http://%s:%d", ip, 5000)
216219
u, err := url.Parse(endpoint)
@@ -259,7 +262,7 @@ func testRegistry(t *testing.T) {
259262
t.Errorf("failed to delete pod registry-test")
260263
}
261264
}()
262-
mk.RunCommand("addons disable registry", true)
265+
mk.MustRun("addons disable registry")
263266
}
264267

265268
// waitForNginxRunning waits for nginx service to be up

test/integration/fn_cluster_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func testClusterEnv(t *testing.T) {
3434
mk := NewMinikubeRunner(t, p, "--wait=false")
3535

3636
// Set a specific shell syntax so that we don't have to handle every possible user shell
37-
envOut, stderr := mk.RunCommand("docker-env --shell=bash", true)
37+
envOut, stderr := mk.MustRun("docker-env --shell=bash")
3838
vars := mk.ParseEnvCmdOutput(envOut)
3939
if len(vars) == 0 {
4040
t.Fatalf("Failed to parse env vars:\n%s, \n stderr: %s ", envOut, stderr)

test/integration/fn_cluster_logs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ func testClusterLogs(t *testing.T) {
2727
t.Parallel()
2828
p := profileName(t)
2929
mk := NewMinikubeRunner(t, p)
30-
logsCmdOutput := mk.GetLogs()
30+
logsCmdStdout, _ := mk.GetLogs()
3131

3232
// check for # of lines or check for strings
3333
logWords := []string{"minikube", ".go"}
3434
for _, logWord := range logWords {
35-
if !strings.Contains(logsCmdOutput, logWord) {
36-
t.Fatalf("Error in logsCmdOutput, expected to find: %s. Output: %s", logWord, logsCmdOutput)
35+
if !strings.Contains(logsCmdStdout, logWord) {
36+
t.Fatalf("Error in logsCmdOutput, expected to find: %s. Output: %s", logWord, logsCmdStdout)
3737
}
3838
}
3939
}

test/integration/fn_cluster_ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func testClusterSSH(t *testing.T) {
2828
p := profileName(t)
2929
mk := NewMinikubeRunner(t, p, "--wait=false")
3030
expectedStr := "hello"
31-
sshCmdOutput, stderr := mk.RunCommand("ssh echo "+expectedStr, true)
31+
sshCmdOutput, stderr := mk.MustRun("ssh echo " + expectedStr)
3232
if !strings.Contains(sshCmdOutput, expectedStr) {
3333
t.Fatalf("ExpectedStr sshCmdOutput to be: %s. Output was: %s Stderr: %s", expectedStr, sshCmdOutput, stderr)
3434
}

test/integration/fn_profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func testProfileList(t *testing.T) {
2828
p := profileName(t)
2929
t.Parallel()
3030
mk := NewMinikubeRunner(t, p, "--wait=false")
31-
out, stderr := mk.RunCommand("profile list", true)
31+
out, stderr := mk.MustRun("profile list")
3232
if !strings.Contains(out, p) {
3333
t.Errorf("Error , failed to read profile name (%s) in `profile list` command output : \n %q : \n stderr: %s ", p, out, stderr)
3434
}

test/integration/fn_tunnel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func testTunnel(t *testing.T) {
4949
p := profileName(t)
5050
mk := NewMinikubeRunner(t, p, "--wait=false")
5151
go func() {
52-
output, stderr := mk.RunCommand("tunnel --alsologtostderr -v 8 --logtostderr", true)
52+
output, stderr := mk.MustRun("tunnel --alsologtostderr -v 8 --logtostderr")
5353
if t.Failed() {
5454
t.Errorf("tunnel stderr : %s", stderr)
5555
t.Errorf("tunnel output : %s", output)

test/integration/functional_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
func TestFunctional(t *testing.T) {
2626
p := profileName(t)
2727
mk := NewMinikubeRunner(t, p)
28-
mk.StartWithFail()
28+
mk.MustStart()
2929
if !isTestNoneDriver(t) { // none driver doesn't need to be deleted
3030
defer mk.TearDown(t)
3131
}

0 commit comments

Comments
 (0)