list vms after clean up

pull/4946/head
Medya Gh 2019-07-24 13:32:32 -07:00
parent c6c84ab835
commit 9b3f72024a
7 changed files with 49 additions and 24 deletions

View File

@ -140,6 +140,8 @@ if type -P virsh; then
virsh -c qemu:///system list --all || true
echo ">> Virsh VM list after clean up (should be empty) :"
virsh -c qemu:///system list --all || true
fi
if type -P vboxmanage; then
@ -166,6 +168,8 @@ if type -P vboxmanage; then
vboxmanage list vms || true
echo ">> Vbox VM list after clean up (should be empty) :"
vboxmanage list vms || true
fi
if type -P hdiutil; then

View File

@ -70,7 +70,7 @@ func (s *PodStore) Stop() {
close(s.stopCh)
}
// GetClient gkets the client from config
// GetClient gets the client from config
func GetClient(kubectlContext ...string) (kubernetes.Interface, error) {
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
configOverrides := &clientcmd.ConfigOverrides{}

View File

@ -29,6 +29,9 @@ import (
func TestFunctional(t *testing.T) {
p := "minikube"
mk := NewMinikubeRunner(t, p)
if !usingNoneDriver(mk) {
t.Parallel()
}
mk.EnsureRunning()
// This one is not parallel, and ensures the cluster comes up
// before we run any other tests.

View File

@ -26,6 +26,9 @@ import (
func TestISO(t *testing.T) {
p := t.Name()
if !usingNoneDriver(mk) {
t.Parallel()
}
mk := NewMinikubeRunner(t, p, "--wait=false")
mk.RunCommand("delete", false)

View File

@ -29,7 +29,6 @@ import (
)
func TestPersistence(t *testing.T) {
t.Parallel()
p := t.Name() // profile name
mk := NewMinikubeRunner(t, p, "--wait=false")
if usingNoneDriver(mk) {

View File

@ -31,7 +31,9 @@ import (
)
func TestStartStop(t *testing.T) {
p := t.Name() // profile name
p := "TestStartStop" // profile name
t.Parallel()
tests := []struct {
name string
args []string
@ -64,18 +66,17 @@ func TestStartStop(t *testing.T) {
}},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
mk := NewMinikubeRunner(t, p)
if !strings.Contains(test.name, "docker") && usingNoneDriver(mk) {
t.Skipf("skipping %s - incompatible with none driver", test.name)
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
mk := NewMinikubeRunner(t, p+tc.name)
if !strings.Contains(tc.name, "docker") && usingNoneDriver(mk) {
t.Skipf("skipping %s - incompatible with none driver", tc.name)
}
mk.RunCommand("config set WantReportErrorPrompt false", true)
mk.RunCommand("delete", false)
mk.CheckStatus(state.None.String())
mk.Start(test.args...)
mk.Start(tc.args...)
mk.CheckStatus(state.Running.String())
ip := mk.RunCommand("ip", true)
@ -85,14 +86,15 @@ func TestStartStop(t *testing.T) {
}
// check for the current-context before and after the stop
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)
}
// TODO: medya move this test to its own 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)
@ -111,7 +113,7 @@ func TestStartStop(t *testing.T) {
// t.Logf("current-context is not set to minikube")
// }
mk.Start(test.args...)
mk.Start(tc.args...)
mk.CheckStatus(state.Running.String())
mk.RunCommand("delete", true)

View File

@ -20,25 +20,35 @@ import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"runtime"
"strings"
"testing"
"time"
"github.com/docker/machine/libmachine/state"
retryablehttp "github.com/hashicorp/go-retryablehttp"
"github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/constants"
pkgutil "k8s.io/minikube/pkg/util"
"k8s.io/minikube/test/integration/util"
)
func downloadMinikubeBinary(version string) (*os.File, error) {
func downloadMinikubeBinary(t *testing.T, version string) (*os.File, error) {
// Grab latest release binary
url := pkgutil.GetBinaryDownloadURL(version, runtime.GOOS)
resp, err := retryablehttp.Get(url)
if err != nil {
var resp *http.Response
var err error
download := func() error {
resp, err = retryablehttp.Get(url)
return err
}
if err := util.Retry(t, download, 3*time.Second, 13); err != nil {
return nil, errors.Wrap(err, "Failed to get latest release binary")
}
defer resp.Body.Close()
tf, err := ioutil.TempFile("", "minikube")
@ -66,15 +76,19 @@ func downloadMinikubeBinary(version string) (*os.File, error) {
// the odlest supported k8s version and then runs the current head minikube
// and it tries to upgrade from the older supported k8s to news supported k8s
func TestVersionUpgrade(t *testing.T) {
t.Parallel()
p := t.Name()
mkCurrent := NewMinikubeRunner(t, p)
mkCurrent.RunCommand("delete", true)
mkCurrent.CheckStatus(state.None.String())
tf, err := downloadMinikubeBinary("latest")
tf, err := downloadMinikubeBinary(t, "latest")
if err != nil || tf == nil {
t.Fatal(errors.Wrap(err, "Failed to download minikube binary."))
}
if !usingNoneDriver(mkCurrent) {
t.Parallel()
}
defer os.Remove(tf.Name())
mkRelease := NewMinikubeRunner(t, p)