Adding test to make sure HEAD can run on VM created by latest release

上级 b08af194
......@@ -20,9 +20,9 @@ REPO_PATH="k8s.io/minikube"
# Check for python on host, and use it if possible, otherwise fall back on python dockerized
if [[ -f $(which python 2>&1) ]]; then
PYTHON="python"
PYTHON="python"
else
PYTHON="docker run --rm -it -v $(pwd):/minikube -w /minikube python python"
PYTHON="docker run --rm -it -v $(pwd):/minikube -w /minikube python python"
fi
......@@ -51,9 +51,9 @@ set +e
files=$(gofmt -l -s . | grep -v ${ignore})
set -e
if [[ $files ]]; then
gofmt -d ${files}
echo "Gofmt errors in files: $files"
exit 1
gofmt -d ${files}
echo "Gofmt errors in files: $files"
exit 1
fi
# Check boilerplate
......@@ -64,8 +64,8 @@ set +e
files=$(${PYTHON} ${BOILERPLATEDIR}/boilerplate.py --rootdir . --boilerplate-dir ${BOILERPLATEDIR} | grep -v $ignore)
set -e
if [[ ! -z ${files} ]]; then
echo "Boilerplate missing in: ${files}."
exit 1
echo "Boilerplate missing in: ${files}."
exit 1
fi
echo "Checking releases.json schema"
......
/*
Copyright 2019 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package integration
import (
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"runtime"
"testing"
"github.com/docker/machine/libmachine/state"
"github.com/pkg/errors"
"k8s.io/minikube/test/integration/util"
)
func TestVersionUpgrade(t *testing.T) {
currentRunner := NewMinikubeRunner(t)
currentRunner.RunCommand("delete", true)
currentRunner.CheckStatus(state.None.String())
isoName := "minikube-linux-amd64"
if runtime.GOOS == "darwin" {
isoName = "minikube-darwin-amd64"
} else if runtime.GOOS == "windows" {
isoName = "minikube-windows-amd64.exe"
}
// Grab latest release binary
url := "https://storage.googleapis.com/minikube/releases/latest/" + isoName
resp, err := http.Get(url)
if err != nil {
t.Fatal(errors.Wrap(err, "Failed to get latest release binary"))
}
defer resp.Body.Close()
iso, err := ioutil.TempFile("", isoName)
if err != nil {
t.Fatal(errors.Wrap(err, "Failed to create binary file"))
}
defer os.Remove(iso.Name())
_, err = io.Copy(iso, resp.Body)
if err != nil {
t.Fatal(errors.Wrap(err, "Failed to populate iso file"))
}
if err := iso.Close(); err != nil {
t.Fatal(errors.Wrap(err, "Failed to close iso"))
}
if runtime.GOOS != "windows" {
if err := exec.Command("chmod", "+x", iso.Name()).Run(); err != nil {
t.Fatal(errors.Wrap(err, "Failed to make binary executable."))
}
}
latestRunner := util.MinikubeRunner{
Args: currentRunner.Args,
BinaryPath: iso.Name(),
StartArgs: currentRunner.StartArgs,
MountArgs: currentRunner.MountArgs,
T: t,
}
latestRunner.Start()
latestRunner.CheckStatus(state.Running.String())
latestRunner.RunCommand("stop", true)
latestRunner.CheckStatus(state.Stopped.String())
currentRunner.Start()
currentRunner.CheckStatus(state.Running.String())
currentRunner.RunCommand("delete", true)
currentRunner.CheckStatus(state.None.String())
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册