Skip to content

Commit

Permalink
Refactor functional tests to not rely on SetRuntime, use short variab…
Browse files Browse the repository at this point in the history
…le name
  • Loading branch information
tstromberg committed Mar 8, 2019
1 parent aa29480 commit 4f44208
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
25 changes: 11 additions & 14 deletions test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
)

func TestFunctional(t *testing.T) {
minikubeRunner := NewMinikubeRunner(t)
minikubeRunner.EnsureRunning()
r := NewMinikubeRunner(t)
r.EnsureRunning()
// This one is not parallel, and ensures the cluster comes up
// before we run any other tests.
t.Run("Status", testClusterStatus)
Expand All @@ -41,7 +41,7 @@ func TestFunctional(t *testing.T) {
t.Run("Provisioning", testProvisioning)
t.Run("Tunnel", testTunnel)

if !usingNoneDriver(minikubeRunner) {
if !usingNoneDriver(r) {
t.Run("EnvVars", testClusterEnv)
t.Run("SSH", testClusterSSH)
t.Run("IngressController", testIngressController)
Expand All @@ -50,25 +50,22 @@ func TestFunctional(t *testing.T) {
}

func TestFunctionalContainerd(t *testing.T) {
minikubeRunner := NewMinikubeRunner(t)
r := NewMinikubeRunner(t)

if usingNoneDriver(minikubeRunner) {
if usingNoneDriver(r) {
t.Skip("Can't run containerd backend with none driver")
}

if minikubeRunner.GetStatus() != state.None.String() {
minikubeRunner.RunCommand("delete", true)
if r.GetStatus() != state.None.String() {
r.RunCommand("delete", true)
}

minikubeRunner.SetRuntime("containerd")
minikubeRunner.EnsureRunning()

r.Start("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
t.Run("Gvisor", testGvisor)
t.Run("GvisorRestart", testGvisorRestart)
minikubeRunner.RunCommand("delete", true)
r.RunCommand("delete", true)
}

// usingNoneDriver returns true if using the none driver
func usingNoneDriver(runner util.MinikubeRunner) bool {
return strings.Contains(runner.StartArgs, "--vm-driver=none")
func usingNoneDriver(r util.MinikubeRunner) bool {
return strings.Contains(r.StartArgs, "--vm-driver=none")
}
5 changes: 0 additions & 5 deletions test/integration/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,6 @@ func (m *MinikubeRunner) RunDaemon2(command string) (*exec.Cmd, *bufio.Reader, *
return cmd, bufio.NewReader(stdoutPipe), bufio.NewReader(stderrPipe)
}

// SetRuntime saves the runtime backend
func (m *MinikubeRunner) SetRuntime(runtime string) {
m.Runtime = runtime
}

func (m *MinikubeRunner) SSH(command string) (string, error) {
path, _ := filepath.Abs(m.BinaryPath)
cmd := exec.Command(path, "ssh", command)
Expand Down

0 comments on commit 4f44208

Please sign in to comment.