Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: try Qemu on macos in github actions #18534

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,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 @@ -615,6 +730,7 @@ jobs:
functional_podman_ubuntu,
functional_virtualbox_macos,
functional_baremetal_ubuntu20_04,
functional_qemu_macos,
]
runs-on: ubuntu-20.04
steps:
Expand All @@ -631,6 +747,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@5d5d22a31266ced268874388b861e4b58bb5c2f3
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 @@ -722,6 +722,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_test_binaries]
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-13
steps:
- name: Disable firewall & security
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd
sudo spctl --master-disable
- 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: Install QEMU
shell: bash
run: |
brew update || true
brew install --overwrite qemu || true
- name: Install and run socket_vmnet
shell: bash
run: |
brew install socket_vmnet
brew tap homebrew/services
HOMEBREW=$(which brew) && sudo ${HOMEBREW} services start socket_vmnet
- name: Install docker
shell: bash
run: |
brew install docker-machine docker
sudo docker --version
- name: Info
shell: bash
run: |
hostname
sysctl hw.physicalcpu hw.logicalcpu
qemu-system-x86_64 --version
- name: Download Binaries
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427
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 @@ -736,6 +847,7 @@ jobs:
functional_podman_ubuntu,
functional_virtualbox_macos,
functional_baremetal_ubuntu20_04,
functional_qemu_macos,
]
runs-on: ubuntu-20.04
steps:
Expand All @@ -753,6 +865,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@5d5d22a31266ced268874388b861e4b58bb5c2f3
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)
}
}