Skip to content

Commit bcf69bf

Browse files
authored
ci: add qemu functional test to github action on macos13 (#21274)
* add qemu functional test to github action on macos13 * remove memory arg * add higher wait time for qemu and nested in integration test for pvc * higher mins for qemu/vfkit nested * use maxwait * add same workflow for master jobs * bump wait
1 parent eeecb12 commit bcf69bf

File tree

3 files changed

+246
-4
lines changed

3 files changed

+246
-4
lines changed

.github/workflows/master.yml

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,121 @@ jobs:
415415
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
416416
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
417417
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
418-
418+
functional_qemu_macos13_intel:
419+
permissions:
420+
contents: none
421+
needs: [build_minikube_test_binaries]
422+
env:
423+
TIME_ELAPSED: time
424+
JOB_NAME: "functional_qemu_macos13_intel"
425+
GOPOGH_RESULT: ""
426+
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
427+
runs-on: macos-13
428+
steps:
429+
- name: Install kubectl and docker-cli
430+
shell: bash
431+
run: |
432+
brew install kubectl
433+
brew install docker
434+
kubectl version --client=true
435+
- name: Install Qemu and socket_vmnet
436+
shell: bash
437+
run: |
438+
brew update
439+
brew install qemu socket_vmnet
440+
HOMEBREW=$(which brew) && sudo ${HOMEBREW} services start socket_vmnet
441+
fw=/usr/libexec/ApplicationFirewall/socketfilterfw
442+
sudo $fw --remove /usr/libexec/bootpd
443+
sudo $fw --add /usr/libexec/bootpd
444+
sudo $fw --unblock /usr/libexec/bootpd
445+
- name: Info Block
446+
shell: bash
447+
run: |
448+
set -x
449+
uname -a
450+
sysctl -n hw.memsize
451+
echo "$(sysctl -n hw.memsize) / 1024 / 1024 / 1024" | bc
452+
sysctl -n hw.ncpu
453+
sysctl -n machdep.cpu.brand_string
454+
sysctl hw.model
455+
sysctl -n kern.hv_vmm_present
456+
sysctl -n kern.hv_support
457+
system_profiler SPHardwareDataType
458+
docker version || true
459+
docker info || true
460+
echo "macOS version:"
461+
sw_vers
462+
ifconfig
463+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
464+
with:
465+
cache: true
466+
go-version: ${{env.GO_VERSION}}
467+
- name: Install gopogh
468+
shell: bash
469+
run: |
470+
go install github.com/medyagh/gopogh/cmd/[email protected]
471+
- name: Download Binaries
472+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
473+
with:
474+
name: minikube_binaries
475+
path: minikube_binaries
476+
- name: Run Integration Test
477+
continue-on-error: true
478+
# bash {0} to allow test to continue to next step. in case of
479+
shell: bash {0}
480+
run: |
481+
set -x
482+
pwd
483+
cd minikube_binaries
484+
chmod a+x e2e-*
485+
chmod a+x minikube-*
486+
mkdir -p report
487+
# test home
488+
mkdir -p /tmp/th
489+
MINIKUBE_HOME=/tmp/th ./minikube-darwin-amd64 delete --all --purge
490+
START_TIME=$(date -u +%s)
491+
KUBECONFIG=$/tmp/th/kubeconfig MINIKUBE_HOME=/tmp/th ./e2e-darwin-amd64 -minikube-start-args="--vm-driver=qemu --wait-timeout=15m --network socket_vmnet" -test.run TestFunctional -test.timeout=40m -test.v -timeout-multiplier=1.5 -binary=./minikube-darwin-amd64 2>&1 | tee ./report/testout.txt
492+
END_TIME=$(date -u +%s)
493+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
494+
min=$((${TIME_ELAPSED}/60))
495+
sec=$((${TIME_ELAPSED}%60))
496+
TIME_ELAPSED="${min} min $sec seconds "
497+
echo "TIME_ELAPSED=${TIME_ELAPSED}" >> $GITHUB_ENV
498+
- name: Generate HTML Report
499+
shell: bash
500+
run: |
501+
cd minikube_binaries
502+
export PATH=${PATH}:`go env GOPATH`/bin
503+
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
504+
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
505+
echo status: ${STAT}
506+
FailNum=$(echo $STAT | jq '.NumberOfFail')
507+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
508+
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
509+
echo "GOPOGH_RESULT=${GOPOGH_RESULT}" >> $GITHUB_ENV
510+
echo 'STAT<<EOF' >> $GITHUB_ENV
511+
echo "${STAT}" >> $GITHUB_ENV
512+
echo 'EOF' >> $GITHUB_ENV
513+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
514+
with:
515+
name: functional_qemu_macos13_intel
516+
path: minikube_binaries/report
517+
- name: The End Result functional_qemu_macos13_intel
518+
shell: bash
519+
run: |
520+
echo ${GOPOGH_RESULT}
521+
numFail=$(echo $STAT | jq '.NumberOfFail')
522+
numPass=$(echo $STAT | jq '.NumberOfPass')
523+
echo "*******************${numPass} Passes :) *******************"
524+
echo $STAT | jq '.PassedTests' || true
525+
echo "*******************************************************"
526+
echo "---------------- ${numFail} Failures :( ----------------------------"
527+
echo $STAT | jq '.FailedTests' || true
528+
echo "-------------------------------------------------------"
529+
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
530+
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
531+
if [ "$numPass" -lt 56 ];then echo "*** Failed to pass at least 56 ! ***";exit 2;fi
532+
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
419533
functional_podman_ubuntu:
420534
permissions:
421535
contents: none
@@ -655,6 +769,7 @@ jobs:
655769
functional_docker_rootless_containerd_ubuntu,
656770
functional_podman_ubuntu,
657771
functional_baremetal_ubuntu22_04,
772+
functional_qemu_macos13_intel,
658773
]
659774
runs-on: ubuntu-22.04
660775
steps:
@@ -671,6 +786,7 @@ jobs:
671786
cp -r ./functional_docker_rootless_containerd_ubuntu ./all_reports/
672787
cp -r ./functional_podman_ubuntu ./all_reports/
673788
cp -r ./functional_baremetal_ubuntu22_04 ./all_reports/
789+
cp -r ./functional_qemu_macos13_intel ./all_reports/
674790
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
675791
with:
676792
name: all_reports

.github/workflows/pr.yml

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,121 @@ jobs:
413413
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
414414
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
415415
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
416-
416+
functional_qemu_macos13_intel:
417+
permissions:
418+
contents: none
419+
needs: [build_minikube_test_binaries]
420+
env:
421+
TIME_ELAPSED: time
422+
JOB_NAME: "functional_qemu_macos13_intel"
423+
GOPOGH_RESULT: ""
424+
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
425+
runs-on: macos-13
426+
steps:
427+
- name: Install kubectl and docker-cli
428+
shell: bash
429+
run: |
430+
brew install kubectl
431+
brew install docker
432+
kubectl version --client=true
433+
- name: Install Qemu and socket_vmnet
434+
shell: bash
435+
run: |
436+
brew update
437+
brew install qemu socket_vmnet
438+
HOMEBREW=$(which brew) && sudo ${HOMEBREW} services start socket_vmnet
439+
fw=/usr/libexec/ApplicationFirewall/socketfilterfw
440+
sudo $fw --remove /usr/libexec/bootpd
441+
sudo $fw --add /usr/libexec/bootpd
442+
sudo $fw --unblock /usr/libexec/bootpd
443+
- name: Info Block
444+
shell: bash
445+
run: |
446+
set -x
447+
uname -a
448+
sysctl -n hw.memsize
449+
echo "$(sysctl -n hw.memsize) / 1024 / 1024 / 1024" | bc
450+
sysctl -n hw.ncpu
451+
sysctl -n machdep.cpu.brand_string
452+
sysctl hw.model
453+
sysctl -n kern.hv_vmm_present
454+
sysctl -n kern.hv_support
455+
system_profiler SPHardwareDataType
456+
docker version || true
457+
docker info || true
458+
echo "macOS version:"
459+
sw_vers
460+
ifconfig
461+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
462+
with:
463+
cache: true
464+
go-version: ${{env.GO_VERSION}}
465+
- name: Install gopogh
466+
shell: bash
467+
run: |
468+
go install github.com/medyagh/gopogh/cmd/[email protected]
469+
- name: Download Binaries
470+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
471+
with:
472+
name: minikube_binaries
473+
path: minikube_binaries
474+
- name: Run Integration Test
475+
continue-on-error: true
476+
# bash {0} to allow test to continue to next step. in case of
477+
shell: bash {0}
478+
run: |
479+
set -x
480+
pwd
481+
cd minikube_binaries
482+
chmod a+x e2e-*
483+
chmod a+x minikube-*
484+
mkdir -p report
485+
# test home
486+
mkdir -p /tmp/th
487+
MINIKUBE_HOME=/tmp/th ./minikube-darwin-amd64 delete --all --purge
488+
START_TIME=$(date -u +%s)
489+
KUBECONFIG=$/tmp/th/kubeconfig MINIKUBE_HOME=/tmp/th ./e2e-darwin-amd64 -minikube-start-args="--vm-driver=qemu --wait-timeout=15m --network socket_vmnet" -test.run TestFunctional -test.timeout=40m -test.v -timeout-multiplier=1.5 -binary=./minikube-darwin-amd64 2>&1 | tee ./report/testout.txt
490+
END_TIME=$(date -u +%s)
491+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
492+
min=$((${TIME_ELAPSED}/60))
493+
sec=$((${TIME_ELAPSED}%60))
494+
TIME_ELAPSED="${min} min $sec seconds "
495+
echo "TIME_ELAPSED=${TIME_ELAPSED}" >> $GITHUB_ENV
496+
- name: Generate HTML Report
497+
shell: bash
498+
run: |
499+
cd minikube_binaries
500+
export PATH=${PATH}:`go env GOPATH`/bin
501+
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
502+
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
503+
echo status: ${STAT}
504+
FailNum=$(echo $STAT | jq '.NumberOfFail')
505+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
506+
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
507+
echo "GOPOGH_RESULT=${GOPOGH_RESULT}" >> $GITHUB_ENV
508+
echo 'STAT<<EOF' >> $GITHUB_ENV
509+
echo "${STAT}" >> $GITHUB_ENV
510+
echo 'EOF' >> $GITHUB_ENV
511+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
512+
with:
513+
name: functional_qemu_macos13_intel
514+
path: minikube_binaries/report
515+
- name: The End Result functional_qemu_macos13_intel
516+
shell: bash
517+
run: |
518+
echo ${GOPOGH_RESULT}
519+
numFail=$(echo $STAT | jq '.NumberOfFail')
520+
numPass=$(echo $STAT | jq '.NumberOfPass')
521+
echo "*******************${numPass} Passes :) *******************"
522+
echo $STAT | jq '.PassedTests' || true
523+
echo "*******************************************************"
524+
echo "---------------- ${numFail} Failures :( ----------------------------"
525+
echo $STAT | jq '.FailedTests' || true
526+
echo "-------------------------------------------------------"
527+
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
528+
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
529+
if [ "$numPass" -lt 56 ];then echo "*** Failed to pass at least 56 ! ***";exit 2;fi
530+
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
417531
functional_podman_ubuntu:
418532
permissions:
419533
contents: none
@@ -653,6 +767,7 @@ jobs:
653767
functional_docker_rootless_containerd_ubuntu,
654768
functional_podman_ubuntu,
655769
functional_baremetal_ubuntu22_04,
770+
functional_qemu_macos13_intel,
656771
]
657772
runs-on: ubuntu-22.04
658773
steps:
@@ -669,6 +784,7 @@ jobs:
669784
cp -r ./functional_docker_rootless_containerd_ubuntu ./all_reports/
670785
cp -r ./functional_podman_ubuntu ./all_reports/
671786
cp -r ./functional_baremetal_ubuntu22_04 ./all_reports/
787+
cp -r ./functional_qemu_macos13_intel ./all_reports/
672788
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
673789
with:
674790
name: all_reports

test/integration/functional_test_pvc_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ import (
3131

3232
core "k8s.io/api/core/v1"
3333
storage "k8s.io/api/storage/v1"
34+
"k8s.io/minikube/pkg/minikube/detect"
3435
"k8s.io/minikube/pkg/util/retry"
3536
)
3637

3738
// validatePersistentVolumeClaim makes sure PVCs work properly
39+
// verifies at least one StorageClass exists
40+
// Applies a PVC manifest (pvc.yaml) and verfies PVC named myclaim reaches phase Bound.
41+
// Creates a test pod (sp-pod) that mounts the claim (via createPVTestPod).
42+
// Writes a file foo to the mounted volume at /tmp/mount/foo.
43+
// Deletes the pod, recreates it, and verifies the file foo still exists by listing /tmp/mount, proving data persists across pod restarts.
3844
func validatePersistentVolumeClaim(ctx context.Context, t *testing.T, profile string) {
3945
defer PostMortemLogs(t, profile)
4046

@@ -126,8 +132,12 @@ func createPVTestPod(ctx context.Context, t *testing.T, profile string) {
126132
if err != nil {
127133
t.Fatalf("kubectl apply pvc.yaml failed: args %q: %v", rr.Command(), err)
128134
}
135+
maxWait := 4
136+
if detect.NestedVM() || detect.GithubActionRunner() {
137+
maxWait = 6
138+
}
129139
// wait for pod to be running
130-
if _, err := PodWait(ctx, t, profile, "default", "test=storage-provisioner", Minutes(3)); err != nil {
131-
t.Fatalf("failed waiting for pod: %v", err)
140+
if _, err := PodWait(ctx, t, profile, "default", "test=storage-provisioner", Minutes(maxWait)); err != nil {
141+
t.Fatalf("failed waiting for pvctest pod : %v", err)
132142
}
133143
}

0 commit comments

Comments
 (0)