Skip to content

Commit

Permalink
CI: Add QEMU functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Oct 11, 2023
1 parent d78a051 commit 34de018
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 2 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,121 @@ jobs:
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 26 ];then echo "*** Failed to pass at least 26 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_qemu_macos:
permissions:
contents: none
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "functional_qemu_macos"
GOPOGH_RESULT: ""
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: macos-12
steps:
- name: Install kubectl
shell: bash
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"
sudo install kubectl /usr/local/bin/kubectl
kubectl version --client=true
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{env.GO_VERSION}}
- name: Install gopogh
shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.13.0/gopogh-darwin-amd64
sudo install gopogh-darwin-amd64 /usr/local/bin/gopogh
- name: Setup QEMU
shell: bash
run: |
brew install qemu
- name: Checkout socket_vmnet
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
repository: lima-vm/socket_vmnet
- name: Install socket_vmnet
shell: bash
run: |
sudo make install
- name: Fix DHCP leases file
shell: bash
run: |
sudo /bin/launchctl kickstart -kp system/com.apple.NetworkSharing
- name: Install docker
shell: bash
run: |
brew install docker-machine docker
sudo docker --version
- name: Info
shell: bash
run: |
hostname
VBoxManage --version
sysctl hw.physicalcpu hw.logicalcpu
- name: Disable firewall
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw -k
- name: Download Binaries
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: minikube_binaries
path: 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-*
MINIKUBE_HOME=$(pwd)/testhome ./minikube-darwin-amd64 delete --all --purge
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-darwin-amd64 -minikube-start-args=--driver=qemu -test.run "TestFunctional" -test.timeout=35m -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))
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: functional_qemu_macos
path: minikube_binaries/report
- name: The End Result functional_qemu_macos
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 33 ];then echo "*** Failed to pass at least 33 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
# After all integration tests finished
# collect all the reports and upload them
upload_all_reports:
Expand All @@ -602,6 +717,7 @@ jobs:
functional_podman_ubuntu,
functional_virtualbox_macos,
functional_baremetal_ubuntu20_04,
functional_qemu_macos,
]
runs-on: ubuntu-20.04
steps:
Expand All @@ -618,6 +734,7 @@ jobs:
cp -r ./functional_podman_ubuntu ./all_reports/
cp -r ./functional_virtualbox_macos ./all_reports/
cp -r ./functional_baremetal_ubuntu20_04 ./all_reports/
cp -r ./functional_qemu_macos ./all_reports/
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,117 @@ jobs:
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 26 ];then echo "*** Failed to pass at least 26 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_qemu_macos:
permissions:
contents: none
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "functional_qemu_macos"
GOPOGH_RESULT: ""
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
runs-on: macos-12
steps:
- name: Disable firewall
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd
- name: Install kubectl
shell: bash
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"
sudo install kubectl /usr/local/bin/kubectl
kubectl version --client=true
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{env.GO_VERSION}}
- name: Install gopogh
shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.13.0/gopogh-darwin-amd64
sudo install gopogh-darwin-amd64 /usr/local/bin/gopogh
- name: Setup QEMU
shell: bash
run: |
brew install qemu
- name: Checkout socket_vmnet
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
repository: lima-vm/socket_vmnet
- name: Install socket_vmnet
shell: bash
run: |
sudo make install
- name: Install docker
shell: bash
run: |
brew install docker-machine docker
sudo docker --version
- name: Info
shell: bash
run: |
hostname
VBoxManage --version
sysctl hw.physicalcpu hw.logicalcpu
- name: Download Binaries
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: minikube_binaries
path: 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-*
MINIKUBE_HOME=$(pwd)/testhome ./minikube-darwin-amd64 delete --all --purge
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-darwin-amd64 -minikube-start-args=--driver=qemu -test.run "TestFunctional" -test.timeout=35m -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))
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: functional_qemu_macos
path: minikube_binaries/report
- name: The End Result functional_qemu_macos
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 33 ];then echo "*** Failed to pass at least 33 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
# After all integration tests finished
# collect all the reports and upload them
upload_all_reports:
Expand All @@ -723,6 +834,7 @@ jobs:
functional_podman_ubuntu,
functional_virtualbox_macos,
functional_baremetal_ubuntu20_04,
functional_qemu_macos,
]
runs-on: ubuntu-20.04
steps:
Expand All @@ -740,6 +852,7 @@ jobs:
cp -r ./functional_podman_ubuntu ./all_reports/
cp -r ./functional_virtualbox_macos ./all_reports/
cp -r ./functional_baremetal_ubuntu20_04 ./all_reports/
cp -r ./functional_qemu_macos ./all_reports/
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var runCorpProxy = detect.GithubActionRunner() && runtime.GOOS == "linux" && !ar
// TestFunctional are functionality tests which can safely share a profile in parallel
func TestFunctional(t *testing.T) {

profile := UniqueProfileName("functional")
profile := UniqueProfileName("func")
ctx, cancel := context.WithTimeout(context.Background(), Minutes(40))
defer func() {
if !*cleanup {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/functional_test_pvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func createPVTestPod(ctx context.Context, t *testing.T, profile string) {
t.Fatalf("kubectl apply pvc.yaml failed: args %q: %v", rr.Command(), err)
}
// wait for pod to be running
if _, err := PodWait(ctx, t, profile, "default", "test=storage-provisioner", Minutes(3)); err != nil {
if _, err := PodWait(ctx, t, profile, "default", "test=storage-provisioner", Minutes(4)); err != nil {
t.Fatalf("failed waiting for pod: %v", err)
}
}

0 comments on commit 34de018

Please sign in to comment.