add more tear down and clean up
parent
270317b860
commit
59e6dc8f46
|
@ -28,7 +28,7 @@ set -e
|
|||
OS_ARCH="linux-amd64"
|
||||
VM_DRIVER="kvm2"
|
||||
JOB_NAME="Linux-KVM"
|
||||
PARALLEL_COUNT=3
|
||||
PARALLEL_COUNT=4
|
||||
|
||||
# Download files and set permissions
|
||||
source ./common.sh
|
||||
|
|
|
@ -28,7 +28,7 @@ set -e
|
|||
OS_ARCH="linux-amd64"
|
||||
VM_DRIVER="virtualbox"
|
||||
JOB_NAME="Linux-VirtualBox"
|
||||
PARALLEL_COUNT=3
|
||||
PARALLEL_COUNT=4
|
||||
|
||||
# Download files and set permissions
|
||||
source ./common.sh
|
||||
|
|
|
@ -39,8 +39,11 @@ func TestContainerd(t *testing.T) {
|
|||
|
||||
func testGvisorRestart(t *testing.T) {
|
||||
p := profile(t)
|
||||
|
||||
if toParallel() {
|
||||
t.Parallel()
|
||||
}
|
||||
mk := NewMinikubeRunner(t, p, "--wait=false")
|
||||
defer mk.TearDown(t)
|
||||
|
||||
stdout, stderr, err := mk.Start("--container-runtime=containerd", "--docker-opt containerd=/var/run/containerd/containerd.sock")
|
||||
if err != nil {
|
||||
|
|
|
@ -35,7 +35,6 @@ func TestDocker(t *testing.T) {
|
|||
if toParallel() {
|
||||
t.Parallel()
|
||||
}
|
||||
|
||||
mk := NewMinikubeRunner(t, p, "--wait=false")
|
||||
defer mk.TearDown(t)
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package integration
|
|||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/machine/libmachine/state"
|
||||
"k8s.io/minikube/test/integration/util"
|
||||
|
@ -56,14 +55,7 @@ func TestPersistence(t *testing.T) {
|
|||
// Make sure everything is up before we stop.
|
||||
verifyBusybox(t)
|
||||
|
||||
checkStop := func() error {
|
||||
stdout, stderr, err = mk.RunCommandRetriable("stop")
|
||||
return err
|
||||
}
|
||||
|
||||
if err = util.RetryX(checkStop, 5*time.Second, 3*time.Minute); err != nil {
|
||||
t.Fatalf("TestPersistence Failed to stop minikube : %v", err)
|
||||
}
|
||||
mk.RunCommand("stop", true)
|
||||
mk.CheckStatus(state.Stopped.String())
|
||||
|
||||
stdout, stderr, err = mk.Start()
|
||||
|
|
|
@ -87,9 +87,6 @@ func TestStartStop(t *testing.T) {
|
|||
}
|
||||
|
||||
mk.RunCommand("config set WantReportErrorPrompt false", true)
|
||||
mk.RunCommand("delete", false)
|
||||
mk.CheckStatus(state.None.String())
|
||||
|
||||
stdout, stderr, err := mk.Start(tc.args...)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to start minikube (for profile %s) failed : %v\nstdout: %s\nstderr: %s", pn, err, stdout, stderr)
|
||||
|
@ -103,34 +100,17 @@ func TestStartStop(t *testing.T) {
|
|||
t.Fatalf("IP command returned an invalid address: %s \n %s", ip, stderr)
|
||||
}
|
||||
|
||||
// check for the current-context before and after the stop
|
||||
// TODO: medya move this test to a non-parallel test so we can do more parallel
|
||||
// kr := util.NewKubectlRunner(t, p)
|
||||
// currentContext, err := kr.RunCommand([]string{"config", "current-context"}, false)
|
||||
// if err != nil {
|
||||
// t.Fatalf("Failed to fetch current-context")
|
||||
// }
|
||||
// if strings.TrimRight(string(currentContext), "\n") != p {
|
||||
// t.Fatalf("got current-context - %q, want current-context %q", string(currentContext), p)
|
||||
// }
|
||||
|
||||
checkStop := func() error {
|
||||
mk.RunCommand("stop", true)
|
||||
stop := func() error {
|
||||
stdout, stderr, err = mk.RunCommandRetriable("stop")
|
||||
return mk.CheckStatusNoFail(state.Stopped.String())
|
||||
}
|
||||
|
||||
if err := util.Retry(t, checkStop, 10*time.Second, 3); err != nil {
|
||||
t.Fatalf("timed out while checking stopped status: %v", err)
|
||||
}
|
||||
err = util.RetryX(stop, 10*time.Second, 2*time.Minute)
|
||||
mk.CheckStatus(state.Stopped.String())
|
||||
|
||||
// TODO medyagh: the commented code beollow was not correct ! I leave it for another PR
|
||||
// TODO medyagh:
|
||||
// https://github.com/kubernetes/minikube/issues/4854
|
||||
|
||||
// running this command results in error when the current-context is not set
|
||||
// if err := mk.Run("config current-context"); err != nil {
|
||||
// t.Logf("current-context is not set to minikube")
|
||||
// }
|
||||
|
||||
stdout, stderr, err = mk.Start(tc.args...)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to start minikube (for profile %s) failed : %v\nstdout: %s\nstderr: %s", t.Name(), err, stdout, stderr)
|
||||
|
|
|
@ -242,7 +242,7 @@ func (m *MinikubeRunner) Start(opts ...string) (stdout string, stderr string, er
|
|||
stdout, stderr, err = m.RunCommandRetriable(cmd)
|
||||
return err
|
||||
}
|
||||
err = RetryX(s, 30*time.Second, m.TimeOutStart)
|
||||
err = RetryX(s, 10*time.Second, m.TimeOutStart)
|
||||
return stdout, stderr, err
|
||||
}
|
||||
|
||||
|
|
|
@ -54,9 +54,7 @@ func fileExists(fname string) error {
|
|||
// and it tries to upgrade from the older supported k8s to news supported k8s
|
||||
func TestVersionUpgrade(t *testing.T) {
|
||||
p := profile(t)
|
||||
if isTestNoneDriver() {
|
||||
p = "minikube"
|
||||
} else {
|
||||
if toParallel() {
|
||||
t.Parallel()
|
||||
}
|
||||
// fname is the filename for the minikube's latetest binary. this file been pre-downloaded before test by hacks/jenkins/common.sh
|
||||
|
@ -65,12 +63,10 @@ func TestVersionUpgrade(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
defer os.Remove(fname)
|
||||
|
||||
mkCurrent := NewMinikubeRunner(t, p)
|
||||
mkCurrent.RunCommand("delete", true)
|
||||
mkCurrent.CheckStatus(state.None.String())
|
||||
|
||||
defer os.Remove(fname)
|
||||
defer mkCurrent.TearDown(t)
|
||||
|
||||
mkRelease := NewMinikubeRunner(t, p)
|
||||
mkRelease.BinaryPath = fname
|
||||
|
@ -87,9 +83,7 @@ func TestVersionUpgrade(t *testing.T) {
|
|||
// Trim the leading "v" prefix to assert that we handle it properly.
|
||||
stdout, stderr, err = mkCurrent.Start(fmt.Sprintf("--kubernetes-version=%s", strings.TrimPrefix(constants.NewestKubernetesVersion, "v")))
|
||||
if err != nil {
|
||||
t.Fatalf("TestVersionUpgrade minikube start failed : %v\nstdout: %s\nstderr: %s", err, stdout, stderr)
|
||||
t.Fatalf("TestVersionUpgrade mkCurrent.Start start failed : %v\nstdout: %s\nstderr: %s", err, stdout, stderr)
|
||||
}
|
||||
mkCurrent.CheckStatus(state.Running.String())
|
||||
mkCurrent.RunCommand("delete", true)
|
||||
mkCurrent.CheckStatus(state.None.String())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue