Skip to content

Commit

Permalink
add functional_podman_ubuntu test
Browse files Browse the repository at this point in the history
Fix test error messages

Fix test comment and docs
  • Loading branch information
ilya-zuyev committed May 5, 2021
1 parent 6bca921 commit 30f8a38
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 6 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,109 @@ jobs:
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_podman_ubuntu:
needs: [ build_minikube ]
env:
TIME_ELAPSED: time
JOB_NAME: functional_podman_ubuntu
GOPOGH_RESULT: ""
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: ubuntu-20.04
steps:
- name: Install kubectl
shell: bash
run: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
sudo install kubectl /usr/local/bin/kubectl
kubectl version --client=true
- name: Install Podman
shell: bash
run: |
sudo apt update
sudo apt install -y podman
echo "--------------------------"
podman version || true
echo "--------------------------"
podman info || true
echo "--------------------------"
podman system df || true
echo "--------------------------"
podman system info --format='{{json .}}'|| true
echo "--------------------------"
podman ps || true
echo "--------------------------"
# go 1.14.6+ is needed because of this bug https://github.com/golang/go/issues/39308
- uses: actions/setup-go@v2
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run Integration Test
continue-on-error: false
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
run: |
cd minikube_binaries
mkdir -p report
mkdir -p testhome
chmod a+x e2e-*
chmod a+x minikube-*
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=podman -v=6 --alsologtostderr -test.run TestFunctional -test.timeout=10m -test.v -timeout-multiplier=1.5 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo "TIME_ELAPSED=${TIME_ELAPSED}" >> $GITHUB_ENV
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
export PATH=${PATH}:`go env GOPATH`/bin
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
STAT=$(gopogh -in ./report/testout.json -out_html ./report/testout.html -out_summary ./report/testout_summary.json -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo "GOPOGH_RESULT=${GOPOGH_RESULT}" >> $GITHUB_ENV
echo 'STAT<<EOF' >> $GITHUB_ENV
echo "${STAT}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: actions/upload-artifact@v1
with:
name: functional_podman_ubuntu
path: minikube_binaries/report
- name: The End Result functional_podman_ubuntu
shell: bash
run: |
echo ${GOPOGH_RESULT}
numFail=$(echo $STAT | jq '.NumberOfFail')
numPass=$(echo $STAT | jq '.NumberOfPass')
echo "*******************${numPass} Passes :) *******************"
echo $STAT | jq '.PassedTests' || true
echo "*******************************************************"
echo "---------------- ${numFail} Failures :( ----------------------------"
echo $STAT | jq '.FailedTests' || true
echo "-------------------------------------------------------"
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_virtualbox_macos:
needs: [build_minikube]
env:
Expand Down Expand Up @@ -882,6 +985,7 @@ jobs:
functional_docker_ubuntu,
functional_docker_containerd_ubuntu,
functional_docker_ubuntu_arm64,
functional_podman_ubuntu,
functional_virtualbox_macos,
functional_docker_windows,
functional_hyperv_windows,
Expand All @@ -900,6 +1004,7 @@ jobs:
cp -r ./functional_docker_ubuntu ./all_reports/
cp -r ./functional_docker_containerd_ubuntu ./all_reports/
cp -r ./functional_docker_ubuntu_arm64 ./all_reports/
cp -r ./functional_podman_ubuntu ./all_reports/
cp -r ./functional_virtualbox_macos ./all_reports/
cp -r ./functional_docker_windows ./all_reports/
cp -r ./functional_hyperv_windows ./all_reports/
Expand Down
106 changes: 105 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ jobs:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh

shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-linux-amd64
Expand Down Expand Up @@ -280,6 +279,109 @@ jobs:
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_podman_ubuntu:
needs: [ build_minikube ]
env:
TIME_ELAPSED: time
JOB_NAME: functional_podman_ubuntu
GOPOGH_RESULT: ""
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: ubuntu-20.04
steps:
- name: Install kubectl
shell: bash
run: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
sudo install kubectl /usr/local/bin/kubectl
kubectl version --client=true
- name: Install Podman
shell: bash
run: |
sudo apt update
sudo apt install -y podman
echo "--------------------------"
podman version || true
echo "--------------------------"
podman info || true
echo "--------------------------"
podman system df || true
echo "--------------------------"
podman system info --format='{{json .}}'|| true
echo "--------------------------"
podman ps || true
echo "--------------------------"
# go 1.14.6+ is needed because of this bug https://github.com/golang/go/issues/39308
- uses: actions/setup-go@v2
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run Integration Test
continue-on-error: false
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
run: |
cd minikube_binaries
mkdir -p report
mkdir -p testhome
chmod a+x e2e-*
chmod a+x minikube-*
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=podman -v=6 --alsologtostderr -test.run TestFunctional -test.timeout=10m -test.v -timeout-multiplier=1.5 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo "TIME_ELAPSED=${TIME_ELAPSED}" >> $GITHUB_ENV
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
export PATH=${PATH}:`go env GOPATH`/bin
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
STAT=$(gopogh -in ./report/testout.json -out_html ./report/testout.html -out_summary ./report/testout_summary.json -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo "GOPOGH_RESULT=${GOPOGH_RESULT}" >> $GITHUB_ENV
echo 'STAT<<EOF' >> $GITHUB_ENV
echo "${STAT}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: actions/upload-artifact@v1
with:
name: functional_podman_ubuntu
path: minikube_binaries/report
- name: The End Result functional_podman_ubuntu
shell: bash
run: |
echo ${GOPOGH_RESULT}
numFail=$(echo $STAT | jq '.NumberOfFail')
numPass=$(echo $STAT | jq '.NumberOfPass')
echo "*******************${numPass} Passes :) *******************"
echo $STAT | jq '.PassedTests' || true
echo "*******************************************************"
echo "---------------- ${numFail} Failures :( ----------------------------"
echo $STAT | jq '.FailedTests' || true
echo "-------------------------------------------------------"
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_virtualbox_macos:
needs: [build_minikube]
env:
Expand Down Expand Up @@ -879,6 +981,7 @@ jobs:
[
functional_docker_ubuntu,
functional_docker_containerd_ubuntu,
functional_podman_ubuntu,
functional_docker_ubuntu_arm64,
functional_virtualbox_macos,
functional_docker_windows,
Expand All @@ -897,6 +1000,7 @@ jobs:
ls -lah
cp -r ./functional_docker_ubuntu ./all_reports/
cp -r ./functional_docker_containerd_ubuntu ./all_reports/
cp -r ./functional_podman_ubuntu ./all_reports/
cp -r ./functional_docker_ubuntu_arm64 ./all_reports/
cp -r ./functional_virtualbox_macos ./all_reports/
cp -r ./functional_docker_windows ./all_reports/
Expand Down
7 changes: 5 additions & 2 deletions site/content/en/docs/contrib/tests.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ validateBuildImage makes sures that `minikube image build` works as expected
validateListImages makes sures that `minikube image ls` works as expected

#### validateDockerEnv
check functionality of minikube after evaling docker-env
check functionality of minikube after evaluating docker-env

#### validatePodmanEnv
check functionality of minikube after evaluating podman-env

#### validateStartWithProxy
validateStartWithProxy makes sure minikube start respects the HTTP_PROXY environment variable
Expand Down Expand Up @@ -351,4 +354,4 @@ TestKubernetesUpgrade upgrades Kubernetes from oldest to newest
## TestMissingContainerUpgrade
TestMissingContainerUpgrade tests a Docker upgrade where the underlying container is missing

TEST COUNT: 112
TEST COUNT: 113
61 changes: 58 additions & 3 deletions test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
"k8s.io/minikube/pkg/util/retry"

"github.com/elazarl/goproxy"
retryablehttp "github.com/hashicorp/go-retryablehttp"
"github.com/hashicorp/go-retryablehttp"
"github.com/otiai10/copy"
"github.com/phayes/freeport"
"github.com/pkg/errors"
Expand Down Expand Up @@ -131,6 +131,7 @@ func TestFunctional(t *testing.T) {
{"CertSync", validateCertSync},
{"UpdateContextCmd", validateUpdateContextCmd},
{"DockerEnv", validateDockerEnv},
{"PodmanEnv", validatePodmanEnv},
{"NodeLabels", validateNodeLabels},
{"LoadImage", validateLoadImage},
{"RemoveImage", validateRemoveImage},
Expand Down Expand Up @@ -399,8 +400,7 @@ func validateListImages(ctx context.Context, t *testing.T, profile string) {
}
}

// check functionality of minikube after evaling docker-env
// TODO: Add validatePodmanEnv for crio runtime: #10231
// check functionality of minikube after evaluating docker-env
func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
if NoneDriver() {
t.Skipf("none driver does not support docker-env")
Expand Down Expand Up @@ -460,6 +460,61 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
}
}

// check functionality of minikube after evaluating podman-env
func validatePodmanEnv(ctx context.Context, t *testing.T, profile string) {
if NoneDriver() {
t.Skipf("none driver does not support podman-env")
}

if cr := ContainerRuntime(); cr != "podman" {
t.Skipf("only validate podman env with docker container runtime, currently testing %s", cr)
}

if runtime.GOOS != "linux" {
t.Skipf("only validate podman env on linux, currently testing %s", runtime.GOOS)
}

defer PostMortemLogs(t, profile)

mctx, cancel := context.WithTimeout(ctx, Seconds(120))
defer cancel()

c := exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" podman-env) && "+Target()+" status -p "+profile)
// we should be able to get minikube status with a bash which evaluated podman-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.Fatalf("failed to do status after eval-ing podman-env. error: %v", err)
}
if !strings.Contains(rr.Output(), "Running") {
t.Fatalf("expected status output to include 'Running' after eval podman-env but got: *%s*", rr.Output())
}
if !strings.Contains(rr.Output(), "in-use") {
t.Fatalf("expected status output to include `in-use` after eval podman-env but got *%s*", rr.Output())
}

mctx, cancel = context.WithTimeout(ctx, Seconds(60))
defer cancel()
// do a eval $(minikube -p profile podman-env) and check if we are point to docker inside minikube
c = exec.CommandContext(mctx, "/bin/bash", "-c", "eval $("+Target()+" -p "+profile+" podman-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 podman-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())
}
}

// validateStartWithProxy makes sure minikube start respects the HTTP_PROXY environment variable
func validateStartWithProxy(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)
Expand Down
4 changes: 4 additions & 0 deletions test/integration/functional_test_mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // no
t.Skip("skipping: mount broken on windows: https://github.com/kubernetes/minikube/issues/8303")
}

if GithubActionRunner() && PodmanDriver() {
t.Skip("skipping: https://github.com/kubernetes/minikube/issues/11293")
}

tempDir, err := ioutil.TempDir("", "mounttest")
defer func() { // clean up tempdir
err := os.RemoveAll(tempDir)
Expand Down

0 comments on commit 30f8a38

Please sign in to comment.