break down docker-env test
parent
e94db2c226
commit
3263953811
|
|
@ -198,7 +198,7 @@ jobs:
|
|||
chmod a+x e2e-*
|
||||
chmod a+x minikube-*
|
||||
START_TIME=$(date -u +%s)
|
||||
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-darwin-amd64 -minikube-start-args=--vm-driver=virtualbox -test.run TestFunctional -test.timeout=10m -test.v -timeout-multiplier=1.5 -binary=./minikube-darwin-amd64 2>&1 | tee ./report/testout.txt
|
||||
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-darwin-amd64 -minikube-start-args=--vm-driver=virtualbox -test.run TestFunctional -test.timeout=13m -test.v -timeout-multiplier=1.5 -binary=./minikube-darwin-amd64 2>&1 | tee ./report/testout.txt
|
||||
END_TIME=$(date -u +%s)
|
||||
TIME_ELAPSED=$(($END_TIME-$START_TIME))
|
||||
min=$((${TIME_ELAPSED}/60))
|
||||
|
|
|
|||
|
|
@ -154,52 +154,57 @@ func validateNodeLabels(ctx context.Context, t *testing.T, profile string) {
|
|||
// check functionality of minikube after evaling docker-env
|
||||
func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
|
||||
defer PostMortemLogs(t, profile)
|
||||
mctx, cancel := context.WithTimeout(ctx, Seconds(30))
|
||||
defer cancel()
|
||||
var rr *RunResult
|
||||
var err error
|
||||
if runtime.GOOS == "windows" {
|
||||
c := exec.CommandContext(mctx, "powershell.exe", "-NoProfile", "-NonInteractive", Target()+" -p "+profile+" docker-env | Invoke-Expression ;"+Target()+" status -p "+profile)
|
||||
rr, err = Run(t, c)
|
||||
} else {
|
||||
c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && "+Target()+" status -p "+profile)
|
||||
// we should be able to get minikube status with a bash which evaled docker-env
|
||||
rr, err = Run(t, c)
|
||||
}
|
||||
if mctx.Err() == context.DeadlineExceeded {
|
||||
t.Errorf("failed to run the command by deadline. exceeded timeout. %s", rr.Command())
|
||||
}
|
||||
if err != nil {
|
||||
t.Logf("failed to do status after eval-ing docker-env. error: %v", err)
|
||||
}
|
||||
if !strings.Contains(rr.Output(), "Running") {
|
||||
t.Fatalf("expected status output to include 'Running' after eval docker-env but got: *%s*", rr.Output())
|
||||
|
||||
t.Run("StatusAfterEval", func(t *testing.T) {
|
||||
mctx, cancel := context.WithTimeout(ctx, Seconds(30))
|
||||
defer cancel()
|
||||
var rr *RunResult
|
||||
var err error
|
||||
if runtime.GOOS == "windows" {
|
||||
c := exec.CommandContext(mctx, "powershell.exe", "-NoProfile", "-NonInteractive", Target()+" -p "+profile+" docker-env | Invoke-Expression ;"+Target()+" status -p "+profile)
|
||||
rr, err = Run(t, c)
|
||||
} else {
|
||||
c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && "+Target()+" status -p "+profile)
|
||||
// we should be able to get minikube status with a bash which evaled docker-env
|
||||
rr, err = Run(t, c)
|
||||
}
|
||||
if mctx.Err() == context.DeadlineExceeded {
|
||||
t.Errorf("failed to run the command by deadline. exceeded timeout. %s", rr.Command())
|
||||
}
|
||||
if err != nil {
|
||||
t.Logf("failed to do status after eval-ing docker-env. error: %v", err)
|
||||
}
|
||||
if !strings.Contains(rr.Output(), "Running") {
|
||||
t.Fatalf("expected status output to include 'Running' after eval docker-env but got: *%s*", rr.Output())
|
||||
}
|
||||
}
|
||||
|
||||
mctx, cancel = context.WithTimeout(ctx, Seconds(30))
|
||||
defer cancel()
|
||||
// do a eval $(minikube -p profile docker-env) and check if we are point to docker inside minikube
|
||||
if runtime.GOOS == "windows" { // testing docker-env eval in powershell
|
||||
c := exec.CommandContext(mctx, "powershell.exe", "-NoProfile", "-NonInteractive", Target(), "-p "+profile+" docker-env | Invoke-Expression ; docker images")
|
||||
rr, err = Run(t, c)
|
||||
} else {
|
||||
c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && docker images")
|
||||
rr, err = Run(t, c)
|
||||
t.Run("ListImages", func(t *testing.T) {
|
||||
mctx, cancel := context.WithTimeout(ctx, Seconds(30))
|
||||
defer cancel()
|
||||
var rr *RunResult
|
||||
var err error
|
||||
// do a eval $(minikube -p profile docker-env) and check if we are point to docker inside minikube
|
||||
if runtime.GOOS == "windows" { // testing docker-env eval in powershell
|
||||
c := exec.CommandContext(mctx, "powershell.exe", "-NoProfile", "-NonInteractive", Target(), "-p "+profile+" docker-env | Invoke-Expression ; docker images")
|
||||
rr, err = Run(t, c)
|
||||
} else {
|
||||
c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" docker-env) && docker images")
|
||||
rr, err = Run(t, c)
|
||||
}
|
||||
if mctx.Err() == context.DeadlineExceeded {
|
||||
t.Errorf("failed to run the command in 30 seconds. exceeded 30s timeout. %s", rr.Command())
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("failed to run minikube docker-env. args %q : %v ", rr.Command(), err)
|
||||
}
|
||||
|
||||
expectedImgInside := "gcr.io/k8s-minikube/storage-provisioner"
|
||||
if !strings.Contains(rr.Output(), expectedImgInside) {
|
||||
t.Fatalf("expected 'docker images' to have %q inside minikube. but the output is: *%s*", expectedImgInside, rr.Output())
|
||||
}
|
||||
}
|
||||
|
||||
if mctx.Err() == context.DeadlineExceeded {
|
||||
t.Errorf("failed to run the command in 30 seconds. exceeded 30s timeout. %s", rr.Command())
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("failed to run minikube docker-env. args %q : %v ", rr.Command(), err)
|
||||
}
|
||||
|
||||
expectedImgInside := "gcr.io/k8s-minikube/storage-provisioner"
|
||||
if !strings.Contains(rr.Output(), expectedImgInside) {
|
||||
t.Fatalf("expected 'docker images' to have %q inside minikube. but the output is: *%s*", expectedImgInside, rr.Output())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func validateStartWithProxy(ctx context.Context, t *testing.T, profile string) {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,13 @@ func KicDriver() bool {
|
|||
return DockerDriver() || PodmanDriver()
|
||||
}
|
||||
|
||||
// GithubActionRunner returns true if running inside a github action runner
|
||||
func GithubActionRunner() bool {
|
||||
// based on https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
|
||||
return os.Getenv("GITHUB_ACTIONS") == "true"
|
||||
}
|
||||
|
||||
|
||||
// NeedsPortForward returns access to endpoints with this driver needs port forwarding
|
||||
// (Docker on non-Linux platforms requires ports to be forwarded to 127.0.0.1)
|
||||
func NeedsPortForward() bool {
|
||||
|
|
|
|||
Loading…
Reference in New Issue